# Question
Title: Selecting a current row in a Matrix field of multiple rows
Ive got a jquery tabbed area, with each tab showing image and text. Id like the user to be able to click on an image being displayed in a tab (a matrix row) and launch a larger overlay version. I am having trouble being able to call up just a single image from a particular row. (The tabbed area is generated using the matrix fieldtype for rows to create the tabs, in the admin CP form.)

I understand how to use limit and offset etc, but cannot work out how to control which image is seen, ie I need some sort of '{current\_row}' - which doesnt exist! Ive tried {field\_row\_count} and {row\_count} and tried using conditionals, but nothing works. Has anyone done this already?

# Answer
Matrix has a `{row_id}` variable which will output a unique ID for you, eg

```
{matrix_field}
<div id="{row_id}">{matrix_field_name} {matrix_field_image}</div>
{/matrix_field}

```

Would output something like

```
<div id="1">Eggs eggs.png</div>
<div id="2">bacon bacon.png</div>
<div id="3">Cheese cheese.png</div>

```

Does that help?
> 1 votes

# Answer
Ive solved it, so thought I'd share in case anyone else is as stupid as Ive been (doubtful, but possible).

Using simple overlay, tabs and accordions from jQuery tools, though others are all similar, and Matrix fields to create the accordions or tabbed content. The desired effect was to click on an image in a row and launch a large overlay of just that image.

**In the page** \- this is just the section for holding the image, if it's there:

{panel\_content} {if panel\_image} {exp:ed\_imageresizer image="{panel\_image}" maxWidth="300" maxHeight="230" forceWidth="yes" forceHeight="yes" title="#{row\_id}" cropratio="130:100" alt="{title}"} {/if} {/panel\_content}

**And in the overlay:**

```
{panel_content}
    <div class="simple_overlay" id="link{row_id}">
     {exp:ed_imageresizer image="{panel_image}" maxWidth="600" maxHeight="500" forceWidth="yes" forceHeight="yes" title="#{row_id}" cropratio="130:100" alt="{panel_title}"}

    <div id="{row_id}" class="panel-img-caption">
       {if panel_title}{panel_title}{/if}
    </div>
    </div><!--/.simple_overlay-->
{/panel_content}

```

The js to trigger the instance is:

$(function () { $("a\[rel\]").overlay({mask: '#000'});

});
> 0 votes

---
Tags: matrix
---


title: matrix assets not showing all images

text:
# Question
Title: matrix assets not showing all images
am trying to set up a kind of project management type site and am using matrix and assets. The idea being that over the course of the project multiple galleries could be uploaded, so in the custom field have got Matrix set up with a date column and an asset column, have entered in one sample gallery, but it's only outputting 1 image - the images are there in the entry and in assets, but am stuck how to get it to output all of the images, my code is:

```
{images}
    {date format="%d %F %Y"} - {images}
{/images}

```

Any ideas what I've done wrong

Cheers Jonny

# Answer
> 1 votes
Jonathan,

What is {images}?

If we can back up and you can add a bit more context to your post, that would help. Version numbers for Assets,Matrix, and EE would be a great start. Also, a screenshot of your Matrix field would be great! Essentially you need something like this, though:

```
{exp:channel:entries channel="your_channel"}
<h1>{title}</h1>

    {your_matrix_field}
            {your_assets_column}
                        {filename}<br />
           {/your_assets_column}
    {/your_matrix_field}
{/exp:channel:entries}

```

# Answer
> 0 votes
Sounds like your tag names aren't matching your settings correctly.

```
{images}
    {date format="%d %F %Y"} - {images}
{/images}

```

In your example, the first {images} should be the field name and the second {images} should be your Matrix column name. Is {images} the name of your Matrix column or is it something else?

---
Tags: assets, matrix
---


# Question
Title: Safecracker Registration Return path url issue
I have confused myself slightly setting up the return path for my safecracker login form for the following site \[Click here for link\]\[1\]

*if you scroll down to the roster section click mel debarge, in the the pop up you will notice a download section, when you click on the press kit button you are redirected to the login page.*

When user enter the correct login detail they are able to access a PDF/JPEG which i have uploaded in the Matrix i have set up. The parameters for the matrix are the following `{press_material}{press_pdf}{press_material}`

In the entry properties for my login form i have the following:

```
{exp:safecracker
channel="roster"
    dynamic_title="[member_first_name] [member_last_name]"
    include_jquery="no"
    group_id="5"
    loggin_member="yes"
    error_handling="inline"
    return="{path='{press_material}{press_pdf}{/press_material}/{url_title}'}"

```

In aim to redirect registered users to the file uploaded in the matrix, However i don't seem to be having any joy. Does anyone know how i can resolve this issue??

do i need to use the embed proporties in order for this to work?

\[1\]:

# Answer
> 1 votes
The fix for this was twofold:

1. Needed to add register\_member="yes" to the Safecracker Registration tag
2. {url\_title} wasn't being parsed as coded. Changing the tag to {segment\_3} got the return path working correctly.

---
Tags: templates, safecracker, members, matrix, safecracker-registration
---


# Question
Title: Assets error when uploading to new directory
We seem to be having an issue with P&T Assets 2.0.5 when uploading a file to a freshly created sub-folder. If I create a sub-folder and try uploading a file into it, I receive the following javascript error"

```
There was an error uploading your file: Assets could not complete the requested operation.

```

However, if we create a sub-folder, navigate to a different part of the control panel and then navigate back to Assets, we can upload to it successfully.

Any thoughts on why this would be happening?

Hope someone can help?

Thanks, Gary

# Answer
GazCrane -

There are a few things to check here:

1. Permissions on /system/expressionengine/cache and its subfolders need to be 777 permissions.
2. Permissions and owners on your image folders and subfolders need to also be 777 with the write ownership for uploading.

Also, are you creating these folders via Assets? Or via the filesystem?

Also, hat version of EE? And where, exactly, are you seeing this? Via the publish page and an Assets custom field? Via the Assets module page? That info would help!

Let me know if fixing up permissions helps!
> 1 votes

---
Tags: assets
---


title: Disable Fields On Publish Page

text:
# Question
Title: Disable Fields On Publish Page
We have a unique problem where we still want the fields on the entry page to be available to view but have them disabled so they cannot be changed. So the editor group sees the field but cannot edit it.

Or

A plug that allows us to show a panel with the information.

Any ideas?

cheers,

# Answer
> 1 votes
Best way is to write you own JS to disable input into the fields. The **CP CSS & JS addon** lets you add custom code to the CP.

```
$("input").attr('disabled','disabled');

```

# Answer
> 0 votes
How about using Field Instructions instead of a field itself? Is this something that needs to be updated frequently by someone without access to edit custom fields?

---
Tags: fields, entry
---


# Question
Title: Cannot Choose File type in Matrix file selection
I am creating a channel field using matrix and when I make a cell for files, I cannot choose file type. the selection is empty. The reason I ask is because when i use the cell to upload an image the image displays distorted.

# Answer
> 0 votes
Distortion of the image in your template is most likely is not coming from your Matrix field settings. Check your template code to make sure you don't have hard coded width or height. Also, look at CSS to make sure height or width isn't set there.

---
Tags: matrix
---


# Question
Title: File Manager change in Wyvern mess up current entries?
I am wanting to change the file manager from EE File Manager to Assets 2 in Wyvern preferences. Currently the site has numerous entries with images embedded within the Wyvern custom fields.

Will changing the file manager mess up anything with those images? Any steps needed before making that switch?

Thanks in advance!

# Answer
Shouldn't make a difference, the images are all linked with the {filedir\_X} paths once its saved to the DB, then are turned back into URLs when rendered in the template. I doubt you'll have any issues, but would not hurt to back up the DB first.
> 0 votes

---
Tags: pixelandtonic, assets, wyvern
---


# Question
Title: Create an unsubscribe link for an EE mailing list outside of the email template
I am trying to create an unsubscribe link for the built in EE mailing list module that can be sent out without going through the Communicate page.

I know that within my email template, I can use the {unsubscribe\_url} tag, but I need a way to allow users to unsubscribe when messages aren't sent through that template.

Is there any other way to generate an unsubscribe link, or can I set up a page with a form where users can enter their email address manually to unsubscribe?

# Answer
There are no tags to generate the unsubscribe link but if you know the email address that needs to be unsubscribed you can query the database to grab the "Authcode" which is needed to create the link.

This **post on the EE Forum** details how to accomplish this.
> 1 votes

---
Tags: email, module
---


# Question
Title: Moving a forum from development to production
I've been working on a forum locally and I'm wanting to move it to the live server. I've exported all the db tables and then imported into the live site and added a row to the modules table.

I can see the forum module control panel OK, but when I visit the URL for the forum on the live site, I get a 404. So it seems like I've missed something that needs bringing over. Anyone know what that might be?

# Answer
> 3 votes
I ran into this once. Needed to have the following in my config:

```
$config['forum_is_installed'] = 'y';
```

# Answer
> 1 votes
Are you running the forum through a regular template? If so, have you synced the templates on the live site? What about .htaccess? If you're using the "exclude" method you might need to add your forum template (group) there (again, if running through a regular template).

---
Tags: forum
---


# Question
Title: Proper way to output AJAX response in module?
What's the proper way to return an AJAX response within an ExpressionEngine module?

Good ole' `echo "foo"; die();` seems to work but there must be a better way!

I tried the CodeIgniter approach `$this->EE->output->set_output(json_encode($array));`

Thanks for the help!

# Answer
If you are trying to return data other than JSON I ended up using the following instead. It's mostly ripped off from the same send\_ajax\_response function that Bhashkar was kind enough to lead me to. You should probably choose the proper Content-Type (so maybe if it was XML it would be different?).

```
$this->EE->config->item('send_headers') == 'y';
@header('Content-Type: text/html; charset=UTF-8');
exit($output);

```
> 1 votes

# Answer
You can use

```
$this->EE->output->send_ajax_response($array);

```

for the same purpose.
> 5 votes

---
Tags: add-on-development, module, ajax
---


# Question
Title: How can I get rid of "call to a member function result() on non-object"
I'm seeing the following when I try to publish or edit a pages entry : `Fatal error: Call to a member function result_array() on a non-object in ...taxonomy/libraries/Ttree.php on line 1004`

```
    foreach($query->result_array() as $row)

```

I'm getting a similar error about non-objects (whaaat) when I try to use Field Editor: `Fatal error: Call to a member function result() on a non-object in ...field_editor/mcp.field_editor.php on line 70`

line 70 (and context) is as follows:

```
    foreach ($query->result() as $row)
    {
        $this->EE->table->add_row(
            anchor(BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=field_editor'.AMP.'method=edit'.AMP.'group_id='.$row->group_id, $row->group_name).sprintf(' (%d)', $row->count),
            anchor(BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=field_editor'.AMP.'method=delete_confirm'.AMP.'group_id='.$row->group_id, lang('delete')),
            anchor(BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=field_editor'.AMP.'method=export'.AMP.'group_id='.$row->group_id, lang('field_editor_export')),
            anchor(BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=field_editor'.AMP.'method=import_upload'.AMP.'group_id='.$row->group_id, lang('field_editor_import')),
            anchor(BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=field_editor'.AMP.'method=clone_group'.AMP.'group_id='.$row->group_id, lang('field_editor_clone'))
        );
    }

```

And then again when I try to change fields natively: `Fatal error: Call to a member function num_rows() on a non-object in ...system/expressionengine/views/admin/field_group_management.php on line 28`

```
        if ($field_groups->num_rows() > 0)
        {
            foreach ($field_groups->result() as $field)
            {
                $this->table->add_row(
                    '<a href="'.BASE.AMP.'C=admin_content'.AMP.'M=field_management'.AMP.'group_id='.$field->group_id.'">'.$field->group_name.'</a> ('.$field->count.')',
                    '<a href="'.BASE.AMP.'C=admin_content'.AMP.'M=field_group_edit'.AMP.'group_id='.$field->group_id.'">'.lang('rename').'</a>',
                    '<a href="'.BASE.AMP.'C=admin_content'.AMP.'M=field_group_delete_confirm'.AMP.'group_id='.$field->group_id.'">'.lang('delete').'</a>'
                );
            }
        }

```

I can't reproduce on my staging server or locally so I've got a hunch that this is something server-specific, I just have no. clue. what it could be. Googling around, it looks like this sort of error (non-object) is pretty common so that at least gives me some hope.

Anyone have ideas on how I could resolve or could at least point me in the right direction? Trying to debug on a production server isn't ideal so ideally I'd like to have a starting point.

using v2.5.5 of EE taxonomy v2.3.4

# Answer
> 1 votes
If anyone is interested, EE was crapping out because the server admin had "secured" the server by putting the ORDER\_FULL\_GROUP\_BY directive in the sql\_mode of my.cnf.

I'm not *entirely* sure what it does but it seems to block some essential GROUP\_BY queries. This didn't seem to be documented anywhere so hopefully somewhere down the road, this comes up useful for someone and saves them half a day of going down the rabbit hole.

---
Tags: ee2, taxonomy, field-editor
---


title: Using EE Search with Store

text:
# Question
Title: Using EE Search with Store
I'm using EE2's simple search like so.

```
{exp:search:simple_form result_page="search" search_in="title" status="open" channel="gg_store"}
     <input type="text" id="searchBox" name="keywords" placeholder="Search" />
     <input type="submit" id="searchSubmit" name="searchSubmit" value="GO" />
{/exp:search:simple_form}

```

and my search results, using {exp:store:product} looks like this...

```
{exp:search:search_results}
                {exp:store:product entry_id="{entry_id}"}
                    <div id="product-list">
                        <span class="itemtitle"><a href="{url_title_path='/the-collection/product-detail/'}">{title}</a></span>
                        <a href="{url_title_path='/the-collection/product-detail/'}">{gallery_image_1} <img src="{path}_252x252/{filename}.{extension}" width="100%" /> {/gallery_image_1}</a><br />
                        <?php echo StringLimiter('{e_comm_body}','160'); ?>
                        <br /><br />
                        <div style="float:right;">
                            <span class="BTN updateBTN">
                                <a href="{url_title_path='/{e_comm_type}/product-detail/'}">Learn More...</a>
                            </span>
                        </div><!-- //control-group -->
                        {if on_sale}
                            <del>{regular_price}</del>
                            <span class="price">{price}</span>
                        {if:else}
                            <span class="price">{price}</span>
                        {/if}
                    </div>
                {/exp:store:product}
        {/exp:search:search_results}

```

Here's my "issue", this works 90% of the time. I'm building a website that sells only a few items. They are stored in the gg\_store channel.

If i search a term like mma, pads, shin, it seems to be working properly. But for whatever reason, certain terms throw a weird EE error. Terms like Gloves, Gear... and this is the error.

```
Parse error: syntax error, unexpected T_STRING in /system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 321

```

I did narrow down, the reason that causes it... it's {e\_comm\_type}. If i remove that all of a sudden every search term i can think of starts working. {e\_comm\_type} is a custom field which stores info like "The Collection", "Victory Athletics", "Apparel".

Any idea's why and how to fix this? I need to use {e\_comm\_type} to properly set the url destination.

# Answer
This sounds like a parse order bug. Unfortunately, there's not much you can do except work around it (unless you want to report it to EL, but I wouldn't hold your breath waiting for a fix :).

I would try putting the search result display template code into an embed, and passing through the variables you need. This solves 90% of parse order issues I've seen.

Something like this:

```
{exp:search:search_results}
    {embed="embed/.search_result"}
{/exp:search:search_results}

```
> 0 votes

---
Tags: expresso-store, simple-search
---


title: Low Search to filter Solspace Tags

text:
# Question
Title: Low Search to filter Solspace Tags
I'm using Low Search to search a business directory where individual businesses are tagged with the Solspace Tag module. The search form has a field for keywords and a drop-down list of tags.

Here's the code I have that's working:

```
      {exp:low_search:form
        collection="vendors"
        search_mode="all"
        result_page="resources/marketplace/search_results"
        query="{freebie_4}"
        loose_ends="yes"
      }
        <fieldset>

            <label for="keywords">Search by keyword</label>
            <input type="search" name="keywords" value="{low_search_keywords}" />

            <label for="search:vendor_services">I need:</label>
            <select name="search:vendor_services">
              <option></option>
              {exp:tag:cloud
                status="open"
                tag_group_name="vendor_service_tags"
              }
              <option{if low_search_search:vendor_services == '{tag}'} selected{/if} value="{tag}">{tag} ({count})</option>
              {/exp:tag:cloud}
            </select>

            <button type="submit">GO</button>

        </fieldset>
      {/exp:low_search:form}

```

But I'm having trouble getting Low Search to search for an *exact match* in the tags custom field. For instance, if I search for the tag "farm" I get results with the "farmers market" tag as well.

Adding an '=' sign for an exact match like `value="={tag}"` only matches if that's the only tag.

Reading this post, it sounds like it might not be possible since I'm trying to do an exact match with multiple values.

Is this possible with Low Search? Or should I be using Solspace's Super Search instead since is has a tag parameter specifically for searching tags?

# Answer
> 0 votes
Low just released an add-on to address searching Solspace Tags. It's called Low Search Tag.

I used the following code to solve my problem:

```
<select name="tag_id:vendor_service_tags[]">
   <option></option>
   {exp:tag:cloud
     status="open"
     tag_group_name="vendor_service_tags"
   }
     <option value="{tag_id}"{if tag_id IN ({low_search_tag_id:vendor_service_tags})} selected="selected"{/if}>{tag} ({count})</option>
   {/exp:tag:cloud}
</select>

```

I also added the `require_all="tag_id"` parameter to the search form since I have multiple selects for searching multiple tag groups at once.

# Answer
> 0 votes
Unfortunately, there's no way to do this with Low Search at this time. I think there are only two solutions to this problem:

1. Use Solspace Super Search which includes a method for searching tags.
2. Use categories instead of Solspace Tags since they are queried via their IDs instead of their actual names.

I went for option 2.

The closest thing getting this to work is to search a field using the "\W" trigger at the end of the term.

```
<select name="search:vendor_services">
  <option value="foo\W">Foo</option>
  <option value="bar\W">Bar</option>

  …
</select>

```

This searches for a full word, not a partial word match. It works the same as the search:field-name parameter in the channel entries tag:

http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#search-field-name

> When doing a “Contains” search, ExpressionEngine is literally just looking for matches on the combination of letters given. For instance using “cat” in a “Contains” search would match entries with “cat”, “cats”, “category”, “vocation”, etc. If you need “Contains” matching, but only want entries that include the term as a whole word on its own, you can add the special trigger \W after the term.

The problem with this solution is that Solspace Tags can be multiple words. For instance, searching "farm\W" will find the **"farm"** tag and ignore a **"farmers market"** tag, but it would also match a tag like **"ant farm"** since it also contains a the whole word "farm."

The only way to have this work correctly would be to write an extension for Low Search that searches the tables Solspace Tag creates to store tag data.

---
Tags: low-search, solspace-tag
---


# Question
Title: How to personalize CP Content -> Edit view?
I want to personalize CP Content-\>Edit view with custom data from each entry.

For example i want to show the value of a fieldtype.

How to procede? I think that there isn't any hook.

The only way seems to edit:

system/expressionengine/controllers/cp/content\_edit.php

Any suggestions?

# Answer
Unfortunately there is no hook for this in EE2. Zenbu is a popular addon that offers this functionality within a completely separate module.
> 3 votes

# Answer
If you don't want to use Zenbu, you might want to buy it and use it as your foundation and expand on their code to accomplish what you are needing to accomplish.
> 0 votes

# Answer
I think that the only elegant way to personalize Content Edit is to modifying the DOM with JS. It's possibile to add JS to CP with this hook:

**cp\_js\_end**

http://ellislab.com/expressionengine/user-guide/development/extension\_hooks/cp/javascript/index.html
> 0 votes

---
Tags: control-panel, add-on-development
---


# Question
Title: Can Postmaster update custom fields after sending emails?
Is it possible to make Postmaster update an entry's custom field after it sends an email? I've got a custom field called 'Email Sent' and it'd be nice to stick a 'yes' in there for peace of mind once the email had gone out.

# Answer
That's a great idea. Currently there are no hooks or settings in place to do that.

I could also see a setting in place to store the number of times an email has been sent (for re-occurring emails). That way, you could say do not send after X times.

I will add this to the list of features to implement. If you need this immediately, I am available for an hourly rate of course. Email support\[at\]objectivehtml.com if you need such services.
> 6 votes

# Answer
StackExchange still isn't allowing me to add comments, so I'm doing this as an answer.

A possible workaround is to add a hidden field to the form that sets the value in the custom field. This isn't the same since it will be set before the email goes out, but at least it's something.
> 1 votes

---
Tags: add-on, custom-fields, postmaster
---


# Question
Title: Can we do multiple sites with a single installation of ExpressionEngine?
We are a small Romanian company that loves ExpressionEngine. We are trying to build every client's website with EE. But it is very difficult to maintain and update.

Is there any way to install it somewhere ( on a domain ) and the sites just to take the "core" from that domain? ( including modules )

Example structure:

```
Site1 <------- CORE -------> Site 2
                |
                |
                |
             Site 3

```

# Answer
You cannot use 1 ExpressionEngine installation to drive a multitude of websites for different customers. That would be a violation of the license, because you'd essentially be paying once to derive revenue from any number of clients, even if you're paying for Multiple Site Manager seats as they come on board.

Multiple Site Manager's use is to develop satellite sites for a single customer, where you're not only relying on maintaining 1 core install, you're also pulling content from the core site into those other sites. If you had a corporate website and set up sites for your branch offices, they could pull news articles from the corporate website while having their own home pages, contact us pages, etc. You can run those satellite sites on a subdomain, or their own domain. Each vhost on your server gets a copy of the index.php/controller file, and pulls the system in through the core system folder.

I don't know the exact wording of the license. I don't know if there's a requirement that the multiple sites sharing anything other than an install. But I think it's safe to say that if they're separate customers, they should have their own license, no matter how you install/configure your server.
> 4 votes

# Answer
If I understand you correctly, you're wanting to run several entirely different websites off of a single install.

This is not allowed by the license. I used to work for a company that used the Multiple Site Manager to run websites this way. This is prohibited by the license, too. It's also a nightmare to manage this way. Separate installs is indeed easier to manage.

I would suggest looking into how others manage their EE sites. Take a look at Ryan Masuga's Article on Git and EE.

I'm sure if you asked about others' workflow here on Stack Exchange, you'd get some great answers.
> 1 votes

# Answer
Did you check out Multiple Site Manager?
> 0 votes

---
Tags: multi-site-manager
---


title: Playa field in Postmaster

text:
# Question
Title: Playa field in Postmaster
We're having an issue with a Playa field in Postmaster:

Technically this should work, but it doesn't:

```
{parcel:company_membership_package}
  {title}
{/company_membership_package}

```

We're getting these messages which seem to indicate that Playa is at fault. I haven't look at it in detail, so it may actual be Postmaster sending the data wrongly.

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: entry_id
Filename: playa/ft.playa.php
Line Number: 2281

```

Same message repeated with line 2285 and 2287. I wouldn't be concerned about these notices, except that the data isn't retrieved.

Thanks, Paul

Edit: Screenshots.

# Answer
The reason Playa isn't working is because you need to use a Channel Entries loop. The template parser for Postmaster is pretty complex, and is different than a channel entries loop for many reasons. You should do something like:

```
{exp:channel:entries dynamic="no" entry_id="{parcel:entry_id}"}

    {company_membership_package}
        {title}
    {/company_membership_package}

{/exp:channel:entries}

```

The reason it doesn't work the other way is because Playa and Matrix rely on hooks triggered by the channel entries tag. And since the Postmaster parse doesn't trigger those hooks, the modules will break unless you use a channel entries tag.

I will also add, that even if things worked like this, the following syntax is incorrect:

```
{parcel:company_membership_package}
    {title}
{/company_membership_package}

```

The correct syntax would be (assumed the field wasn't Playa)

```
{parcel:company_membership_package}
    {title}
{/parcel:company_membership_package}

```
> 3 votes

---
Tags: playa, postmaster
---


# Question
Title: SSL Redirect (no idea where it's coming from)
I recently had to do some emergency-work on my client's live server, and wanted to sync those changes back into my repository and staging environment. Now that I've synced them back (copied new files to local, committed them to my repo and pushed to staging) my staging environment and local environment both try to redirect to https:// versions of their frontend. The backend is fine, but fornt-end wants to load over SSL. I don't have DM Force SSL or any other SSL-related plugins installed. Any thoughts as to why this might occur? I've already checked my .htaccess, but that only contains EE's basic URL-rewrite... I'm stumped here.

Thanks,

* Steven

# Answer
> 3 votes
One possible culprit - if you have Store installed, and have the `Require SSL connection for checkout and order tags` setting enabled, it would redirect every time you use Store tags on your site over an unencrypted connection.

That might explain why it's only happening on some pages.

# Answer
> 0 votes
What happens when you copy-paste your URL into this tool: http://redirectcheck.com/index.php ?

---
Tags: ee2, htaccess, ssl
---


title: Output matrix rows in sets of two

text:
# Question
Title: Output matrix rows in sets of two
I've got a Matrix field with say 20 rows (could be 21).

I want to output those rows within but i want 2 rows in each .

Any idea how to accomplish this with the switch tag in Matrix? I'm trying some weird and wacky stuff but nothing is working as i want.

So markup i would want is:

---

```
<div>
{row 1 content}
{row 2 content}
</div>

```

---

```
<div>
{row 3 content}
{row 4 content}
</div>

```

---

```
<div>
{row 5 content}
{row 6 content}
</div>

```

---

```
<div>
{row 7 content}
</div>

```

And here is my current template code:

```
{exp:channel:entries channel="downloads" dynamic="no" disable="pagination|member_data|categories|category_fields" orderby="random"}
    <div>
{dl-downloads}

        <h4>{dl-download-title}</h4>
        <p>{dl-download-desc}</p>
        {switch="|</div><div>"}

{/dl-downloads}
    </div>
{/exp:channel:entries}

```

# Answer
The Matrix `{switch}` variable will work for this. Try:

```
<div>
    {matrix_field}
        {row_count}<br>
        {switch="|</div><div>"}
    {/matrix_field}
</div>

```

Which will output:

```
<div>
    1
    2
</div>
<div>
    3
    4
</div>
<div>
    5
    6
</div>
<div>
    7
</div>

```

Just replace `{row_count}` in my example with whatever Matrix column short names you would want to use.
> 3 votes

# Answer
Not sure I get it. You want to output all your rows and wrap all sets of two rows with a div?

Will something like this do the trick, or am I mising something?

```
{matrix}
    {if "{switch='one|two'}" == "one"}<div class="row">{/if}
    ... something ...
    {if "{switch='one|two'}" == "two" || "{row_count}" == "{total_rows}"}</div>{/if}
{/matrix}

```
> 0 votes

---
Tags: matrix
---


# Question
Title: Retrieving Matrix Row data via Playa Relationship
Apologies for the vagueness in the title.

I have two channels: **Businesses & Events**

I am trying to allow businesses to display special offers for any event. They choose the event in a Playa field and set the offer for that event in the same Matrix row. See the image for better clarity.

On the actual event page, I'd like all child entries to be able to display the {title} of the business and the {offer} they provided in the row that the relationship was made.

I've tussled over this for the better part of the day with some (but not much) luck.

How would you approach this scenario, if this even possible?

# Answer
From what i understand - the example in the documentation is exactly what your referring to? http://pixelandtonic.com/playa/docs/celltype
> 2 votes

---
Tags: matrix, playa, relationships
---


# Question
Title: How to paginate or organize Expression Engine by custom field data input
I have an ExpressionEngine site that takes information entered from an admin, and information entered from users through SafeCracker, and displays that information in a timeline format.

The information that is entered has a custom field called {story\_year}. We use that field to sort the entries based on the entered date. This means that users can specify a date, as well as admins.

Because showing hundreds of entries at once takes a long time load, we've introduced pagination. But that pagination breaks it up arbitrarily by amount.

Is there a way to paginate by {story\_year}? Possibly conditionals like:

```
{if story_year >= "2010" }
  {page}
    <li><a href="{pagination_url}" class="{if current_page}active{/if}">•</a></li>
  {/page}
{if:elseif story_year >= "2000"}
  {page}
    <li><a href="{pagination_url}" class="{if current_page}active{/if}">•</a></li>
  {/page}
{/if}

```

Relevant URLs are here: http://thinkx.net/clients/manship/index.php/timeline \- the ultimate display of the timeline. http://thinkx.net/clients/manship/index.php/Timeline/add \- the field entries we sort by.

# Answer
> 0 votes
There isn't a way to do this with native pagination.

Take a look at the **YearList addon** to see if you can get something working with that.

> Fetches the distinct years of all entries in a specified weblog. Can be used to create a year archive list.
>
> The Year Listing plugin is a simple way to get a distinct 4 digit year for your entries. This way you can list out years for archives.
>
> {exp:yearlist channel="yourchannel" category="1"}
> {year} {/exp:yearlist}
>
> That will return an array of years. Use {year} to print them to the screen and wrap in any markup needed. There are currently no linebreaks or HTML associated with this plugin.

You can pull the year from the URL and use it with your entries tag to pull entries for just that year.

You'll need to make sure your entry date year matches your custom field year or you can try hacking this addon to pull from your custom field instead of the entry date field.

---
Tags: safecracker, custom-fields, pagination
---


title: freemember logout error

text:
# Question
Title: freemember logout error
Running EE v2.5.5 and FreeMember 2.1.1

I am using the following code to log out a user:

```
<a href="{exp:freemember:logout_url return="dashboard/register"}">logout</a>

```

clicking the link takes me to EE's system message page with the following message:

```
You are not authorized to perform the following action

```

am I implementing this wrong or is there a bug perhaps?

Here are links to my templates

logging out from here: http://pastie.org/6317009

any page I use for the return param creates the same error

Thanks!

# Answer
> 1 votes
This error has been fixed in FreeMember 2.2.1, released today:

https://github.com/expressodev/freemember

# Answer
> 1 votes
You are implementing the tag correctly **according to the docs**.

This error is usually related to a member having incorrect access or issues with forms being processed in Secure Mode.

Things to try:

1. Change the return parameter to another URL, try return="/". If another URL works, something in that template is the problem so you'll need to reduce to find out what.
2. Disable the "**Process Form Data in Secure Mode**" setting on the Security and Sessions page in the CP which is located here: Admin ‣ Security and Privacy ‣ Security and Sessions.

---

**EDIT**
With the new if of your template code, here are two things to try:

1. Change `{if logged_out}{redirect="/"}{/if}` to `{if logged_out}Logged out{/if}`. Does it show or same error?
2. Remove all code from the template except `{if logged_out}{redirect="/"}{/if}`
3. Change `{if logged_out}{redirect="/"}{/if}` to `{if logged_out}{redirect="/"}{if:else}ALL OTHER TEMPLATE CODE HERE{/if}` OR `{if logged_out}{redirect="/"}{/if} {if logged_in}ALL OTHER TEMPLATE CODE HERE{/if}`
4. Test a new template that just handles redirect with `{if logged_out}{redirect="/"}{/if} {if logged_in}{redirect="dashboard"}{/if}`
5. Test `{if logged_out}{redirect="{path=}"}{/if}` OR `{if logged_out}{redirect="http://www.domain.com"}{/if}`
6. Check the URL where you are seeing the message... is it the dashboard URL or the home page URL? It will tell you where the issue is.

---
Tags: freemember
---


# Question
Title: Intelligent ways to force redirects before a session ends?
I was hoping to pick people's brains on a topic. I am developing a web app which sits on top of Expression Engine and this has worked really well so far.

I have one issue though and I have a quick solution but I was hoping to find a more elegant approach, perhaps using hooks or something of that nature.

Basically, our application is very heavily ajax-driven and as such our users can do quite a lot without ever really leaving the page. However, they need to be logged in to do this properly. So you can imagine a scenario whereby a user walks away from their computer for an extended period, comes back, sees the application still running and then attempts to work with it but finds that they either experience erratic behaviour or else nothing works.

Obviously I can set up a template somewhere which would return whether or not the user is logged in or if there is an active session, however this would then involve me either continuously checking that template via an ajax call or else checking the template before I process any other calls. So I'm just wondering if there is a way to kick the user out or redirect them to the login page when a session ends or something similar?

I want to avoid any unnecessary calls to templates, etc. so ideally there will be a more elegant approach out there, or even an existing module or extension. I have plenty of experience in developing third\_party add-ons for EE so that's not an issue. Just looking for ideas really :)

Thanks in advance, Conor

# Answer
> 2 votes
Like MJR suggest, set a javascript timer to about the same length as the logout / session-expiration timer. Then redirect after timeout.

The elegant part: Around 20 or 30 secs before expiration, popup a dialog that the session is about to expire.

(maybe redirect to a page where the user is going to be logged out, to prevent redirecting without the session actually being expired).

---
Tags: security, sessions, logout, session-end-hook
---


# Question
Title: Disaster trying to upgrade EE1 to EE2 - need help!
I need some serious help guys!

I am running a large and popular website on ee 1.70. I want to upgrade to version 2 so this is what I did:

1. copied all files and folders, and made a backup sql file of the database
2. created a new database
3. created a new folder on the server called /test/
4. imported the sql file into the new database
5. copied all folders and files into /test/ folder and changed permissions where necessary.
6. Changed the config file to show the new database location

When I tried to log on to the control panel from here, I got a table error, and the advice found online was to start the ee2 upgrade. *I'm sure this is where things went wonky.*

I followed the upgrade instructions by renaming index.php and system and theme folders to \_old. I uploaded the ee2 files. I restored some 1.x files. I ran the upgrade and it stopped part way through and gave me an ugly, non-css version of my site. I tried the upgrade again and had the same result.

Then when I went to my normal, live site, I got nothing but "Site Error: Unable to Load Site Preferences; Invalid Preference Data"! **My site is gone!** The real one! How did that happen?

I restored my original files and folders onto the server and am still getting the site error message. How do I get my site back? And how to I continue to upgrade in the /test/ folder if it won't complete?

I'm panicking :(

# Answer
Here's an update on the situation...

I copied the installation to a new location. When I tried to view the control panel, I received a table error. All the advice online said to power on with the upgrade, so I followed the upgrade instructions and ran the upgrade script.

**Where I went wrong is that I stupidly forgot to change the config file when restoring the 1.x files (I had changed the config file during the move, and forgot to do it again during the upgrade).** It botched my live database because the config file was pointing it to the old database, not the new one. I'm currently waiting for the database to be restored by the host because my backup file is returning errors.

Silly error with big consequences. Fingers crossed it has a happy ending.
> 1 votes

---
Tags: ee2, ee1, ee2-upgrades
---


title: EE e-Commerce + MSM capabilities

text:
# Question
Title: EE e-Commerce + MSM capabilities
I've got a client that needs to be able to manage product inventory / availability separately across a few MSM sites (each site is a national branch of the organization, and some products simply aren't available in some countries). They also need currency localization for each store (USD, GBP, EUR, AUD, NZD, etc), as well as store-specific billing info (eg. different PayPal accounts for each national branch).

I know it's asking a lot, but can any of the EE e-commerce solutions (CartThrob, BrilliantRetail, and Exp:resso Store - or anything else I'm unfamiliar with) handle this kind of MSM setup, even partially?

# Answer
I can not speak for BrilliantRetail as I have never used it on a MSM site but you should not have problems creating separate stores completely with different currency, payment accounts, and products with either Store or CartThrob. I would assume the same would be true for BR but I can not speak from experience.
> 1 votes

---
Tags: expresso-store, cartthrob, multi-site-manager, localization, brilliantretail
---


title: Redirect 301 if url title present

text:
# Question
Title: Redirect 301 if url title present
Let's say we have a url: http://example.com/section/my-url-title we want to enure that the {url\_title} is not used in the URI. We have changed all template tags to point to the {entry\_id} instead.

The issue now is we have 600+ url's listed with google. We therefore want a 301 re-direct that checks for a {url\_title} and then sends a 301 header with the new URI schema using the {entry\_id}

As an example of what we want to achieve, let imagine the URL is http://example.com/section/my-url-title this then re-directs to http://example.com/section/369

We set up as basic template which works as you might expect:

```
{exp:channel:entries}
   {if '{segment_2}' == '{url_title}'}
      I should re-direct {url_title} | {entry_id} -- <? echo({entry_id}); ?>
   {if:else}
      I should NOT re-direct {url_title} | {entry_id} -- <? echo({entry_id}); ?>
   {/if}
{/exp:channel:entries}

```

And as you might expect a request to http://example.com/section/my-url-title outputs this into the template:

I should re-direct my-url-title | 369 -- 369

If we then test the url using the entry ID URI http://example.com/section/369 we get:

I should NOT re-direct my-url-title | 369 -- 369

...so far so good...

We then added the following php within the true part of the if statement:

```
<?
    Header( "HTTP/1.1 301 Moved Permanently" );
    Header( "Location: /{segment_1}/{entry_id}" );
    die();
?>

```

And the template re-directs BUT we get caught in a re-direct loop. This is the same for either URLS:

http://example.com/section/my-url-title http://example.com/section/369

Both get in a re-direct loop.

We have also tried this plugin: http://blog.builtbyprime.com/php/301-redirect-for-expression-engine-2 which also seems to get stuck in a loop and disregard the if statement.

Any help or advice greatly appreciated.

p.s I'd rather avoid the task of remapping every url using googles webmaster tools.

# Answer
> 2 votes
You can't use {if}...{if:else}...{/if} (always executed, output thrown away after conditional check) but have to use switchee or something similiar.

```
{exp:switchee variable="{segment_2}" parse="inward"}
    {case value="{url_title}"}
        I should re-direct {url_title} | {entry_id} -- <? echo({entry_id}); ?>
    {/case}
    {case default="Yes"}
        I should NOT re-direct {url_title} | {entry_id} -- <? echo({entry_id}); ?>
    {/case}
{/exp:switchee}

```

switchee docs:

> With EEs if/else conditionals, each condition is parsed before being removed at the end of the parsing process. This means if you wrap if/else tags around lots of other tags then your template will be running many unnecessary queries and functions.
>
> As Switchee is a tag we can use parse=“inward” to ensure that unmatched conditions are not parsed before being removed from the template.

# Answer
> 0 votes
A simple embed did the trick, we simply check {if '{segment\_2}' == '{url\_title}'} and it its true I have an embed that then uses this plugin to redirect: http://blog.builtbyprime.com/php/301-redirect-for-expression-engine-2

Job done :)

---
Tags: ee2, plugin, redirects
---


# Question
Title: Exp-resso Store : Trade and web customers
First post here, have read the faq etc and actually found a similar question, but rules say I should not tag a question onto an answer.

( Trade prices in exp:resso Store )

Scenario : Website currently only sells to trade. Website displays all info apart from price to visitors. Trade clients have a manually assigned login and prices are then displayed. Ordering is carried out off site.

Client would like to offer online ordering to existing Trade customers, and potentially general web customers.

Would it be possible to set up a Trade Store field and a Customer Store field within the channel and then use conditionals to display within the templates? There will obviously be some duplication of entry in the channel entry, but this appears to me to be the easiest work around.

# Answer
As mentioned in the linked post. You can only assign one Store field per entry so you would either need to do

> If your products are fairly simple and wont have modifiers effecting the price you can create the different price levels as modifiers per product then use a conditional in your template to preselect the proper modifier in a hidden field. The only downside to this is that the product modifier names would need to be the same so the in template conditionals worked without any problems.
>
> The second option would be to create 2 channels for your products. Lets call the first channel "product\_details" which would house all of your details about the product but would not contain a Store fieldtype. In the second channel lets call it "product\_prices" you would want to create 3 fields a Store fieldtype, Playa, and a dropdown or select field that would allow you select which member group the entry would apply to. Then in your template you would list the items on the site using the product\_details channel and would then need to have the playa field search for the related entries where you dropdown or select had a value of the currently logged in member.

If you wanted to have different prices per member group. IF you are just wanting to only show the prices to people that are logged in as trade members you can do something along the line of:

```
{if member_group == X}{price}{/if}

```

Where "X" is the member group id of the trade group. If you do not want to sell to normal visitors you could do something along the lines of

```
{if logged_in}{price}{if:else}Log into see the price{/if}

```
> 1 votes

---
Tags: expresso-store, expresso
---


title: MySQL channel table problem

text:
# Question
Title: MySQL channel table problem
Whilst upgrading a site from EE1 to EE2.5.5 I have been doing a lot of editing the database in Sequel Pro. All of which seems to be working fine so far...

But I'm having a problem with a straightforward channel entries tag to display past entries from a specific channel (id=2) all other channels work, and if I add show\_future\_entries="yes" to the parameters it works for channel 2 (and shows the future entries).

In my investigations I discovered that in the exp\_channels table the row for channel\_id 2 has a 0 for total\_entries and last\_entry\_date but there are 39 rows in exp\_channel\_data and exp\_channel\_titles with a channel\_id of 2 (and they all match up and have the same number of rows in total).

If I add a new entry in channel 2 the exp\_channels table row doesn't update, but does for other channels.

I tried editing the field directly in Sequel Pro to add the correct total\_entries and last\_entry\_date. But when I post a new entry in channel 2 it reverts those 2 fields to 0.

**Update:** I just tried adding another new entry and it is updating the entry count now and channel entries tag queries show the new entries with a date before now, but still don't show the older ones.

It seems to be the the older entries in the channel that I inserted directly (along with titles in the exp\_titles table) didn't update the exp\_channels table and that's the problem. Why it should matter I can't work out, as there aren't any fields in there that are related to entries.

So does anyone know what other table is updated when you add a new entry that is breaking the relationship?

I realise that I must have screwed something up during my time editing the database directly but is there a way to re-synch the exp\_channel table and why is this issue preventing the display of past entries?

# Answer
Paul, you could try a debug tool like: http://devot-ee.com/add-ons/ee-debug-toolbar It could point you in the right direction.

Did you try any direct calls (not using ee) to the db? If so, is the data returned cleanly?
> 1 votes

# Answer
After re-checking the database tables again I noticed that the older entries had an expiration date set. Not sure show, as they haven't been used before, so must have happened during the direct database editing. So changed them all to 0 and they are now showing up. So that is what was blocking them.

I didn't see the expiration date in the control panel entry page as I'd already hidden it to stop people using it.

But the exp\_channels table is still showing only 4 entries (the new ones I've created during testing) and not the 42 that are in the the exp\_channel\_data table with and channel\_id of 2. Is this likely to be any issue in the future?
> 0 votes

---
Tags: database, mysql, upgrade
---


# Question
Title: Building an add-on that accepts data from a custom front-end URL
My goal is to have a REST endpoint that I can push AJAX requests to, have those requests be parsed, potentially push some data into the DB via a channel, and then return a JSON status message. I don't want to have to put PHP into a template to accomplish this, and am happy to write an add-on of some sort.

**Please don't suggest add-ons. I want to know how I would go about writing my own add-on to accomplish this.**

# My question:

From a high level, how would I start writing this add-on? Specifically, how would I route a custom URL to my add-on code? What type of add-on should I be building for this (i.e. Module, Extension, something else)?

This is something I've done a number of times with other web frameworks (including CodeIgniter), but for some reason I'm finding it very difficult to get information on how this would be done in EE.

**EDIT:** I've tried to make this question more clear. I'm specifically looking for advice about add-on creation. Based on my re-reading of all the EllisLab add-on docs and a lot of time searching the web, I'm starting to feel like this isn't something EE can do without an incredible amount of hacking. I'm really hoping that's not the case.

# Answer
It's certainly possible without hacking. Just that the EE documentation isn't particularly helpful on how to handle this sort of thing.

Basically, you want to write a Module. Then you need to register an "action" in your module's install script:

```
$data = array(
    'class'     => 'Module_name' ,
    'method'    => 'method_to_call'
);

$this->EE->db->insert('actions', $data);

```

Bingo. This will give you an endpoint which you can use to create your API (this is how all EE modules work when handling form submissions from the front end). You action will get an ID like `123`, and will be accessible at `http://www.example.com/index.php?ACT=123`. This will then call the method you specified in the install script (this method must be defined in your class in `mod.addonname.php`).

Now you can check input data, access the database, return JSON... whatever you like. For an example of this in action, check out FreeMember.

Note: This doesn't involve any routing, but it builds a perfectly valid web service endpoint. If you want custom routing, the only way to go is to create an extension using the `sessions_end` hook, and add your own router code which checks for specific URLs and handles the response. It's WAY easier to just work with EE's built in ACT handling.
> 5 votes

# Answer
I've thought more about this. Based on the pre-condition you're building a custom addon to handle this, the only way I can see it working would be to either :

1. Create a dummy top level template group (ie. called 'api' with a sole tag to your custom addon : {exp:restful\_api:handle}. From within there you could do any and all the parsing/restful interactions that you'd need. That's a fair amount of work and you'd need to be careful EE's not fighting you with parse orders or other built in core mechanisms.
2. An *option* would be to try and see if the **core\_template\_route** hook fires early enough to be of use to you. If that fires early enough, use that to hook against the calls, do some basic filtering, and if the route appears to be one you want to have you're custom handling (ie. matches foo.bar/api/...) kick into your custom handling. You'd need to kill out any actual following EE handling, but if you're going custom regardless that *might* work.

(If the **core\_template\_route** hook fires too late, you might need to find an earlier hook. But in principle it's possible, if a bit unusual. )
> 2 votes

# Answer
Switchee is a plugin that will let use switch/case logic in your EE templates and allow you to use your template more like a controller, responding with different chunks of code based on the variable/s you test against. I will commonly use it and test against EE's segment variables so I can combine a channel listing and single entry into the one template, creating a more succinct URL structure than the standard EE template-group/template/variable URL. You could also use it to setup a simple API.

There are also a few routing add-ons for EE -- Freeway and Router -- that may be what you are after. I haven't used either but there is a comparison on StackExchange.
> 1 votes

# Answer
One method (al-be-it a bold one), would be to side-step the EE routing and templating entirely.

Create a new folder at root level within the site, ie. called 'api'. Within that drop a custom CodeIgniter (or anything really) application that would act as your API controller.

Chris Imrie built exactly this for an EECI talk. Have a look at - EE Data API.

From the best of my memory, that's a read-only setup, but it wouldn't take a huge leap to extend it to have write functionality too.

The advantage of having it as a standalone setup, is that you'll keep full control over every part of the api that'd you'd need to implement. Which, depending on the complexity of what you're building might be a good thing. It can be fully restful, have extra authentication, etc.. anything you'd need, and it wouldn't interfere with your existing site.
> 1 votes

# Answer
I've used a combination of Switchee and Freebie for this kind of thing in the past. Switchee sets up cases for a segment variable and Freebie makes EE ignore certain words so it doesn't reroute the template or alter how a tag is displaying entries. For instance, using the same template to show a success message after submitting a contact form.

For example, this contact form would redirect to the same URL with the word /thanks added upon successful form submission:

```
{exp:switchee variable = "{freebie_2}" parse="inward"}
  {case value="thanks"}
    Thanks for submitting the contact form!
  {/case}
  {case default="yes"}
    *(contact form code goes here)*
  {/case}
{/exp:switchee}

```

Note: You have to use `{freebie_2}` instead of `{segment_2}` to include words in Freebie's segment list that EE would otherwise ignore.
> 0 votes

---
Tags: add-on-development, url, ajax
---


# Question
Title: Is this a hosting/database issue not an EE issue?
I just want to confirm that the interminttant issues on this site not rendering (blank page) and this error are related to web hosting and not EE/Low Variables 2.3.4:

```
Error Number: 1

Can't create/write to file '/tmp/#sql_a34_0.MYI' (Errcode: 28)

SELECT `ee`.`variable_name`, `ee`.`variable_data` FROM (`exp_global_variables` AS ee) JOIN `exp_low_variables` AS low ON `ee`.`variable_id` = `low`.`variable_id` WHERE `ee`.`site_id` = '1' AND `low`.`early_parsing` = 'y' ORDER BY `low`.`group_id`, `low`.`variable_order`

Filename: third_party/low_variables/ext.low_variables.php

Line Number: 323

```

Thanks

# Answer
```
Can't create/write to file '/tmp/#sql_a34_0.MYI' (Errcode: 28)

```

"**Errcode: 28**" means MYSQL can't write to the tmp directory because it is full. You'll need to contact the host to have them fix the issue.
> 2 votes

---
Tags: low-variables
---


title: EE 1, adding another server

text:
# Question
Title: EE 1, adding another server
So I have searched but I seem to only find information on setting up EE in the config.php for multiple server environments - local, staging, production. What Im looking to get some information on is adding a new server to my already existing setup.

I have added another server, copied over my EE install and put that up on the site. The new servers ip loads up the site minus any dynamic data.

**Question**: Can I use one EE install and MySql database to run the site on two servers?

**Example**:

Server 1 = MySql, EE, site

Server 2 = remote into server 1, connect to MySql, use server 1 EE, show site

Hopefully this makes sense, but I dont see a reason to install EE twice. I also dont see a reason to have another DB setup which would require replication of data.

# Answer
You don't provide too much information but yes you can assuming that you have configured your database server to allow remote connections from your other server. I'm assuming these servers are both located with the same host or you may hit some serious latency issues.

The ideal setup though in this situation rather than maintaining duplicate copies of ExpressionEngine on two servers (which you could maintain via rsync) would be to mount an NFS volume on Server 2 (so create an export on Server 1).

If you want to show your site on both servers you are also going to need a load balancer sitting in front of them both.
> 1 votes

---
Tags: ee1, config, mysql, server
---


# Question
Title: Assets Folder Pair, parent_folder not responding
Perhaps I'm simply not understanding the tag's function, but I have an upload directory ({filedir\_4}) with about 10 subfolders I made within the Assets interface. I'd like to list the titles and ids of these subfolders, and I'm attempting to do so like this:

{exp:assets:folders parent\_folder="{filedir\_4}"} {folder\_name}, {folder\_id}
{/exp:assets:folders}

This returns nothing. However, if I do this:

{exp:assets:folders recursive="yes"} {folder\_name}, {folder\_id}
{/exp:assets:folders}

It does manage to list every folder and subfolder, which is somewhat encouraging, but I'm only looking for the contents of {filedir\_4}. What am I missing here? Thanks!

Assets 2.0.5 / EE 2.5.5 / PHP 5.3.2

# Answer
I just tried it like so:

```
{exp:assets:folders parent_folder="{filedir_1}"}
{folder_name}, {folder_id}<br />
{/exp:assets:folders}

```

In a totally blank template, and got back a list of folders and IDs for Filedir 1. Do you have anything else in your template when testing? And you're absolutely certain about the ID for that File Upload Preference?
> 1 votes

---
Tags: assets, pixelandtonic
---


# Question
Title: How to set exp:channel:entries tag to no limit?
Based on this link in the documentation, the default limit is 100 if it is not defined.

How do you set it so that it will not have any limits?

# Answer
> 9 votes
No limit is not possible, but you can simply set limit to some ultra-high value, e.g.

```
limit="999999"

```

# Answer
> -2 votes
But I think using pagination is a simplest solution, I also tried with a high number of limit with channel entries tag but didn't work. One can also go with the Ajax pagination for this.

---
Tags: channel-entries
---


# Question
Title: How to use the same template section for content from different channels at different times?
I am new to EE and trying to figure out how to use it for our CMS needs. We have the following 2 channels, names self-explanatory: 1. News Articles 2. Press Releases These will have their own pages where all channel entries of each type are listed.

But also: On the homepage we display a "top story" which is always either a selected news article OR press release.

How do I give content managers the ability to tell EE what to display as top story on a given day, by selecting either a specific news article, or a specific press release?

# Answer
> 2 votes
You can do this a couple ways. One quick method is to either use the record status and add 'topStory' as a status, along with 'open', 'close' and other statuses. Then to use code like

```
{exp:channel:entries channel="news|press" limit="1" orderby="date" sort="desc" status="topStory"}

<div class="topStory">
    <h2>{title}</h2>
    <p>{news_summary}{press_summary}</p>
    <p class="readmore"><a href="" title="Read {title}">Read More</a></p>
</div>

{/exp:channel:entries}

```

You can stack fields like I did for `{news_summary}` versus `{press_summary}` when both will be evaluated but only one will be true. For example in this case. The `{exp:channel:entries}` tag is evaluating both channels `news` and `press` for the newest entry with the status of `topStory`. Generally speaking, only one entry will meet that criteria of `newest` so the second field will return empty.

This will also work, with multiple returns, so it could be

```
{exp:channel:entries channel="news|press" limit="5" orderby="date" sort="desc" status="topStory"}

```

but it will return the appropriate field data for that record.

Obviously, if your summary fields allow XHTML, don't use the `<p>` and `</p>` tags. I tend to make summary fields format as 'None'.

But this is a quick method. There are plenty of other methods, but adding the status group used by both both news and press releases, works. Though it will remove the 'top story' from other listings, unless you display both status 'open' and 'topStory'.

---
Tags: entries
---


title: parse order and nested conditionals

text:
# Question
Title: parse order and nested conditionals
Can i nest simple conditionals and are nested simple conditionals still parsed early?

What happens when nesting an advanced conditional inside a simple conditional?

(wiki answer)

# Answer
> 2 votes
the following template will generate an error because neither the "foo" or "bar" module or plugin exist.

**Nested simple conditionals**
The "foo" error will not show up, because the two nested conditionals are both simple conditionals.

**Advanced conditional**
The second block has a nested advanced conditional (it tests for two conditionals, last\_segment AND segment\_3) and thus the whole block is seen as being advanced conditionals, including the outer. The whole block will be parsed, generating an error for the non-existant "bar" extension.

Hands-on: Try removing the AND ... part from the advanced conditional to test the difference (no more error). And try adding foo/bar to the browser url (example.com/group/template/foo/bar), and see the "foo" error appear.

```
Conditional test
{if last_segment != "foo"}
  {if segment_3 == "foo"}
    {exp:foo}{/exp:foo}
  {/if}
{/if}

{if last_segment != "foo"}
  {if segment_3 == "foo" AND segment_3 =="bar"}
    {exp:bar}{/exp:bar}
  {/if}
{/if}

```

*Tip: Tags in advanced conditionals are always being parsed, they are just discarded before displaying the page. if you're not sure what is parsed, try enabling template-debugging to see which tags do get parsed. Alternatively you could add a tag for a non-existing plugin "foo" and see if the page generates an error, that way you know that the part is being parsed :-)*

---
Tags: conditionals, advanced-conditionals, parse
---


# Question
Title: Creating Links To Uploaded Files (non-Image) Within Entries
I know this may be a silly question, but since I'm new to EE, my client has a requirement of creating links within their entries to files uploaded to the file library. Since we are using the URL rewrite feature for the website, I wanted to know if there a way to link to any uploaded file, e.g.

```
<a href="link_to_file_in_filemanager.pdf">Click here</a> to download file. Blah, blah, blah....

```

# Answer
You can also - for a textarea field - set "Show file chooser" to YES. Then, when writing in that field, select some words, click on File Chooser (just below the field), select an already uploaded file (or upload a new), like a pdf.

The selected text will be linked to the file.
> 3 votes

# Answer
The way you'd usually do this is create a custom field in your channel, something like the native File field, or Assets, for example.

When you go to create/edit your entry, you'd upload the file through that field.

In your template, you'd reference the file using the custom field name.
`<a href="{file_custom_field_name}">Click here</a> to download file.`
> 1 votes

---
Tags: channel-entries, file-uploads, file-manager
---


# Question
Title: Newb: Need help with integrating P&T Matrix into JQuery
I have Matrix installed into EE and am getting single pictures out. I need to add a JQuery light box to manage my pictures. I have added ColorBox and it is working with hard coded hrefs. The Matrix docs says I need to use:

Matrix.bind('fieldtype\_class', 'event\_name', function(cell){ // custom code here });

I presume "custom code" means the ColorBox finction call ?

Also I am not too sure what is meant by 'fieldtype\_class' and 'event\_name'.

MANY THANKS for your advice - sorry it's such a newb Q.

# Answer
> 1 votes
You are using Pixel & Tonic's Matrix Development Docs. You don't need to. Unless, I'm misunderstanding, it sounds like, the url to the image file is stored in a Matrix field and you want to output that information to ColorBox to create a lightbox gallery.

If that's true, then let's assume your set-up is something like:

**Matrix Field Set-Up**

```
{image} | {image_url}  | {image_caption}

```

**Planned Output**

With ColorBox you'd want the output to the specified class, to look something like this…

```
<p><a class="myClass" href="{image_url}" title="{image_caption}">Text or {image}</a></p>

```

If all your information is stored in the Matrix field, then you'd want

```
{my_matrix_fieldname}<p><a class="myClass" href="{image_url}" title="{image_caption}">Text or {image}</a></p>{/my_matrix_fieldname}

```

That is, if you are trying to use information from a Matrix field. If you are actually trying to create a new field\_type that will work with Matrix and ColorBox, then this answer went horribly wrong.

# Answer
> 1 votes
As nonprofit\_tech said, this is much simpler than you are assuming. If you have the hard coded version working, you are almost there. Say you are serving up your thumbnails in a list, like this:

```
<ul>
  <li><a href=""><img src="" alt="" title=""></a></li>
  <li><a href=""><img src="" alt="" title=""></a></li>
  <li><a href=""><img src="" alt="" title=""></a></li>
</ul>

```

You then set up a Matrix field (called, say, 'gallery-pix') and then create the necessary fields within that. You end up with markup something like this:

```
<ul>{gallery-pix}
  <li><a href="{gallery-pix-large}" title="{gallery-pix-title}"><img src="{gallery-pix-thumb}" alt="{gallery-pix-title}"></a></li>{/gallery-pix}
</ul>

```

---
Tags: matrix, jquery
---


title: SafeCracker Matrix re-ordering

text:
# Question
Title: SafeCracker Matrix re-ordering
Im getting an error using safecracker and matrix when i try to re-order the rows, drag and drop doesn't work and using the drop down options returns this console error.

```
Uncaught TypeError: Object [object Object] has no method 'callback' matrix.js:147

```

EE 2.5.5
Safecracker 2.1
Matrix 2.5.3

# Answer
Oliver, this is a known problem and will be fixed in the next Matrix version. Meanwhile, could you shoot us an email at support@pixelandtonic.com referencing this thread and I'll make sure you get a patch immediately.

Cheers, Andris
> 1 votes

---
Tags: safecracker, matrix
---


title: Problem calling action in browser

text:
# Question
Title: Problem calling action in browser
I have made an extension that creates an action. The action has been created and is in the database with an ID of 34. But when I go to the following URL:

```
http://mywebsite.com/index.php?ACT=34

```

I get an error page saying:

```
Error
The action you have requested is invalid.

```

The method name stored in the database is post\_job and I have this method defined in my extension class. Anyone know why this is happening?

# Answer
> 3 votes
> I have this method defined in my extension class

There it is! Action methods are only valid if they belong to a module (either `mod.classname.php` or `mcp.classname.php`). They will not work if they live in an extension or plugin.

---
Tags: extension
---


title: Merging two ExpressionEngines databases

text:
# Question
Title: Merging two ExpressionEngines databases
Just had a client enter a large amount of content (400+ articles) onto our development built by accident, trying to work out a cunning way of merging the live database with the development database without losing any information. Is there any easy ways to do this?

A different editor has also been adding content into the live site so i'm guessing it could get pretty complicated?

# Answer
> 3 votes
Well, that all depends on what kind of data was entered. Every fieldtype adds complexity - relationships, Playa, Matrix, Assets, Tag, categories - these all add new rows to additional database tables after the standard `channel_titles` and `channel_data`.

The main thing to worry about is duplicate `entry_id`s. My tactic here is to go through each relevant entry and add a sufficiently-large number to the `entry_id` in every applicable table. So, say your production site has less than 100 new entries since the development database was last synced:

```
UPDATE exp_channel_titles SET entry_id = entry_id + 100 WHERE entry_id IN(<!-- comma-delimited list of the new entry_ids you need to migrate -->)
UPDATE exp_channel_data SET entry_id = entry_id + 100 WHERE entry_id IN(<!-- same list of entry_ids -->)

```

If you have relationships, other complex fieldtypes which use their own table that references the `entry_id` of the entry their data is associated with, you'll need to do work on those as well.

After you've sufficiently incremented all these values, you can merge the DBs.

---
Tags: database
---


title: Putting JavaScript in EE channel fields

text:
# Question
Title: Putting JavaScript in EE channel fields
I've done some Google searches, and don't know if this is possible...but I really hope that it is.

I'm building a channel for landing pages (marketing campaigns.) Each campaign will be a channel entry, and will customize the template(s) I'm building. Each campaign page and thank-you page will have to be able to include JavaScript tracking code that is custom to the campaign - in addition to the GA tracking code that's going to be pulled into the template. This tracking code is often JavaScript.

I was going to create a textarea field for pasting in the tracking code, set to no formatting. But will EE allow this, or will it hopelessly mung up the JavaScript code? (I have Wygwam fields on this EE installation, but I've read in another thread that Wygwam/CKEditor can routinely strip out JavaScript tags - and in this case I don't want the JavaScript to be messed with, stripped out, edited, or even breathed on wrong.)

# Answer
> 0 votes
A field set as a TextArea with formatting set to 'none' should do the trick and leave the js unaffected. WYGWAM or any other WYSIWYG editor will likely be a real pain.

---
Tags: ee2, javascript
---


# Question
Title: Enforcing unique titles in a channel and streamlining relationships
I am considering migrating a nonprofit site to EE. The existing site runs some news articles with an image and copyright attributions to the copyright holder.

* I created a channel called "Copyright Holders" with no fields other than the title.
* I created a channel called "News Articles" with a Channel Images field and added a Relationship field to the Copyright Holders channel.

The EE workflow for this seems really clunky. The content creator would first have to review the list of all copyright holders to make sure the one they are adding is not on the list. Then they would have to publish an entry in the Copyright Holders channel if there isn't already the right one. Then, finally, they can publish their entry in "News articles". At the end of it, if they mess up the first step we'll end up with duplicate entries in the dropdown.

If I were writing this as a PHP application it would be trivial to give the user an autocomplete field to enter the copyright holder. After the submit, if they entered an existing (enforced-unique) field from the MySQL table then reference it; if not then create it and reference it. This would be a simple and logical workflow for the content creator and would keep the data clean.

Is there some way to achieve the above in EE?

Or are my choices 1. live with the pain, or 2. write a custom CMS?

# Answer
I'd suggest moving your "Copyright Holders" to a category group. There is no reason not to use categories here from what you describe. The editor can add new categories from within the edit form as they are adding new News Articles. Should do the trick.
> 2 votes

---
Tags: channel-entries, relationships
---


title: Strange Cart Behaviour

text:
# Question
Title: Strange Cart Behaviour
This is only my second project with Exp:resso, but have been a long time EE user. I have a really strange problem, which I am hoping someone will be able to help me with.

I have a simple site, based on a template that is highly modular. Using EE, I have placed the code for the cart into it's own template (called cart\_code) and embedded it into every page on my EE site. That way, if I need to modify the code, it's in one place.

This is fine and seems to work, and the cart code is as follows:-

```
    <div id="cart">

    {exp:store:cart}

                {if no_items}

                        <a href="" class="cart-link">
                            Shopping Cart<br /> is Empty
                    <div class="cl"> </div>
                        </a>
        {/if}

                {items}
                <a href="checkout" class="cart-link">Your Shopping Cart</a>
                    <div class="cl"> </div>
                    <span>Items: <strong>{item_qty}</strong></span>

                    <span>Cost: <strong>{order_subtotal}</strong></span>
                {/items}

    {/exp:store:cart}

</div>

```

This works just fine from the home page, and if I navigate to a product page and use the "add to cart" button, the cart updates as expected.

Here is the strange part. If I then move to an alternative product page, and click the "add to cart" button, I get my DIV (cart) rendered twice! The first is the entry for the 1st product added, the second rendering is for the second product.

I just cannot see what I am doing wrong here. Maybe I should change the name of the DIV ID to something less likely than "cart"?

Any help is much appreciated. Again, all pages share the same code!!!!

Thanks, Mark.

# Answer
It's because you've got your checkout link within your `{items}` loop, so it will logically output once for each item in that loop (i.e., for each item in your cart).

Try this:

```
{if order_qty > 0}
    <a href="checkout" class="cart-link">Your Shopping Cart</a>
    <div class="cl"> </div>
    <span>Items: <strong>{order_qty}</strong></span>

    <span>Cost: <strong>{order_subtotal}</strong></span>
{/if}

```
> 1 votes

---
Tags: javascript
---


# Question
Title: how to convert $_GET and include from php to EE tags
How can i convert the following code to EE Tags?

```
<?php
if($_GET['rel']!='tab'){
    include 'header.php';
}
?>

```

I've used this with enabling the template to PHP, but i get the following error.

```
A PHP Error was encountered

Severity: Notice

Message: Undefined index: del

Filename: libraries/Functions.php(683) : eval()'d code

Line Number: 5

```

Thanks

# Answer
> 2 votes
There are a handful of addons that convert `$_GET` and `$_POST` variables to EE variables. This search might get you started. My favorite is Mo’ Variables, which converts them to *global variables* (of the early-parsed sort) like `{get:rel}`.

As for including, I'm not sure what your `header.php` file contains, but if it's more template code you could use an embedded template. Make a template group (say, **embeds**) and a template (**header**):

```
{if get:rel != 'tab'}
  {embed='embeds/header'}
{/if}

```

If you **do** directly include the PHP file, make sure `header.php` doesn't use `echo` as that will result in PHP errors.

# Answer
> 1 votes
If your going to pull in GET values you should scrub it: $this-\>EE-\>input-\>get('rel', TRUE); ref http://ellislab.com/expressionengine/user-guide/development/usage/input.html

if ($this-\>EE-\>input-\>get('rel', TRUE) != 'tab'){ echo "{embed=\\"site/header\\"}"; }

With php parsed on input. If this is in a template the EE super global is already loaded. ( $this-\>EE =& get\_instance();)

# Answer
> 0 votes
Two things:

1. Your error message says `Undefined index: del` and your code example references `$_GET['rel']` -- There's no typo at play here, is there?
2. Try this?

Set PHP to run on Input.

```
<?php
if($_GET['rel']!='tab'){
?>
<embed="template_group/header_template"> // With PHP enabled if you need
<?
}
?>

```

# Answer
> 0 votes
As far as I know the $\_GET and $\_POST variables (among others) are not available in templates. To accomplish something like this you could use url segments. So in you're example you may have a link like this: domain.com?rel=tab. Instead you may be able to do this: domain.com/tab. Then in your template (no PHP required) you can do this:

```
{if segment_1 == "tab"}
    {embed="site/header"}
{/if}

```

Where site/header is a template containing whatever code is in header.php. Note that the /tab could be any segment and change the conditional accordingly. I realize using segments instead of GET parameters may not always work, but this is how I have gotten around this problem myself a few times.

---
Tags: php, get
---


title: .htaccess redirect loop error

text:
# Question
Title: .htaccess redirect loop error
htaccess :

```
<IfModule mod_rewrite.c>
    RewriteEngine On

    # Removes index.php from ExpressionEngine URLs
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]

    # Remove www.
    RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
    RewriteRule ^(.*)$ http://%1/$1 [L,R=301]

    RedirectMatch 301 /page_1 http://domain.com/segment_1/page_1
    RedirectMatch 301 /page_2 http://domain.com/segment_1/page_2
    RedirectMatch 301 /segment_1/page_x http://domain.com/segment_1/segment_2/page_x
</IfModule>

```

The last redirect works but the first two don't. (Error infinite loop).

Anyone has an idea why?

# Answer
Okay, I found the error (If anyone's intrested):

I must not write `RedirectMatch 301` instead I simply have to write `Redirect`. So simple.
> 2 votes

# Answer
I normally serve my redirects before my removal of index.php

Here's an example I know to work http://d.pr/n/1rQO
> 0 votes

---
Tags: htaccess, redirects
---


# Question
Title: List where our members come from (country)
I've been trying to make a list of where our EE members comes from (country) and later on I will plot this data in to a Google Map to make it more interesting.

For the moment I've only come up with this solution, but it might not be the best solution to go through all the countries in the world.

```
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'Australia'"}Australia: {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'Denmark'"}Denmark: {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'Malaysia'"}Malaysia : {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'New Zealand'"}New Zealand: {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'Norway'"}Norway: {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'Philippines'"}Philippines : {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'Singapore'"}Singapore: {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'United Kingdom'"}United Kingdom: {paginate}{total_pages}{/paginate}{/exp:query}</p>
<p>{exp:query limit="1" sql="SELECT m_field_id_3 FROM exp_member_data WHERE m_field_id_3 = 'United States'"}United States: {paginate}{total_pages}{/paginate}{/exp:query}</p>

```

I can't find any plug available that solve this. I'm not asking anyone to write the code for me, but I would appreciate if anyone could give me some tips/guidance.

Thanks in advance.

# Answer
This query should do it:

```
<p>{exp:query sql="SELECT count(*) as member_count, m_field_id_3 as country FROM exp_member_data WHERE m_field_id_3 != '' GROUP BY m_field_id_3 ORDER BY m_field_id_3 ASC"}
    {country} ({member_count})<br />
{/exp:query}</p>

```
> 1 votes

---
Tags: ee2, query
---


title: Seeking three specific config variables

text:
# Question
Title: Seeking three specific config variables
I've been trying to figure out how to set three specific CP settings via my config file and can't find a reference for the necessary variables. Maybe somebody can point me in the right direction. I'm trying to find config variables for the following:

* **Apply rank denial to user-submitted links** (CP \> Admin \> General configuration)
* **Deny Access if No IP Address is Present** (CP \> Admin \> Security & Privacy \> Throttling Prefs)
* **Require Member Account Activation** (CP \> Members \> Preferences)

With the last one I already know that the variable is `$config['req_mbr_activation']` but I don't know what the various acceptable values are.

Can anyone advise? Thanks.

# Answer
Got an answer from EllisLab.

Apply rank denial to user-submitted links:

```
$config['redirect_submitted_links'] = 'y';

```

Deny Access if No IP Address is Present:

```
$config['banish_masked_ips'] = 'y';

```

Possible values for `$config['req_mbr_activation']`: none, email, manual
> 1 votes

# Answer
Rick, I poked around and found what I think are the allowable settings for those first two in /system/expressionengine/models/admin\_model.php. It looks like 'y/n' are the only allowable values for redirect\_submitted\_links or banish\_masked\_ips.

I found the values for req\_mbr\_activation in /system/expressionengine/controllers/cp/members.php at line 1674 (this is EE 2.5.3 I'm looking at) and they are:

```
'req_mbr_activation'
    => array('s',
        array('none' => 'no_activation',
              'email' => 'email_activation',
              'manual' => 'manual_activation'
             )
           ),

```
> 5 votes

# Answer
Have you seen Devot-ee's list of config parameters? and the archived wiki page? I don't see one for rank denial there. But for the IP one there are a few, including:

```
 [require_ip_for_login] => y

```
> 1 votes

---
Tags: config, config-overrides
---


title: Field to select an existing page

text:
# Question
Title: Field to select an existing page
Does anyone know of a custom field that will allow the user to select an existing page from the site?

Throughout the site are going to be little snippets of information that will link through to another page on the site, so all I need to do is store the snippet and the link. I could just get the user to paste in the link, but I'm looking for something nicer.

I know Wygwam and the like have plugins for their linking, but I'm after something standalone.

Any help would be much appreciated, thanks!

Darren

# Answer
This is where Structure is really helpful. Once you define your pages based on Structure, you can use the StructureFrame fieldtype to select pages and get a link to their valid page URL.
> 2 votes

# Answer
Since you are trying to build links to entries and would like to allow the end user to simply "choose" the page, I'd recommend using the native Relationship field. If your "pages" entries are housed in multiple channels then use Playa instead (with single select mode). You can easily build links to Channel entries using either of these fieldtypes.

Or, if you *are* using Structure, then as Mark said StructureFrame works great for this.
> 1 votes

# Answer
I think this might be what you're looking for:

**Template & Snippet Select**
http://devot-ee.com/add-ons/template-snippet-select
> 0 votes

---
Tags: custom-fields, plugin
---


title: Starting with Low Search

text:
# Question
Title: Starting with Low Search
I'm new to Low Search, and i'm trying to get Low Search to work. But when i use the expample codes and after a while of experimenting with some parameters i don't get it to work.

What i noticed is that after i build a index a collection, and when i go directly back to manage collection, i says "Rebuild Index" again.

What do i miss here? Because all i get is - no results.

My test code is pretty simple

**Search form:**

```
    {exp:low_search:form
    collection="nieuws"
    form_class="navbar-search pull-right"
    search_mode="any"}
        <input type="text" class="search-query input-small" name="keywords" id="keywords" placeholder="Zoeken">
    {/exp:low_search:form}

```

**Search results page:**

```
    {exp:low_search:results
    collection="nieuws"
    search:field="title"
    loose_ends="yes"
    query="{segment_3}"
    search_mode="any"
    limit="10"}
            {if count ==  1}<ol>{/if}
             <li><a href="{comment_url_title_auto_path}">{title}</a></li>
        {if count == total_results}</ol>{/if}
        {if no_results}Geen resultaten gevonden{/if}
    {/exp:low_search:results}

```

# Answer
Firstly, check if your collection 'nieuws' has weighted fields. At least one of the fields in the collection should have weight of \> 0. A weight of 0 means the field is not added to the index.

Secondly, you can simplify your tags somewhat. You've already got the `collection` and `search_mode` parameters set in the Form tag, so no need to repeat them in the Results tag. Also, the `search:field="title"` seems off to me. That parameter is a native search: parameter and probably does nothing, unless you have a field called `field` which has the value `title`. Don't think that's what you're after, so ditch that. Your opening Results tag could simply be this:

```
{exp:low_search:results query="{segment_3}" limit="10"}

```

Optionally add the `loose_ends` parameter to either the Form or the Results tag:

Adding it to the Form tag:

* Logs the parameter
* Slightly longer URI

Adding it to the Results tag:

* Doesn't log the parameter
* Slightly shorter URI

**Edit after taking a look:**

Also make sure that the `query="{segment_3}"` parameter actually points to the encoded query in the URI. Yours was pointing at an empty segment, as your results page URI looks like `zoeken/ABC` (where ABC is the encoded query), so you needed to change the query parameter to `query="{segment_2}"`.
> 3 votes

# Answer
I think the parameter `search:field="title"` is your problem here. The syntax means the the form is searching a custom field you've setup with the name "field" for the text "title."

What you probably want is to search the entry's title for the keyword entered into the {exp:low\_search:form}, correct?

Try removing the parameter `search:field="title"` altogether. You probably don't need to specify searching the title. As long as you don't set the title search weight to '0' in your collection, it will search the title for matching keywords.

If you only want to search entry titles, I think you would use 'search:title' in your form code:

```
{exp:low_search:form
collection="nieuws"
form_class="navbar-search pull-right"
search_mode="any"}
    <input type="text" class="search-query input-small" name="search:title" id="search:title" placeholder="Zoeken">
{/exp:low_search:form}

```
> 0 votes

---
Tags: low-search, no-results
---


title: Styles not being applied correctly

text:
# Question
Title: Styles not being applied correctly
I have a jQuery collapsing menu feature that I want my client to easily be able to create. The only thing that needs to be done is adding two styles to their text. One is the header of the menu, the other is the collapsing content.

I'm using WYGWAM and here are my custom styles:

```
CKEDITOR.stylesSet.add( 'my_styles',
[
    // Block Styles
    { name: 'Heading 1', element: 'h1'},
    { name: 'Heading 4', element: 'h4'},
    { name: 'Default Copy', element: 'p'},
    { name: 'Accordion Header', element: 'div', attributes: {'class': 'accordion-header'}},
    { name: 'Accordion Content', element: 'div', attributes: {'class': 'accordion-content'}}
    ]);

```

The problem is any time I try and apply the accordion styles they wrap everything within them. In the instance of trying to add bullets as content... It'll turn into:

```
<div class="accordion-header">Header Text</div>
<p class="accordion-content">
<li class="accordion-content">List item</li>
<li class="accordion-content">List item</li>
<li class="accordion-content">List item</li>
<li class="accordion-content">List item</li>
</p>

```

It just automatically adds p tags then applies my custom class to every element within. Ckeditor is being a pain. Any advice?

# Answer
Personally, I would avoid having the accordion markup itself done in the Wygwam field. I've done this sort of thing before, and there's a lot of things a client can do incorrectly that way. The way I would suggest you consider doing it is with Matrix, adding a row for each element of the accordion. That way, markup is exclusively in the template and you can protect the client from making a mistake. You could still potentially use Wygwam as the field in Matrix in which they place the accordion item content. That's my suggestion anyway, for what it's worth.
> 3 votes

# Answer
I would look into adding custom templates to Wygwam via CKEditor templates.

You could then add a template that would enable the client to introduce the following markup in a Wygwam field:

```
<div class="accordion-header">Header Text</div>
<ul class="accordion-content">
<li>Listem Item 1</li>
<li>List item 2</li>
<li>Etc...</li>
</ul>

```

The client could then introduce any additional items they need to the list by hitting "return" after the last item.

Hope that wasn't too confusing. Please let me know if you have questions!
> 1 votes

---
Tags: ee2, wygwam
---


title: How can I use exp:query in entries?

text:
# Question
Title: How can I use exp:query in entries?
I'm looking for a way to use exp:query in entries. So far I haven't been able to find this. I know it's not recommended but for what I'm trying to build it's most feasible to do so. That way I'll be able to get data from other datatables.

# Answer
You'll need to use the Allow EE Code plugin, and wrap your field with it on the front-end:

```
{exp:allow_eecode query="y"}
    {my_field}
{/exp:allow_eecode}

```
> 3 votes

# Answer
Are you planing to put exp:query code in your channel entries ?

If so, there has to be a better way to achieve the result you're going for than having to put sql queries in your channel entries ( and within range of your clients )

Perhaps you could give us some more info about what you're trying to do ?
> 1 votes

---
Tags: channel-entries, custom-fields, query
---


title: MX Title Control + Structure

text:
# Question
Title: MX Title Control + Structure
I'm using MX Title Control to concatenate two entry fields into the entry title. This is working correctly for the URL Title value as well. However, my Structure Listing URL looks like `auto_replace-97`.

Has anyone gotten MX Title Control working with Structure URLs?

# Answer
It looks like Title Master is claiming full Structure support and Title Control is not, so I'll be moving in that direction.
> 1 votes

---
Tags: structure, url-title, title, mx-title-control
---


# Question
Title: Use WYGWAM "site page" links in a multilanguage environment
I have a multilanguage site with wygwam and the client is making extensive use of the "site page" links. for the multilanguage part i use "multi language support" by biber ltd.

Now i have a bodytext-field setup for every language and the switch is working just fine but the links generated inside wygwam do not consider the currently selected language.

In order for this to work i would have to somehow squeeze in the {language\_code} into the by wygwam generated urls. is there any way?

\[EDIT\]

My initial idea to setup a specific baseHref for each language doesn't work. Maybe there is a way to do a find and replace over the whole bodytext? I'll get back to you.

\[EDIT 2\]

I endet up using "replace plus" to find the page-links and insert the language\_code to the url. Quite simple and works fast.

# Answer
> but the links generated inside wygwam do not consider the currently selected language.

I can offer a few solutions:

1 - I had a situation where links to certain entries did not have the custom URL path I wanted, so I needed to set up a redirect on them if generated links hit the base URL. I did that with this:

```
{exp:channel:entries channel="your_channel" require_entry="yes"}
{redirect="{global_lang_var}/{segment_1}/{segment_2}/{segment_3}/{segment_4}/{segment_5}/{segment_6}"}
{/exp:channel:entries}

```

You could wrap that in a conditional that checks to see if `segment_1` contains one of your language codes. If not, do the lookup, if there's a matching entry, do the redirect. Put this in an embed or segment, and include it at the top of all your pages.

2 - I'm using the "old school" multilanguage approach, with a subdirectory for each language and a global var set in the subdirectory. I also set a cookie when a user selects a language.

If a cookie has been set that says the user has chosen Spanish/es, and the URL requested does not contain es, whether it contains another language or no language, you can redirect them using PHP to the right page. This is my cookie check/set code. It's not the solution I'm describing, but should get you started.

```
<?php
    $this->EE =& get_instance();

    $lang = $this->EE->input->cookie('ase_lang');
    $page = $this->EE->uri->uri_string;

    if ($lang != $this->EE->config->_global_vars['ase_lang'] && $lang !='')
    {
        header("Location: /$lang/$page"); exit;
    }
    elseif ($lang != $this->EE->config->_global_vars['ase_lang'])
    {
        $this->EE->functions->set_cookie('ase_lang', $lang, 31536000);
    }

?>

```

The idea is: Put a snippet at the top of every page that checks the globally selected language against the URL (containing a different language or absent a language) and redirect accordingly.

We usually have our HTML head set as an embed or snippet on every page of the site, so you should be able to set this up once and have it handle any links.
> 1 votes

# Answer
How about modifying the output of WYGWAM processing... so the idea is that all url's are saved with a post processing tag in it... domain.com/{lang}/url Then on the output you can process the lang variable for each field as you see fit. But as above, not sure i like this solution. The different editor solution may be your best option.

But if you are using the "pages" link to define the url, then i assume you are not changing this to match the language code? therefore the url will not be seo friendly in all languages? i.e. www.domain.com/en/fishing-page www.domain.com/fr/fishing-page and not www.domain.com/fr/page-peche

So just raising this as more of a point that you might want to investigate.
> 0 votes

---
Tags: wygwam, pixelandtonic, multilingual, links
---