# Question
Title: EE 2.6.1 Stash, Matrix and Relationships
Beneath each article (single entry page) I would like to show related articles.

I have four slots. For each slot I need

* the article´s title =\> title field
* the permalink =\> url\_title field
* the first image =\> Matrix field, contains only one row.

Editors choose the related articles manually via a relationships-field. If they choose less than 4 articles, the remaining slots will be filled automatically with articles from the same category.

I use Stash to gather the list.

My problem: How do I get the image? Title and permalink are no problem, but in order to get to the image, I need to go one level "deeper" and loop through the Matrix field since my image is just a subfield of the Matrix field.

This is my code the relationship field is named thematisch\_passend (german for related)

```
    {!--  ============================================
    STORE A LIST OF RELATED ARTICLES INTO A LIST
     ================================================== --}
    {!-- first the manually chosen ones --}

{exp:stash:set_list name="rels" parse_tags="yes" trim="yes" parse_depth="2"}
   {exp:channel:entries channel="artikel"}
      {thematisch_passend status="not closed"}
        {stash:the-title}{thematisch_passend:title}{/stash:the-title}
        {stash:the-url-title-path}{thematisch_passend:url_title_path='artikel/index'}{/stash:the-url-title-path}

            {exp:stash:set_list:nested name="related_entries context={entry_id}" parse_tags="yes"}
            {intro_bild} <!-- name of the matrix-field -->
              {stash:the-image}{ib_file}{/stash:the-image} <!-- stashes the correct image URL -->
            {/intro_bild}
          {/exp:stash:set_list:nested}
       {/thematisch_passend}
    {/exp:channel:entries}
{/exp:stash:set_list}

```

Next I append the automatically chosen ones to the same list. I cut the code here, because the rest works.

Here´s what Debug shows

```
Stash: SET related_entries context=19 to value the-image|=|http://www.mysite.de/myimage.jpg

```

This means, that the-image has the correct value. But when Stash builds the final list, this value somehow got lost.

Stash build this list (the first ist manually and the second one automatically selected):

```
SET rels to value
the-title|=|Testartikel 1|&|the-url-title-path|=|http://www.mysite.de/artikel/testartikel1|

+|the-title|=|Testartikel2|&|the-url-title-path|=|http://www.mysite.de/artikel/testartikel2|&|the-image|=|http://www.mysite.de/testartikel2_image.png

```

The 2nd block has an image, the first not. How can I tell stash to include `the-image` in this list. Stash has already stored the correct URL.

# Answer
Here´s how I solved the problem:

* I made the image a Matrix field named `intro_bild`
* `thematisch_passend` is the name of the EE-relationsship field. This field is used by the editors to pick related articles.
* `ib_file` stands for intro\_bild file. This the file upload field.

This code works for me

`{!-- ============================================
 STORE A LIST OF RELATED ARTICLES INTO A LIST
================================================= --}
{!-- first the manually chosen ones --}`

```
 {exp:channel:entries channel="artikel"}
      {exp:stash:set_list name="rels" parse_tags="yes" parse_depth="2"}
        {thematisch_passend status="not closed"}
          {stash:the-title}{thematisch_passend:title}{/stash:the-title}
          {stash:the-url-title-path}{thematisch_passend:url_title_path='artikel/index'}{/stash:the-url-title-path}
          {stash:the-image}{thematisch_passend:intro_bild var_prefix="mx" limit="1"}{mx:ib_file}{/thematisch_passend:intro_bild}{/stash:the-image}

        {/thematisch_passend}
      {/exp:stash:set_list}    {/exp:channel:entries}

{!-- next append the automatically chosen ones to the same list. No need for more than 4 --} {exp:channel:entries channel="artikel" related_categories_mode="yes" custom_fields="yes" limit="4" status="open|featured"}
    {exp:stash:append_list name="rels" parse_tags="yes" trim="yes"}
        {stash:the-title}{title}{/stash:the-title}
        {stash:the-url-title-path}{url_title_path='artikel/index'}{/stash:the-url-title-path} {stash:the-image}
                    {intro_bild}
                        {ib_file}
                    {/intro_bild} {/stash:the-image}
    {/exp:stash:append_list} {/exp:channel:entries}

{!--  ============================================ OUTPUT THE DATA
================================================== --}

{exp:stash:parse process="end"} <ul class="small-block-grid-2 large-block-grid-4"> {exp:stash:get_list name="rels" unique="yes" limit="4"}
        <li><a href="{the-url-title-path}" title="Den gesamten Artikel "{the-title}" lesen">{exp:imgsizer:size src="{the-image}" width="200"}<img src="{sized}" width="{width}" alt="Den gesamten Artikel "{the-title}" lesen" />{/exp:imgsizer:size}</a>
        <h6 class="subheader"><a href="{the-url-title-path}">{the-title}</a></h6></li> {/exp:stash:get_list}
    </ul> {/exp:stash:parse}

```
> 0 votes

# Answer
Does this work? The nested set\_list has been removed because youve said matrix only contains one row.

```
{exp:stash:set_list name="rels" parse_tags="yes" trim="yes" parse_depth="2"}
   {exp:channel:entries channel="artikel"}
      {thematisch_passend status="not closed"}
        {stash:the-title}{thematisch_passend:title}{/stash:the-title}
        {stash:the-url-title-path}{thematisch_passend:url_title_path='artikel/index'}{/stash:the-url-title-path}

            {intro_bild} <!-- name of the matrix-field -->
              {stash:the-image}{ib_file}{/stash:the-image} <!-- stashes the correct image URL -->
            {/intro_bild}

       {/thematisch_passend}
    {/exp:channel:entries}
{/exp:stash:set_list}

```

If not, then...

You are missing closing quote in name param and context field.

```
 {exp:stash:set_list:nested name="related_entries context={entry_id}" parse_tags="yes"}

```

And this set\_list keeps getting replaced by each loop through the channel entries tag, so add a unique id to name field like this

```
 {exp:stash:set_list:nested name="related_entries_{entry_id}" context="{entry_id}" parse_tags="yes"}

```
> 0 votes

---
Tags: matrix, stash, relationships
---


title: Database settings cached?

text:
# Question
Title: Database settings cached?
Working on my first EE site (but have worked with several other CMSs) and I'm having issues with the database connection. I've pulled down files from a live site to set up a development version following the steps on the Moving ExpressionEngine to Another Server page. I've tried using the dbtest.php and can connect to the local database with no issues but when I use the same settings in the database.php file, I get a connection error. Did a little digging and the settings seem to be cached. If I do a var\_dump on $this in the DB\_driver.php file under if ( ! $this-\>conn\_id) the live settings are appearing in a ar\_cache\_set array. I did clear the caches before downloading the live database. With a die(mysql\_error()) right below that line it gives me a "not allowed to connect to this MySQL server" error. Any ideas on how to clear this? I'm not really sure where it's coming from. cache\_on is set to FALSE in the database settings.

# Answer
> 0 votes
Ah, I figured this out - nothing to do with caching. The main config directory on the live site was set up as a symbolic link with the actual config directory in the web root. That completely threw me off because it looked like there were 2 config directories in my FTP program. I was changing the one in the root and had actually downloaded and uploaded the directories in both spots instead of recreating the symbolic link.

# Answer
> 1 votes
Sorry to hear you are having an issue. I cant think of an answer other than step 7 verify permissions.

However, once you solve it, Id recommend using master config to set up your environments. It does makes things much easier!

---
Tags: database, cache
---


title: Playa Parents entry_id using child ids

text:
# Question
Title: Playa Parents entry_id using child ids
I must be looking at code for too long. I'm sure there's a simple solution to this.

I have a regular page entry, where I select an organization through a playa single select.
An organization entry can have people assigned to it.
I want to show the organization's people on my page entry.

This is my template:

```
{exp:channel:entries channel="pages"}

  Displaying people in organization ID: {related_organization:child_ids}.

  {exp:playa:parents channel="people" entry_id="{related_organization:child_ids}"}
    {title}<br />
    {if no_parents}No results{/if}
  {/exp:playa:parents}

{/exp:channel:entries}

```

The playa field outside the tag shows me the correct `child_ids`.
The `exp:playa:parents` tag renders no results.
If I hard code the entry ID in the `entry_id` parameter, it works just fine.

If I do `entry_id="4321|1234|{related_organization:child_ids}"`, I can see in my DB queries log that it is not even rendering `{related_organization:child_ids}` at all.
It shows `... WHERE rel.child_entry_id IN (4321,1234) ...`

Adding `parse="inward"` doesn't have any effect.

Why isn't the tag working inside the parameter?

**Update**
Using an embed seems to work. But no one likes embeds anymore.
Using an equivalent stash embed doesn't work.

# Answer
It's a parse order issue, related to the way Playa handles its fieldtype tags.

The Playa fieldtype actually takes its `{related_organization:child_ids}` tag and converts it into a module call: `{exp:playa:child_ids field="related_organization"}`, which the EE parser will then execute. So you are effectively doing this in your template:

```
{exp:playa:parents channel="people" entry_id="{exp:playa:child_ids field='related_organization'}"}

```

You can see why that wouldn't work.

I'd recommend using stash, rather than an embed:

```
{exp:channel:entries channel="pages"}

  {exp:stash:set name="child_ids" parse_tags="yes"}
    {related_organization:child_ids}
  {/exp:stash:set}

{/exp:channel:entries}

{exp:stash:parse name="child_ids" process="end" parse_tags="yes"}
  {exp:playa:parents channel="people" entry_id="{stash:child_ids}"}
    {title}<br />
  {/exp:playa:parents}
{/exp:stash:parse}

```
> 2 votes

# Answer
Ok, figured it out.

The `{related_organization:child_ids}` is just shorthand for the `{exp:playa:child_ids}` tag pair.

Putting a tag pair inside a parameter was making it freak out.

So instead of using `{related_organization:child_ids}` as the `entry_id` parameter, I did this:

```
{exp:channel:entries channel="pages"}

  {related_organization var_prefix="org"}
    {exp:playa:parents channel="people" entry_id="{org:entry_id}"}
      {title}<br />
    {/exp:playa:parents}
  {/related_organization}

{/exp:channel:entries}

```

Rob explains the same thing in his answer and recommends how to do it with Stash.
> 0 votes

---
Tags: playa
---


# Question
Title: How do I set dynamic values based on previous entries?
I am working on a volunteer signup form where some of the fields have a limited number of slots available (for example Monday setup needs 15 people). I am good with the form in general but I need a way to determine how many slots are already filled so that the slot doesn't get overbooked. In the past I was able to do this using Freeform 3, but when the changed the structure in 4.x that option vanished. As such I bring my case to the community for guidance on the best way to accomplish this.

Thanks.

# Answer
> 0 votes
With some help from an associate we worked out the following solution using the query module.

```
{exp:query sql="SELECT COUNT( * ) AS itemCount FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}
                                {if 15 > {itemCount}}
              <td><label for="setup_1">Mon. Dec. 9, Setup/iron - 9am-noon: {exp:query sql="SELECT 15 - COUNT( * ) AS itemNeeded FROM exp_freeform_form_entries_4 WHERE form_field_52 = 'yes'"}{itemNeeded}{/exp:query} needed </label>
              <input type="checkbox" name="setup_1" id="setup_1" value="Yes" /></td>
                                {if:else}
                                    <td>Monday 9-noon is full</td>
                                {/if}
                            {/exp:query}

```

# Answer
> 1 votes
Couldn't you use freeform's form info tag pair to perform a conditional check? You could use that tag pair to lookup how many entries already exist in your collection, and then everything flows from there.

```
{exp:freeform:form_info form_name="your_form_name"}
    {if freeform:total_results < "15"}
       Thank you but this session is full
    {if:else}
        Insert your registration form here.
    {/if}
{/exp:freeform:form_info}

```

You could use a math plugin to do a little number manipulation too, if you needed to indicate in the page how many spots were left.

---
Tags: matrix, dynamic, low-replace
---


# Question
Title: How do I limit data returned by Solspace Freeform User Notification Template?
I am running Solspace Freeform 4.x for a fairly lengthy volunteer signup form. I would like to provide a record back to the user for those items they sign up up for. However by using the **{all\_form\_fields\_string}** in the notification template I get all fields returned in the email notification whether it has a value associated with it or not. Is there a way to return only those fields that have a value? If so how?

Thanks.

# Answer
> 1 votes
In the Freeform control panel you can create a custom **notification** and then use conditionals in the notification template.

```
{if your_form_field}
   Your form field is: {your_form_field}
{/if}

```

Just be sure to edit that form's settings in the Freeform control panel and choose that notification template.

---
Tags: solspace-freeform
---


title: Anchor Tags in EE 1.7

text:
# Question
Title: Anchor Tags in EE 1.7
I am trying to connect a page by anchor and having no luck.

Here is my code :

```
<a href="{site_url}our_courses#953/">Name of Link</a>

```

and it's not working with this:

```
<a name="{category_id}"></a>

```

Any suggestions?

# Answer
> 1 votes
Your HTML has a trailing slash in it--EE wouldn't be the trailing slash in, in this context.

So, change this:

```
<a href="{site_url}our_courses#953/">Name of Link</a>

```

To this:

```
<a href="{site_url}our_courses#953">Name of Link</a>

```

And, you should end up with http://example.com/our\_courses#953 as the output URL.

---
Tags: html
---


# Question
Title: Can't add items to a cart with EE 2.7 - Expresso Store
So, I wasn't sure if this was just a version problem or something (using EE 2.7 and Store 1.6.4 - the latest).

When I try to add items to my cart, they aren't successfully added and the network inspector shows that the POST is being 302 redirected to a GET. I tried a variety of htaccess setups, including not having one at all putting the index.php back into the URL. Nothing seems to work.

Here's the POST data:

```
ACT 41
RET products/my-product-page
XID 32e30b64c0bdc8d9c5912d91c3764ad4b3c194b4
_params JklZbhzeb7aea+I4IB82StmfY1Bt/4jVC9XT2EbcV+2jeMX3Q7EKeZa1LWwiLh8f59h6n8Xsuaz6Rw0guwFpEcECKeZgLN+OS3uk8QTCaXfx0p5UR+jTgFl0uB/QVDedMkUuXXpki2aPaFrUgy3UT4unGSK+juDkn+zDQUrKRWqVjoHVguKqoxKI2LuFQJPELKTP0tPbhBFdXSYMUYw1213qV8VMWQPV4XKLmuTMyt4YprL/Kh8jy3AkiNaOem8JaClZfaunEZlM+ehf+9FG8SyzwmsRm4SefiwhY8V2wHI=
entry_id    40
item_qty    1
modifiers_3 10
return_url  store/checkout
site_id 1
submit  Add to Cart

```

The URL for both the POST and GET are exactly the same. No differing slashes or anything. Using PHP 5.3.22 and Apache.

# Answer
> 1 votes
It appears EE 2.7 removed a check\_xid() function from the Security controller.

I tried this only locally, but it appears to allow the items to be added to cart.

In the store/mod.store.php file, modify lines 243 and 591 by renaming the check\_xid function to secure\_forms\_check as noted here:

OLD:

```
$this->EE->security->check_xid($this->EE->input->post('XID')

```

NEW:

```
$this->EE->security->secure_forms_check($this->EE->input->post('XID')

```

Again, this was only tested locally so use at your own risk. I would still file a bug report with the Expresso Dev guys.

# Answer
> 1 votes
Unfortunately it looks like some changes were made in EE 2.7 to how secure forms are handled, which aren't documented anywhere.

The solution by Nuno is correct, you can simply replace `check_xid()` with `secure_forms_check()` and it will mostly work as expected. The downside of this is that AJAX scripts which expect to be able to reuse the same XID for multiple requests will no longer work in EE 2.7.

There will be an official release to fix this issue very shortly.

UPDATE: This has been fixed in Store 1.6.5

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


# Question
Title: Default .htaccess rewrite block for EE in a subfolder?
**Is there a default .htaccess rewrite block for EE while running it in a subfolder?**

I have EE in /eefolder/ i.e., mydomain.com/eefolder/ with simply

`RewriteEngine on`

in the .htaccess file in that folder.

I have WordPress in root, i.e. mydomain.com with its own .htaccess file and rewrite block.

When I try to view any URL in EE, such as mydomain.com/eefolder/site , I get a 404 from either WordPress or the default 404 from the hosting service.

What do I need in .htaccess in the eefolder? Is there a default rewrite block? I have the index.php file in the eefolder.

Or is there another configuration to change to be able to view the EE site and not get a 404?

# Answer
> 3 votes
Take the standard method and add in your subfolder name before `index.php` in the RewriteRule.

```
<IfModule mod_rewrite.c>
    RewriteEngine On

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

</IfModule>

```

---
Tags: htaccess, config, 404
---


title: Matrix Error after installation

text:
# Question
Title: Matrix Error after installation
I've just purchased and installed Matrix, and I'm receiving this error when I attempt to create a new Channel Field in any Channel.

Any ideas why this might be happening?

When I uninstall Matrix, it goes back to working normal with no issues.

EE 2.7, Matrix 2.5.6

```
Unable to load requested field type file: ft.dww_flickr.php.

```

# Answer
There must be a conflict between Matrix and your version of Flickr for ExpressionEngine fieldtype. First, uninstall both add-ons. Re-install Matrix. Does it work?

If so, then make sure you have the latest version of Flickr for EE and install it.

If you have the same problem again, you'll have to contact the add-on makers to see if one of them can fix the bug for you.

UPDATE:

Found this: https://github.com/brettdewoody/Flickr-for-ExpressionEngine/pull/2

DWW Flickr is now EEhive Flickr, so definitely read the link above.
> 0 votes

---
Tags: matrix, error
---


title: Editing a matrix field on the front end

text:
# Question
Title: Editing a matrix field on the front end
I'm sorry if this has already been asked, the new EE answers thing is so overly confusing to me, I'm almost considering private exchanges via email but thought I'd just ask here first.

All I want to do is to edit a Matrix field from the front end. This is my code, but all it's doing is adding a new row. Any thoughts?

```
{therapist_employcompany sort="desc" limit="1"}
   <input type="hidden" name="therapist_employcompany[row_order][]" value="row_id_{row_id}">
   <input type="text" name="therapist_employcompany[row_id_{row_id}][col_id_48]" value="{therapist_employcompany} "/>
{/therapist_employcompany}

```

I thought by bringing in the row ID dynamically it would update it, but it's not.

# Answer
> 1 votes
Welcome. If you use the search box, you will find 261 questions relating to matrix. To embed code, paste the code in, highlight it then select the curly brackets. The secret with matrix is the input field names. In the control panel, edit an entry then find the matrix field in the source code. Now do the same thing on a new entry. Note the differences in field name.

# Answer
> 0 votes
What you are after is not straightforward, to be sure. However, here's a good tutorial: http://themetaq.com/articles/bring-matrix-data-editing-to-the-front-end

---
Tags: matrix
---


# Question
Title: 1 template, multiple pages, different content
I'm trying to figure out what the best way of handling multiple pages (e.g. listing pages that list articles, events, etc) that use the same template but have different content (e.g. title, description, image, which entries it pulls).

Example:

* **News Listing Page** \[listing template\] - displays *news article* list
* **Events Listing Page** \[listing template\] - displays *events* list
* **Industry Events Listing Page** \[listing template\] - displays *industry events* list

With each listing page having a unique title, description, etc as well.

Should I be structuring the single template file with if statements that determine which content should be loading in? (e.g. conditionals for all three in one template). What if the "unique" content needs to be editable, should all pages that use the same template be in a unique channel? All template-x pages in channel x, all template-y pages in channel y, with channel fields for each directly related to what appears on their respective templates?

I've been looking into Structure but not sure if it'll do what I'm after, or rather simplify the "big picture" in terms of site structure.

I come from a WordPress background so still trying to wrap my head around the EE way of doing things, so any help/advice/suggestions are appreciated. If my question is unclear as well let me know and I can try to re-phrase my question/what I'm after.

# Answer
As others have pointed out, there are multiple ways to handle this in EE. And, the **Partials** approach mentioned by @dadonbike is generally the best, modern, architectural approach. But this may require you to make a bigger mind-shift coming from Wordpress. And it also can't be done without add-ons / it's not an approach that's native to EE (which actually is a comment on EE, rather than this approach--but it's worth mentioning).

A simpler approach is to use conditionals to display different chunks of the template, depending on the context as determined by the URL segments. And, a variation on this is to keep each context's template separate, but embed (include) each template conditionally into a master index file. Here's an example (that's a blog/index template):

```
{if segment_2 == ""}
    {!-- MAIN PAGE --}
    {embed="blog/.mainblog"}
{if:elseif segment_2 == "category" AND segment_3 != ""}
    {!-- CATEGORY PAGE --}
    {embed="blog/.category"}
{if:elseif segment_3 !=""}
    {!-- ARCHIVE PAGE --}
    {embed="blog/.archive"}
{if:else}
    {!-- PERMALINK PAGE --}
    {embed="blog/.permalink"}
{/if}

```

Because these are URL-driven approaches, in your case, if News and Events really warrant their own URLs structures, then that's a natural reason to not combine them into a single set of conditions.

Generally, if your conditionals start getting unwieldily, you'll wish you'd split things into separate templates. But, the flip-side of more separation is often duplication, where you have very similar or the same code copied in multiple templates.

So, the Partials approach does a great job of cleaning-up / removing conditionals and letting you reuse the same layout code across contexts.

But, to the degree you can live with your set of conditionals and/or repeated code across multiple files, this conditional approach totally works, is native to EE, and is something you can quickly whip out, conceptually and practically.

---

Also, it's totally fine in EE to have things like News and Events in separate channels, even if they are very similarly structured content. Very different content structures usually warrant different channels, but it's also OK to separate content based on user access requirements, ease of finding things in the control panel, how you want to structure your templates, and other kinds of content "filtering" you might do in your templates.

Alternatively, you could have a News & Events combined channel--e.g., using separate categories or a field to determine which item is news vs events.

Whatever approach you use, there are trade-offs. EE's biggest selling point, imho, is that it provides a bunch of parts you can put together different ways to match your content. But EE's options do mean that you always have multiple choices, that you need to think about this architectural kind of stuff, that there's usually no truly right way to do things, and that you'll probably kick yourself at least once per project for choosing one way over another. But, in the end, you'll make it work :-).
> 1 votes

# Answer
Graham!

I'm gonna try to help you.

You can use one template to multiple content, but I don't know if it worth the effort. Sometimes it does, but not always.

On EECMS, every directory of templates is the first segment of a variable. I, personally, use every template for two types of contents:

* the list of all content in that channel;
* a unique entry on that channel;

In your case, you can have three directories of files:

* news;
* events;
* industry;

At the index.html of every directory, you can handle its content.

If you don't mind, try to forget about wordpress for some time. The first thing you need to do is to organize your content. Try to forget about one single field to all the content. Open your notepad and list every little piece of info every channel needs.

For your news, everything looks easy:

* news\_content;
* news\_gallery;

Just two fields.

The events are a little harder:

* event\_place;
* event\_description;
* event\_date;
* contact\_info;

Different field\_groups for different *kinds* of content.

Just after this, you can start thinking about templates.

This is a really long discussion and I don't know if this is the better place for it.
> 1 votes

# Answer
Here's some reading for you. This is an advanced form of the usual template use. If you don't grasp it, thats fine. At least you know its available. partials. The main benefit is that you build one layout template( or more ) and each of your listing types (news, events and industry) tip content into it.
> 0 votes

# Answer
Here's the Structure add-on method. I'll try to keep it simple. With this method you'll only need two templates.

1. Create a channel for your static pages. Let's call that channel Pages.
2. Create your three unique listing channels: Events, News, Industry Events
3. Create a template for the Pages channel entries which will serve as your listing view. Let's make the template `pages/index`. It will pull from the Pages channel, of course:

```
{exp:channel:entries channel="pages" ...}

```
4. Create your detail/article template, let's say `pages/article`. Set it up to read the URL to know which listing channel it will display. (I'll explain this more below in #7.)

```
{exp:channel:entries channel="{segment_1}" ...}

```
5. In Structure's settings, manage the Pages channel as a page and assign the `pages/index` template to it. Then create your actual pages (new entries) from within the Pages channel for Events, News, and Industry News. Make sure the Structure Page URL matches its respective listing channel's short name so you can use the `segment_1` idea from #3 above. To be clear, the Events channel and Events page should have `events` as the short name and URL, respectively.
6. In Structure's settings again, set the three listing channels to be managed by Structure as listing channels and assign each of them to the `pages/article` template.
7. This next step is important. Now, you can go and edit each of the Pages (News, Events, Industry Events) to be related to their respective listing channel. For example, in the Events *page's* Structure tab, you can assign the Event *channel* as the "Listing Channel." Once you do that, every Event entry will have a URL of `/news/article-url`

I hope that's clear. This is a very common method for building EE site's. Clients like to use Structure because it provides a great UI for adding/editing pages.
> 0 votes

---
Tags: templates
---


title: index.php in sub domain not working

text:
# Question
Title: index.php in sub domain not working
I have created a sub domain new.mysite.com. I have a fully functioning EE website on mysite.com and I am a copy to new.mystie.com to work on it. It moved over fine, except that all the links are broken. On the main site I remove the .index.php with the .htaccess

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]

```

however on the sub domain if I put the index.php in the url it works. Is there something special need to do make it work on the sub domain and still keep the index.php removed?

I looked and all the setting are the same.

# Answer
I found the answer: I used this RewriteRule which add a ? after: the /index.php?/

RewriteRule ^(.\*)$ /index.php?/$1 \[L\]
> 2 votes

---
Tags: .htaccess
---


# Question
Title: Best combination for multilanguage ecommerce site?
I want to create a multilanguage ecommerce site. I really like the multilanguage- approach mentioned here: http://eeinsider.com/articles/multi-language-solutions-for-expressionengine

I like the idea of not duplicating menu- structures and pages etc. The only problem is how to make an ecommerce add-on compatible with the approach mentioned above?

Is this even possible with ee (without creating the ecommerce add-on all by myself)?

And if so what is the best combination (which add-ons should I use)?

# Answer
Well, this looks like it is going into the discussion direction, but I will chip in my thoughts on this anyhow.

We are also right now in the process of thinking about on how to best turn an EE and CT powered ecommerce into a multi-language site.

I believe to have researched all apporoaches out there and at the moment I tend to devide the sites in different langauges from each other - completly. No MSM, no multi-language Module.

Why? I have the feeling that all solutions will turn into a thick impenetrable bushwork eventually. Of course it depends on the piloted size of the site and the desired amount of different languages. I am aiming pretty high at the moment and want to find a solution in which I can easily say at any time: we need another language? No problemo!

I have also bought and looked at Publisher which looks like a really good, extensive and profound solution to me, also having a workflow solution on board which could come in handy if content for articles will be entered and edited by a team (this feature can also be activated by itself).

So, like I said I think it can become tricky and tedious in the long run to maintain all different language versions. Sure, the CP is no problem. All the channel entries can also be managed good with Publisher, Phrases and the such with Low Variables. At the moment I am not sure on how to handle (client/visitor) error messages the best. I also believe that running a webiste in another language, especially an ecommerce site should be hosted at a native url for best Google/SEO results. Also think about the Google Shopping Feeds that need to be targeted specifically for each language/country you want to operate in. What about User Comments/Ratings? How to best handle those for each language? What about product(images)? Maybe you want to show explanatory text IN the image or as a title underneath the picture.

And I also believe that - let's say a customer from France is always more compelled to click on a link like domain.fr than on a domain like domain.com/fr or even worse (like in our case) domain.de/fr.

Also this hard-seperation-approach will give you the opportunity to target products/bundles whatever tailored to a countries audience. Maybe you have products that just don't or can't be selled in a country (eg by law). You couldn't simply set an entry to closed.

And if you are going the whole nine yards it would probably a good consideration to also seperate the sites serverwise. This would distribute the risk of downtimes or worse.

Oh, there is another caveat: I haven't found a smart way to deliver language specific purchase and product shipped email notifications for example.

Yup, that's pretty much it at the moment. I am aware that this approach comes with doubled licence and probably servercosts and with more work probaly too. Using Focus Labs Master Config and Git should cut down on the workload, though.
> 1 votes

---
Tags: ee2, ecommerce, multi-language
---


# Question
Title: Can the Map Location be Automatically Obtained Using Address, in Objective HTML's Google Maps?
We are using ObjectiveC's Google Maps module and fieldtype http://devot-ee.com/add-ons/google-maps, which allows a user to choose a location on a map to obtain the longitude and latitude which is saved to the entry (the longitude and latitude is used in search results for a "results near x miles" list).

Our users are already entering an address to display for the listing, so is it possible for the Google Maps add-on to automatically get the lat and long from the address so we do not have to offer the map for them to pick a location in addition to entering their address?

# Answer
Ah, right. So I think you need Geocoder, which does exactly what you want. You can simply omit the Google Map field on the front-end, and have Geocoder plot the address for you after the form has submitted.

https://objectivehtml.com/geocoder
> 1 votes

---
Tags: google-maps-for-ee
---


# Question
Title: Is it possible to customise columns that are shown in a Playa pane?
Is it possible to make a Playa field show you additional options to help choose an entry from the Playa pane? I've got a situation where there's lots of entries on a site with the same titles (blog posts and user-submitted image galleries), so it makes it difficult to pick the correct entry. See the screenshot below:

Ideally, I'd like to be able to choose which columns are shown in the list alongside title, in a similar way to how you can choose the columns when viewing an Assets field in list mode. If that wasn't possible, then even being able to see the title and entry id in a title tag when hovering over the entry title would be better than nothing and save the trial and error of picking, saving, testing, and repeating, in order to get the correct entry.

I've looked in the various Playa settings and can't see any way to do this, so this may turn into a feature request. But I thought I'd post here first in case I was missing something, or if there was a config override that I wasn't aware of that might allow something like this (like magic ;-)), thanks.

# Answer
> 3 votes
I've hacked Playa before to do this same thing. Just modify /playa/views/entry.php

Using version 4.3.3, I added the `entry_id` for each entry like this in line 2 of entry.php.

**Original:**

```
   <a>
     <span class="playa-entry-status <?=str_replace(' ', '_',$entry->status)?>">•</span>
     <?=$entry->title?></a>

```

**Modified:**

```
   <a>
     <span class="playa-entry-status <?=str_replace(' ', '_',$entry->status)?>">•</span>
     <?=$entry->entry_id?> - <?=$entry->title?></a>

```

Just remember to reapply this if you update Playa in the future.

---
Tags: playa, pixelandtonic, publish-layout
---


# Question
Title: I’m not using the add-on, but the error is “Unable to load requested field type file: ft.wygwam.php.”
I updated EE from 2.2.2 to 2.7 core and moved the site to a subdomain called ee.mydomain.com. I changed the URL in config.php and in Admin/General Configuration, and admin works fine.

But when I try to view a page in the template editor or the site as a whole, all I get is the error

```
"Unable to load requested field type file: ft.wygwam.php.

Confirm the fieldtype file is located in the expressionengine/third_party/ directory"

```

I'm not using the Wygwam add-on and never have. The system/expressionengine/third\_party folder is empty except for an index.html file.

Setting the debug flag in main site index.php shows no errors.

If it matters, I have this in .htaccess, but it makes no difference with it or without it when viewing the site:

```
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

Any ideas? How can I delete references to the ft.wygwam.php file? Are they in the database?

# Answer
It seems that WYGWAM was installed previously and still having record in database table. Check the database table "exp\_fieldtypes" if having any record with field "name" as WYGWAM. You can delete that record.

Also, there may be some custom fields which may be using WYGWAM field type. You might check it also.
> 3 votes

---
Tags: add-on, templates, fieldtype
---


title: CSM & Solspace User

text:
# Question
Title: CSM & Solspace User
Does anyone know if the Custom System Messages add-on is compatible with Solspace User?

When I try to set an error template in the CSM interface (Register Member (On Error) for example) it does not seem to work since I'm using the register tag from Solspace User.

# Answer
> 0 votes
We had a miscommunication on a deprecated error function for ExpressionEngine 2.6, and subsequently switched all of our addons to use CodeIgniter's built in error function, which does not work with CSM, instead of EE's built in output error, which CSM uses to redefine its errors.

We have looked deeper into the issue and realized our error and will be moving back to the CMS compatible error format on each next release of each of our addons.

---
Tags: solspace-user, custom-system-messages
---


title: Setting up page redirects

text:
# Question
Title: Setting up page redirects
I've got a client who wants to use short URLs of dynamic entries for marketing literature

So clientdomain.com/events/event-type/full-event-name

Would be clientdomain.com/short-event-name

I've been setting up redirects manually within the htaccess file, but does anyone know of a better way? I can see several plugins to do it but can anyone recommend one?

Thanks for any help!

# Answer
> 3 votes
Detour Pro is an option for this, especially since it provides you with a bit of reporting on each URL redirect. However, it's meant as an alternative to doing 301 and 302 redirects in htaccess - not sure if it would be the best option for URL shortening. Another option is DM Shortee, which is more strictly a URL shortening service and not a redirect tool (same effect to the user, but potentially different effect from a search engine perspective).

# Answer
> 0 votes
I don't think there would be need for URL redirects if you can create such type of URLs for dynamic entries. If so you might use Structure or EE's Pages module and submit the URLs of your preference while editing/publishing an entry.

# Answer
> 0 votes
Because you can't set the redirect to 301, on the default redirect variable, you should use a mix of query module and php.

To keep the code more manageable, I gonna add one segment to your short URL. Let's say, "s":

clientdomain.com/s/short-event-name

You can set a short domain to use the same directory folder, if you want to:

doma.in/s/short-event-name

On the index.html of the directory "s", set the PHP parsing to output.

Let's say, your short-event-name has the field\_id 10.

```
{exp:query
sql="
    SELECT exp_channel_data.entry_id, exp_channel_titles.url_title
    FROM exp_channel_data
    JOIN exp_channel_titles on exp_channel_data.entry_id = exp_channel_titles.entry_id
    WHERE field_id_10 = "{segment_2}"
    LIMIT 1;"
require_entry="yes"
}
    {if no_results OR segment_3}
        {redirect="404"}
    {/if}
<?php
$permalink = 'http://clientdomain.com/events/event-type/{url_title}';

//  header('Status: 301 Moved Permanently',false,301); //enable this line after test
//  header('Location: '.$permalink);  //enable this line after test
    echo('{entry_id}');  // comment this line after test
    echo('Location: '.$permalink); // comment this line after test
    die(); //comment this line after test
?>
{/exp:query}

```

You can have conditionals and to use the `{channel_url}` URL to create short links to all channels. I use to create mine as `shortdoma.in/s/entry_id`, to avoid the risk of duplicated `short_url_titles`.

# Answer
> 0 votes
For a simple solution I recommend using the Pages module in conjunction with a "Redirects" Channel. The Pages module will allow you to create an entry with whatever URI you want to "listen" for and redirect. The entry will store the URL you want to redirect *to* in a custom field.

1) Set up your Redirects channel with a custom field to hold the URL to redirect *to* (eg `redirect_url`).

2) Create a redirect template (I use `pages.group/_redirect.html`, but name it what you like). Set it as the default Pages module template for entries in this channel and add the following to it:

```
{exp:channel:entries
    channel="redirects"
    disable="categories|category_fields|member_data|pagination|trackbacks"
}

    {exp:http_header status="301" location="{redirect_url}" terminate="yes"}

{/exp:channel:entries}

```

This method uses the HTTP Header add-on to handle the redirect. It works great with a redirect URI string (more useful since it is portable across environments) *or* a URL.

---
Tags: redirects
---


title: Wrong PHP parsing order in snippet

text:
# Question
Title: Wrong PHP parsing order in snippet
I'm trying to parse a global variable inside a snippet that represents my page footer, and I want to perform a string function on the content of that variable. The snippet is being called into a template with PHP parsing ON and set to OUTPUT. This is the code I'm having trouble with:

```
<?php echo trim(str_replace(array("\r\n","\n","\r"), ', ', "{address}")); ?>

```

The value of the variable is (for example):

```
Big Company
Main Street
Big Town

```

And I want it to be:

```
Big Company, Main Street, Big Town

```

But PHP is trying to modify the string "{address}" not the actual value of the address variable, so I just end up with the original content (address with line breaks) when the EE parses the result of that function which is {address} in the template.

What am I doing wrong?

EE 2.6.1

# Answer
You can fetch that global variable like:

```
$address = ee()->db->select('variable_data')->where('variable_name', 'address')->get('global_variables')->row('variable_data');
echo trim(str_replace(array("\r\n","\n","\r"), ', ', $address));

```

It would work for you.
> 2 votes

# Answer
This is because user-defined global variables are parsed very late - after PHP on input, after all module and plugin tags, and even after PHP on output (see parse order).

Your best bet here is to write a simple plugin which fetches the global variable directly from the database, does its work, then returns it.
> 1 votes

---
Tags: php, snippets, parse
---


# Question
Title: Tricky Channel Entries Loop with Category Conditionals
I'd like to return entries from a specific channel, but what i'd like to do is ONLY show entries from a child category first, but if there are none, then show entries from the child's parent category.

Is this possible?

# Answer
Put your loop on a embed and call it at this way:

```
{exp:channel:entries channel="news" limit="1" category="X"}
    {if no_results}
        {exp:query
            sql="SELECT parent_id
                FROM exp_categories
                WHERE cat_id = X"
        }
            {embed="pages/.category_loop" cat_id="{parent_id}"}
        {/exp:query}
    {/if}
        {embed="pages/.category_loop" cat_id="X"}
{/exp:channel:entries}

```
> 2 votes

---
Tags: channel-entries, categories, conditionals
---


# Question
Title: custom form validation class for a module I am building
I am building a module for EE2 and I want to extend CI's form validation library. I also want a separate language file too, kept within my module's directory so it's separate from future EE updates.

I created a libraries folder within my module's folder within the third\_party folder.

I named the file: My\_Form\_validation.php

```
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Form_validation extends CI_Form_validation {

    /**
     * Constructor
     *
     * @access  public
     */
    function __construct($rules = array())
    {
        parent::__construct($rules);
    }

    public function is_valid($value)
    {
        $this->form_validation->set_message('is_valid', 'The %s field can not contain any spaces');
        return FALSE;
    }
}

$this->EE->form_validation->set_rules('short_name', 'Short name', 'required|max_length[30]|is_valid');

```

I set the rule in the mcp.module\_name.php file, I also swapped out $this-\>EE-\>form\_validation... with $this-\>CI-\>form\_validation and nothing.

it is not erroring out, it just doesn't seem like it is loading it correctly.

I tried loading the my form validation library in the mcp.module\_name.php constructor and it returns this error: Fatal error: Class 'CI\_Form\_validation' not found

I shouldn't have to load it since it should load along with the default form validation library.

Below is my constructor for the mcp.module\_name.php file

```
public function __construct()
{
    $this->EE =& get_instance();
    $this->CI =& get_instance();
    $this->EE->config->load('config');
    $this->conf = $this->EE->config->item('restaurant_menu_defaults');
    $this->CI->load->helper('file');
    $this->EE->load->helper('html');
    $this->EE->load->model('restaurant_menu_model');
    $this->base = BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=restaurant_menu';
    $this->base_url = BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=restaurant_menu';
    $this->EE->cp->add_to_head('<link rel="stylesheet" href="/themes/third_party/restaurant_menu/css/restaurant_menu.css" type="text/css" media="print, projection, screen" />');
    $this->base_short = 'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=restaurant_menu';
    $this->data['base_url_short'] = $this->base_short;
    $this->data['base_url'] = $this->base;
    $this->site_id = $this->EE->config->item('site_id');
    $this->EE->cp->set_breadcrumb($this->base, $this->EE->lang->line('Restaurant Menu'));

    // setup navigation
    $this->EE->cp->set_right_nav(array(
        'module_nav_home' => $this->base_url.AMP.'method=index',
        //'module_nav_settings' => $this->base_url.AMP.'method=settings',
    ));
}

```

UPDATE:

added this to my construct on mcp.module\_name

$this-\>EE-\>load-\>library('form\_validation'); $this-\>EE-\>load-\>library('MY\_Form\_validation');

then in my methods, I run the form validation using: if($this-\>EE-\>my\_form\_validation-\>run() === FALSE)

Then I set my form field rules:

$this-\>EE-\>my\_form\_validation-\>set\_rules('title', 'title', 'required|max\_length\[75\]'); $this-\>EE-\>my\_form\_validation-\>set\_rules('short\_name', 'Short name', 'required|is\_valid|max\_length\[30\]'); $this-\>EE-\>my\_form\_validation-\>set\_error\_delimiters('', '');

MY\_Form\_validation.php

```
<?php defined('BASEPATH') OR exit('No direct script access allowed');

class MY_Form_validation extends EE_Form_validation {

    /**
     * Constructor
     *
     * @access  public
     */
    function __construct($rules = array())
    {
        parent::__construct($rules);
        $this->EE =& get_instance();
    }

    public function is_valid($value)
    {
        $this->EE->form_validation->set_message('is_valid', 'The %s field can not contain any spaces');
        return false;
    }

}

```

It won't post the form unless all the rules are met, but it won't display the form error messages, why do you think that is?

# Answer
> 5 votes
First, no need to ever load directly from CI - you can always use EE. (So, `$this->EE->load->helper('file')`.)

Same with your validation class - I'd extend `Form_validation`, not `CI_Form_validation`.

(Generally, EE should serve as your path to anything CI-related to avoid any conflicts.)

You'll need to load your custom validation library, and call it by its unique name as well. You may also have to load the form validation class before loading your custom library.

```
$this->EE->load->library('form_validation');
$this->EE->load->library('my_form_validation');
// $this->EE->my_form_validation->run();

```

---
Tags: add-on-development, module, forms, validation
---


# Question
Title: Better Way to Show Categories from the Control Panel?
I've looked everywhere for an Accessory that makes the Control Panel Categories look better:

As you can see from the screenshot I'm eventually going to run into a big issue when I get other States and Cities added and it's going to be a heckuva mess!

I'm envisioning a way to "toggle" the children list of categories here. This way I can have my "Businesses" open (since there aren't many children associated here) AND have the City/State category parents clickable to show their children. This will keep this list a LOT shorter and hence easier to use.

Has anyone done this or seen an Accessory that would do this? Like I said I've search everywhere on Devot-EE and Google to no avail.

Thanks again gang!

# Answer
> 5 votes
I made Category Field for that very reason. http://devot-ee.com/add-ons/category-field

---
Tags: categories, control-panel
---


# Question
Title: Search results: only display matrix rows that contain the search item
I've found out how to search and display matrix rows, but the search results page will typically only show ALL rows.

How can I limit the results and show only the row where the item exists?

> {exp:search:search\_results}
> {title}
> {matrix\_stuff}{matrix\_title}{/matrix\_stuff}
> {/exp:search:search\_results}

EDIT: There is a hack that works, but not a definite answer:

In mod.search.php add after line 1298( before $pagination):

```
// hack
// Load the XML Helper
$this->EE->load->helper('xml');

$keywords = $this->EE->functions->encode_ee_tags(xml_convert($query->row('keywords')));
// end hack

```

And after line 1411 before $channel-\>fetch\_categories();

```
// hack add keywords
$this->EE->TMPL->tagdata = str_replace(LD.'keywords'.RD, $keywords, $this->EE->TMPL->tagdata);
// end hack

```

This makes it possible to use this:

```
{exp:search:search_results}
{title}
{matrix_stuff search:matrix_col_name="{keywords}"}}{matrix_title}{/matrix_stuff}
{/exp:search:search_results}

```

Not implemented in 2.7.0 :-(

# Answer
> 2 votes
Make the sure the matrix field and columns are searchable first. Then you could do something like what I have below, but you're limited to what matrix columns you can search.

```
{exp:search:search_results}
    {my_matrix_field search:matrix_col="{exp:search:keywords}"}
        {matrix_title}
    {/my_matrix_field}
{/exp:search:search_results}

```

Like Robson mentioned below, you can do either a "contains" matching (above) or an "exact" matching search by adding the `=` in front of the `{exp:search:keywords}`

# Answer
> 1 votes
Ok found a simpler way to get this to work with an embed (have not tested with native EE search)

Source:

# Answer
> 0 votes
Install Mo' Variables: http://devot-ee.com/add-ons/mo-variables

Change your template to this:

```
{exp:search:search_results}
    {my_matrix_field search:matrix_col="{post:keywords}"}
        {matrix_title}
    {/my_matrix_field}
{/exp:search:search_results}

```

# Answer
> 0 votes
Have you looked at Sift?

http://devot-ee.com/add-ons/sift

It should do what you need. Hope it helps.

---
Tags: matrix, search
---


title: User based permissions?

text:
# Question
Title: User based permissions?
I need to be able to give access to viewing a section of the EE site based on usergroup AND user. For example: I may have a usergroup that I do not want to have access to a blog. BUT, there is a user within that group that I want to give access. So, individual permissions would trump group permissions. Thanks so much for taking the time to help!

# Answer
Take a look at this. I've used it, really simple and easy to use on a per entry basis.

http://devot-ee.com/add-ons/entry-access

Hope it helps.
> 1 votes

# Answer
There wouldn't be such type of permission. I think, it would be better to make a member field and update it accordingly if a member can see the blog content or not.

```
{exp:member:custom_profile_data}
    {if member_can_see == 'yes'}
        ### show the content ###
    {if:else}
        ### show the message if member can't see the content
    {/if}
{/exp:member:custom_profile_data}

```
> 0 votes

# Answer
In general, one thing to consider is having the same content / views duplicated in 2-3 different templates, with each having different permissions. For example:

```
student_view is a template for students only
admin_view is a template for the admins only
moderator_view is a template for the moderators only

```

Those all might embed some of the same templates that display actual content. But, each main template then could have different, additional restrictions.

So, maybe the built-in EE permissions handle one level of access control. And then you do more fine-grained restrictions with logic in the template.

If you need to restrict members to their blogs on only the front-end:

If you want that all to be in the same channel (or, fewer than 300+ channels), you could map the students' member\_ids to category\_ids. You'd store the mappings in a special entry, Low Variable, template or directly in the database (depending on how you want to manage these).

Then, for each logged in member\_id, you could look-up a corresponding category\_id, and then restrict the channel entries shown to only those in the category.

Might that work for what you need?
> 0 votes

---
Tags: users, permissions
---


# Question
Title: Assets: Unable to Upload Large Files to S3
I'm trying to upload a 43MB .mp4 video file to S3 using Assets. The progress bar will run all the way to the end (it takes about a minute), then I'll get an alert that says "Undefined", and the console will show an error:

```
Failed to load resource: the server responded with a status of 500
(Internal Server Error) - https://mydomain.com/?folder=478&ACT=161&qqfile=my-video-file.mp4

```
* My php `post_max_size` and `upload_max_filesize` are both set to `256M`
* My `system/expressionengine/cache` directory and all sub-directories have 777 permissions
* EE 2.6.1
* Assets 2.1.4

# Answer
> 1 votes
There are a couple other PHP settings you might need to adjust to allow for large files to be uploaded. Try also increasing these two:

```
max_input_time 300
max_execution_time 300

```

---

You may also peek at your php error log file to see if anything more specific is getting logged there.

---
Tags: assets, pixelandtonic, s3
---


# Question
Title: Pagination redirects to first page at P100
I have a page where the pagination works fine until you get to the page that would use "P100" at the end. At that point, it redirects back to the first pagination page. Have any of you had this issue before? Any ideas on how to fix it?

# Answer
> 1 votes
This sounds like a potential bug in EE. I would suggest submitting a bug report using the **EllisLab Bug Tracker** (you must be logged in to see the page).

---
Tags: templates, pagination
---


# Question
Title: Channel Field Additional Options not Showing in 2.7
I have upgraded from 2.5.5 to 2.7. There is a problem that I don’t seem to understand.

When I tried picking any fieldtype for any field, before upgrading, normally JS would show more options at the bottom. This has been the standard behavior ever since I have used EE.

In this case, nothing shows. I looked at my firebug console and I saw this error

```
TypeError: d.ee_focus is not a function
...ocus(b.find("ul>li>a").eq(0)))},onEscape:function(a){a=c(a.target).parent();EE.n...

```

I looked at what file caused this and it was

```
admin.php?S=d3d3f2b7c7030e79c48804e28d9b425b&D=cp&C=javascript&M=combo_load&ui=core,widget,mouse,position,sortable,dialog&plugin=ee_interact.event,ee_notice,ee_txtarea,tablesorter,ee_toggle_all,ee_navigation&file=json2,underscore,cp/global_start&v=1355999354

```

I disabled Javascript and sure enough, it showed additional options, although in a very messy way.

How do you solve this Javascript problem?

# Answer
> 3 votes
If you are having issues with JS interactions in the control panel not working correctly after an EE upgrade, the first thing to try is to reupload your control panel theme folder.

---
Tags: fields, 2.7.0
---


# Question
Title: Excluding results from a particular category
I have a landing page which is to show all of the current members of an academic group. This group is to exclude alumni. The memberships of the various groups are categories, so I need to exclude this one particular category. When I try the following code to exclude alumni (category 4), the rest of the category filtering no longer works (i.e. when you click on a group to see the members, all people are listed in every category, instead of being filtered properly). The filtering works once I remove category="not 4" from the channel entries tag, but then the list shows all of the alumni, which is no good. The following is the code for the landing page, which is intended to show all memberships except alumni:

```
{exp:stash:append name="content"}
<p><strong>Please select a group to see its members:
   {exp:channel:categories category_group="1" show="not 4" channel="people" show_empty="no" style="linear" backspace="8"}
   <a href="{path='people/index'}" > {category_name}</a>  |{/exp:channel:categories}</strong></p>
        <br>
{/exp:stash:append}

{exp:channel:category_heading channel="people" show_empty="no"}
  {exp:stash:append name="content"}
  <h2>{category_name}</h2>
  {if category_description}<br /><h4>{category_description}</h4>{/if}
  {/exp:stash:append}
{/exp:channel:category_heading}

  {exp:stash:append name="content"}
  <div id="main" role="main">
  <ul id="tiles">
 {exp:channel:entries channel="people" status="open" orderby="title" sort="asc" show-expired="no" limit="200" show_future_entries="no" category="not 4"}

  <!-- grid blocks -->
   <li class="{if "{segment_3}" == "phd_students"}phd{/if}{if "{segment_3}" == "researchers"}researchers{/if}{if "{segment_3}" == "support"}support{/if}{if "{segment_3}" == "masters"}masters{/if}"><img src="{people_img}" width="100" class="biopic"><h3>{people_name}</h3><p>{people_bio}</p>{if people_email}<p><a href="mailto:{people_email}">contact</a></p>{/if}</li>
  <!-- End grid blocks -->

{/exp:channel:entries}
  </ul>
  </div>
  {/exp:stash:append}

```

# Answer
It's now working! For the sake of closure, here's the final code:

```
    {exp:stash:append name="content" parse_conditionals="yes" parse_tags="yes" }
    <p><strong>
      Please select a group to see its members:
      {exp:channel:categories category_group="1" channel="people" show="not 4" show_empty="no" style="linear" backspace="7"}<a href="{path='people/index'}">{category_name}</a> | {/exp:channel:categories}
    </strong></p><br>

    <div id="main" role="main">
      <ul id="tiles">

        {if segment_2 == 'cat'}
          {exp:channel:entries channel="people" orderby="title" sort="asc" limit="200" disable="member_data|pagination"}
             <li class="{if segment_3 == 'phd_students'}phd{/if}{if segment_3 == 'researchers'}researchers{/if}{if segment_3 == 'support'}support{/if}{if segment_3 == 'masters'}masters{/if}">
                <img src="{people_img}" width="100" class="biopic">
                <h3>{people_name}</h3>
                <p>{people_bio}</p>
                {if people_email}<p>{encode='{people_email}' title='contact'}"></p>{/if}
             </li>
          {/exp:channel:entries}
        {/if}

        {if segment_2 != 'cat'}
          {exp:channel:entries channel="people" orderby="title" sort="asc" limit="200" disable="member_data|pagination" category="not 4"}
              <li class="{if segment_3 == 'phd_students'}phd{/if}{if segment_3 == 'researchers'}researchers{/if}{if segment_3 == 'support'}support{/if}{if segment_3 == 'masters'}masters{/if}">
                <img src="{people_img}" width="100" class="biopic">
                <h3>{people_name}</h3>
                <p>{people_bio}</p>
                {if people_email}<p>{encode='{people_email}' title='contact'}"></p>{/if}
             </li>
          {/exp:channel:entries}
        {/if}

     </ul>
   </div><br>
{/exp:stash:append}

```
> 0 votes

# Answer
Ive looked at docs and cant immediately see why its not working.

Change this code (and all similar): `{if "{segment_3}" == "phd_students"}phd{/if}` \- you turned a simple conditional into an advanced conditional.

To this `{if segment_3 == "phd_students"}phd{/if}` \- back to simple conditional

Also, change show-expired to show\_expired

Read this too parse order. Keep it handy.

Then, start by simplifying the page. Put the categories tag only in a template and test until you get the required output using 'not'.

Then use stash set\_list to cache the output for 1440 minutes.

Dont stash markup, just the variables you want to store.

Read the stash docs carefully, its a great tool when used wisely.

Go to the db tables find exp\_stash, browse and check to see your stored values are all there.

Repeat for remaining tags until you have created your stash caches.

Finally, use get\_list to output your lists in your markup.

With stash, parse order becomes very important. Following the above steps will help you learn. Also read the debugger at bottom of template to check the parse order if you are having issues.

Edit: an example of a stash set\_list for categories saved into exp\_stash. This can be reused anywhere in our site using get\_list.

`cat2_name|=|Aged Care|&|cat2_url|=|aged-care|&|cat2_count|=|1|+|cat2_name|=|Bed & Breakfast|&|cat2_url|=|bed-breakfast|&|cat2_count|=|1|+|cat2_name|=|Caravan & Campgrounds|&|cat2_url|=|caravan-campgrounds|&|cat2_count|=|1|+|cat2_name|=|Holiday Resorts|&|cat2_url|=|holiday-resorts|&|cat2_count|=|1`
> 0 votes

---
Tags: ee2, categories
---


# Question
Title: FIlter entries by category without refreshing the page
I have a page that displays all entries in a "stories" channel. Each story is categorised and I need there to be an option to filter by these categories. Here is the code I currently have:

```
<div class="filter-stories">
    Filter stories by:
    {exp:channel:categories channel="stories" style="linear" show_empty="no"}
        <a href="#">{category_name}</a>
    {/exp:channel:categories}
</div>

{exp:channel:entries channel="stories" dynamic="off"}
    <aricle class="story{switch='|| end'}" style="border:1px solid #000;width: 32%; float: left;">
        <img src="{story-hero}" style="width:100%;">
        <h1>{categories}{category_name}{/categories}</h1>
        <h2>{title}</h2>
        {story-text-1}
        <a href="{page_url}">read more</a>
    </aricle>
{/exp:channel:entries}

```

Currently the list shows all the stories - which is how I want it to be by default, but how would I go about making the filter work. Ideally I want to click one of the category name links and it will only show the stories in that category without refreshing the page (using AJAX I assume?).

I've never used AJAX in ExpressionEngine, can I add to the channel entries tag with it or is there a different way to achieve this?

Thanks in advance.

# Answer
> 1 votes
There's a great 2-part walkthrough of a setup like this on the Meta Q site that would be worth a read.

---
Tags: categories, conditionals, ajax, filter, advanced-conditionals
---


# Question
Title: Two fields in Solspace Freeform - either one or the other must be filled out. Is it possible?
I am building a form using Solspace Freeform, and we have two fields for telephone numbers - one for landline and one for mobile/cell.

Is it possible for me to make one or other of these fields required? I.E. If the user fills out landline but not mobile the form will submit, if the user fills out mobile but not landline the form will submit, but if the user doesn't fill out either then the form will return an error?

Thanks in advance!

# Answer
> 2 votes
You could try to solve with Jquery with depend function like so

```
$(".selector").validate({
    rules: {
        contact: {
            required: true,
        email: {
                depends: function(element) {
                     return ($('#theRequiredField').val() == '';
                }
        }
     }
}

```

SOURCE: http://jqueryvalidation.org/validate#toptions search " depends:"

---
Tags: solspace-freeform, forms, solspace
---


# Question
Title: How can I get the length (duration) of an audio file?
I'm pulling media files (audio and video) into a template with Assets add-on. It doesn't appear to have the ability to grab the length (duration) of the media being uploaded. Is there a quick and easy way to get it?

Edit: MX GetID3 does the trick but not for remote files. If your files are on another subdomain (as mine were), use `{server_path}` instead of `{url}` to grab the file path.

# Answer
You can use MX GetID3 plugin for this purpose. This addon seems updated before 1 year but it would work.
> 3 votes

---
Tags: assets, file-uploads, file-manager
---


# Question
Title: Can someone explain the difference between Structure and Taxonomy?
I'm trying to pick a navigation module that will dynamically update the main nav, secondary navigation, and landing pages as pages are added, keeping everything consistent. This is a requirement because otherwise the client will make a mess out of the navigation, making it inconsistent and ruining the user experience.

From my research it seems NavEE is not the answer. It appears to be fully manual. Can someone explain the difference between Taxonomy and Structure, when you would choose one or the other, etc.?

Thanks!

# Answer
> 2 votes
Structure is the only self-contained solution to have a completely automated, whole-site navigation for every Pages URI that is *automatically* kept up to date as the end user adds new pages or changes the overall Pages URI hierarchy. But Structure is more of a whole-hog commitment to how you set up and build your site (some like this, others do not). In other words, Structure is not just for navigation it's a way of building sites with EE.

Both NavEE and Taxonomy (my personal favorite) are *just for navigation*, are very open-ended, and require more hands-on approach from the end user. They also require a more savvy, or better-educated, end user. The upside is that they are really flexible and make no assumptions about how you're setting up your site *or* your navigation.

---
Tags: module, structure, taxonomy
---


# Question
Title: admin backend template (CP styles) not fully showing
Hi Folk I'm trying to learn the basics of EE2 and have setup a test rig using MAMP PRO I got everything working. I'm basically converting one of my basic static websites into a EE2 driven site. However when I tried to login to the admin area yesterday I've seem to be missing most of the formatting i.e I can still login however the back-end interface is mostly missing. the front end is still working okay. What do you think has happened and how do I get the back-end fully back with out doing a full install again?

Jonathan

# Answer
If you mean that the control panel pages appear without style and formatting this sounds like a path issue.

In the control panel, go to *Admin \> General Configuration* and check the **URL to your "themes" folder** and **Theme Folder Path** are both correct.

If that's not it, then I'd double check the permissions on the themes folder.

You can also use your web inspector console to check for errors.
> 6 votes

---
Tags: control-panel, admin
---


# Question
Title: Solspace User: Blank Error Page After Submitting Registration Form
I have a User registration form:

```
{exp:user:register
    return='member/register/pending'
    admin_register='yes'
    required='m_firstname|m_lastname|username|email|password|password_confirm'
    error_page='notifications/user-error'
}
        {!-- form fields --}
{/exp:user:register}

```

Submitting a successful form returns the correct `member/register/pending` template, but submitting a form with errors returns a blank page at the site's root (`http://mysite.com/`).

This is my error template; the `{if ajax}`/`{if not_ajax}` tags are from Mo' Variables:

```
{!-- Error template for the User module --}
{!-- if the template is requested with Ajax, return JSON data. Otherwise, display a normal page --}
{if ajax}
    {exp:http_header content_type='application/json'}
    {
        "success": false,
        "heading": "{heading}",
        "message": "{content}"
    }
{/if}

{if not_ajax}
    {embed='_global/document_head' page_title='{title}'}
    <body class="single">
    {header}

    <article class="bizness">
        <header>
            <h1>{heading}</h1>
        </header>
        {content}
        {link}
    </article>

    {footer}
    {global_scripts}
    {document_foot}
{/if}

```

Debugging doesn't return anything.

EE 2.6.1

User 3.4.4

# Answer
> 3 votes
Testing Mo'Variable's `{if ajax}` and `{if not_ajax}` conditionals in a User error template showed that the content of these conditionals do not parse, or rather parse as empty. This is the code that was used in an error template:

```
{if ajax}AJAX{/if}{if not_ajax}NOT AJAX{/if}

```

The above parsed to nothing in the error template.

Error templates bypass the native EE error message template and allow you to create and customize your own page. However, the full parsing engine might not be loaded on these special templates. Mo'Variable's conditionals might be part of what isn't loaded/reached/parseable. In fact, testing {if secure}/{if not\_secure} lead to the same results (contents are parsed to nothing).

Have you tried removing the {if ajax}/{if not\_ajax} conditionals from your error template? If the error template contents then appear, then it could be that Mo'Variable isn't being accessed in these special error templates.

---
Tags: solspace, solspace-user, white-screen-of-death
---


# Question
Title: Is there a good eCard/eVite Solution available?
For several years I have been using this simplEcard solution for a site and this year it appears that the gap between the last update to the solution and the 5.2x version of PHP has grown too wide and generates a number of PHP error.

Is anyone aware of a good eCard solution that could be integrated with EE?

Thanks.

# Answer
> 1 votes
> Basically something that allows you to select an image and email it to someone like an eCard.

You could address that aspect of your question with built-in functionality and one add-on.

Create a channel for storing your library of "eCard Designs" that a user can choose from.

Then another channel for "User Created eCards" and allow users to publish into this channel from the front end of your site using Channel Form (formerly SafeCracker). You'd be able to collect and store all the parameters of the eCard (to, from, message, design, etc) as custom fields.

Then in conjunction with this you can use the Postmaster add-on to template, dynamically fill, and deliver the email when the user creates their eCard entry.

Since this gives you the freedom of the Channel module, and since Postmaster is made to be adaptable, I think this approach would probably allow for the greatest flexibility.

---
Tags: php, events
---


# Question
Title: Is there a way to block access to member profile pages so only logged in members can see them?
I've had a few run-ins with that spam attack that is often used against Exp Eng sites which creates endless member accounts for the sole purpose of adding links back to whatever the spammers are trying to promote. The Member's URL in the member profile is used for this.

I'm working on a site that basically locks down everything so that comments and other content are only available to logged in members. Since search engines would not be logged in they wouldn't see any comments and wouldn't see any spam link backs in the comments. Not that this would really dissuade spammers.

I wanted to do the same for Member Profiles so that they can only be seen by other members who are logged in. As far as I know there doesn't seem to be a preference for this. Any ideas on preventing public access to member profile pages?

# Answer
> 2 votes
You can edit the member-profile templates so that they contain all the actual page content in the conditional if logged\_in tag. You can either put the opening if logged\_in tag right before the DOCTYPE tag, and the closing one after the /HTML tag; or you can put it further down. (Or - if you want to let people see your member profiles but NOT the site URLs, contact methods, or the member bios, you could tag just those table cells so that the contents are only displayed when someone is logged in.

# Answer
> 2 votes
You may wish to consider applying the best practice recommendations that Ellislab include in the documentation, there's a great tip at the bottom by a user about renaming the 'Members' trigger word term spammers target:

Installation Best Practices

I normally duplicate and rename a copy of the \>themes\>profile\_themes\>default folder and run through selectively wrapping what information I want disclosed with the {if logged\_in} conditional tags.

---
Tags: members, member-management
---


# Question
Title: super_search_total_results off when using search: parameter
I'm using Super Search (2.1.2) as a channel:entries replacement. I'm finding that super\_search\_total\_results is wrong when I use **search:** parameters. A stripped down example:

```
{exp:super_search:results
  channel="files"
  search:files_area="=schedules"
  search:files_type="not digital"
}

```

I *should* have 5 results, but super\_search\_total\_results give me a result of 8, which is the count of *all* items in the files channel, including the digital items. I am seeing only five files (which is right), but the total results result is incorrect.

If I use a query string instead:

```
search&files_area=schedules&files_type=-digital

```

I get 5 items showing and the correct count of 5. I don't always want to put a monstrous query string in the URL if I don't have to, because I don't want someone trying to manipulate it. Also, I don't think I can do an "if empty OR a specific value" in the query string like I can do with this (and will need to do on this site as well):

```
search:files_company="IS_EMPTY|{member_company}"

```

Is there something I'm missing as far as getting the correct total results count when using those search: parameters?

*For anyone coming here with the same issue: I downvoted the initial answer because it doesn't actually answer the question(s).*

I just found this comment in mod.super\_search.php on line 1261 (SS v2.1.2):

```
//  If someone uses the search:body="something" template param, the counts
    can be thrown off. This conditional is a patch that will catch some of the cases.

```

Someone there knows about using the "search:" parameter style, and knows that the counts can be off. I don't think the patch is working, obviously.

# Answer
> 7 votes
I don't know why this didn't occur to me before, but you can use {absolute\_results} inside the Super Search tags. So, the lesson here is, **if you need to use the channel entries style "search:field=" parameter to filter entries (NOT the Super Search "search=" parameter) and you need an accurate number of items returned, use {absolute\_results} in place of {super\_search\_total\_results}**.

One trick to note about this is that {super\_search\_total\_results} is available anywhere on the results template, but {absolute\_results} is only available inside the Super Search tags. Depending on how your template is laid out you may have to use Stash to put your {absolute\_results} where you need it. (Stash on devot:ee: http://dvt.ee/stash)

# Answer
> 1 votes
The syntax for SuperSearch is a little different. ref http://www.solspace.com/docs/super\_search/results/#search

Something like: search="keywords=green&channel=products&category=pants+shirts&status=-closed&orderby=title+asc&limit=100"

The usage of the "search:" parameter is a current limitation in Super Search. Because Super Search uses the Channel Entries API, it does by default "work" when you try to use "search:stuff" parameters, however Super Search does not account for this in the {super\_search\_total\_results} variable. This is not quite a bug, though I agree it seems like it could be easily supported/added in and be a valuable addition.

Can you submit a Feature Request for it here: http://support.solspace.com/support/discussions/forums/213813

---
Tags: solspace, supersearch
---


title: Solspace Calendar and Importer

text:
# Question
Title: Solspace Calendar and Importer
So I'm looking for a work around with Solspaces' Importer and Calendar module and hoping someone has a fix, hack or whatever for this.

My problem is that the two awesome modules *do not exactly work together*. Importer is great for taking a LOT of data and port that data into EE fields that you can run manually or on a cron. What it doesn't do however is port the DATES into Calendar DATES. This is a big problem for me since I'm using an API to pull in Events.

Has anyone discovered a way to do this? My thoughts were that I could possibly have the date (formatted like so: 2013-10-01 07:30 PM) into a *text field* and run a MySQL command that would port that information into my Solspace Calendar field.

Is this doable or even thinkable? :) Perhaps I should try DataGrab instead? Or am I just stuck with having to edit each and every event to the end of time?

# Answer
> 1 votes
We answered this privately, but we'll mentioning it here again for reference for other users, as it might be useful:

It's possible to import Calendar data through an .ics file (a calendaring file used in iCal, Google Calendar, etc, which contains calendar/event data). When creating a calendar entry in the "Calendar: Calendars" channel, there is a custom field for pasting a URL pointing to your .ics file. Saving the entry should import event data.

---
Tags: mysql, solspace-calendar, solspace-importer
---


# Question
Title: Techniques for using "feature flags" / conditional features in EE
What are techniques you use to show different features / versions of your EE site to different users?

I use "feature flag" techniques in my client-side Javascript (my Javascript Feature Flags library is a temporarily out-of-date example), and want to enable something(s) similar in EE. Scenarios I'd like to support--e.g., on a live, production site, at the same URL:

* allow developers to see different templates than regular users
* allow developers to see different content than regular users
* allow user group A to see one feature, and user group B to see a different feature (e.g., A/B testing, or gradual rollout of new features)

The obvious EE technique that comes to mind is having simple "router" templates, that conditionally embed other templates. Like:

```
{if member_id==1} {!-- ideally, abstracted to {if dev==1} --}
  {embed="developer/index"}
{if:else}
  {embed="production/index"}
{/if}

```

I could imagine abstracting that, such that I could set a global feature flag that is triggered by specific conditions (specific member\_id, group\_id, ip\_address or a cookie value). Using Freebie, one could use URL segments as trigger, as well.

I've done this kind of thing on an ad hoc basis within a template, but I'm curious if others have done anything like this, systematically. If so, what technique(s) have you used? Have you found it useful and maintainable over time?

**Updated:** ideas for ad hoc techniques are appreciated. But I'm especially interested to know of any systematic approaches being taken, and their relative pros / cons for maintainability and ongoing usefulness.

For example, is there some code you make available to every template that allows you to switch things on and off across many templates? Is there an add-on or htaccess technique that gives you top-level control over routing, that allows you to conditionally set routes (based on user, cookie, ip address, etc.)?

# Answer
OK, I'm now developing a systematic way for doing Feature Flags in EE--I'll post more examples as I get a bit farther along.

My "system" does uses config-file global variables, Low Variables and/or Snippets. This should allow flags to alter which templates display, which entry\_ids or channels are used, which external assets (CSS, JS) appear on the page, and more. (It's kind-of a combination of the answers from @dadonbike and @JamesSmith.)

It uses a simple PHP class for Feature Flags, that I've created. And, for example, if you need a blunt instrument and can you turn-off page caching, you can use a flag to do this kind of major swap from directly in the config.php:

```
// EE config items
...
$config['tmpl_file_basepath'] = $_SERVER['DOCUMENT_ROOT'] . '/templates/';

// FeatureFlag overrides
require_once  'php-feature-flags/feature-flags.php';
$FF = new FeatureFlags(array('cookie'=>'FF'));

if ($FF->isFlagged()) {
    $config['tmpl_file_basepath'] = $_SERVER['DOCUMENT_ROOT'] . '/templates-alt/';
}

```

So, that's checking for a cookie named FF, and if it's present, giving EE a totally different template folder.
> 1 votes

# Answer
Have you seen the Focus Lab Master Config? It has environment switching built-in and has become the preferred way to do all that you're asking:

https://github.com/focuslabllc/ee-master-config

If that's too heavy, you can instead create some simple high-level variables yourself in your main index.php file and/or your config.php file depending on, say, your hostname or IP address. Typically you'd have variables for:

* template file basepath override to use a different set of templates (preferably with some kind of version control to automatically deploy from the dev location to the live location to save the hassle of manually copying from dev to live)
* environment name for extra per-template conditionals (dev/live/staging etc)
* entry status for use in channel entries tags (dev site = "open|draft" live site = "open")

Then in your templates any time you use a channel entries tag you'd add `status="{env_statuses}"` to show draft content on your dev site.

For A/B testing, try Google Experiments in Google Analytics, works better than anything you can build in EE.
> 4 votes

# Answer
Here's a different embed approach to ponder, it may make maintenace much easier. Lets say you have 50 templates, each with the same basic html structure. Under your current approach youd most likely need to add that feature code to each template.

Now, think inside out and consider using partials like we do. about partials

Heres our layout. Template = layout/.default

```
<!DOCTYPE html>
<html lang="en">
    <head>
        <title>{exp:stash:head_title} - LocalYak</title>
        {sn_head}
        {gv_jquery}
        {exp:stash:head_links}
        {gv_google_analytics}
    </head>
    <body>
        {sn_body_top}
        <div id="main_bkgd">
            <div id="main" class="device_{ress} view_{view}">
                {exp:stash:content_above}
                <div id="content" class="{if ress > 1}rounded{/if} {exp:stash:get name='content_class'}">
                    {exp:stash:content}
                </div>
                {exp:stash:content_below}
            </div>
        </div>
        {sn_footer}
    </body>
</html>

```

And heres a (page) template that calls and uses that layout.

```
{embed="layout/.default"}
{exp:stash:set name='head_title'}Compare{/exp:stash:set}
{exp:stash:set name='head_links'}
    <link rel='stylesheet' type='text/css' media='screen' href="{stylesheet='advertise/.css_advertise'}" />
    <link rel='stylesheet' type='text/css' media='screen' href="{stylesheet='pages/.css_pages'}" />
    <meta name="description" content="LocalYak | Compare LocalYak advertising packages" />
{/exp:stash:set}
{exp:stash:set name='content_class'}tab-advertise outline{/exp:stash:set}
{exp:stash:set name='content'}
    <div class="page_select body_wrap">
        <h1>Compare packages</h1>
        [put your page content here.... or if you are forced to like we did on this occassion, create an extra embed]{embed="advertise/.select_type"}
    </div>
{/exp:stash:set}

```

And finally, you could then simply add this conditional to each template where you need dev to see a different layout

```
{embed="layout/.default{if group_id==123}_dev{/if}"}

```

Or, go one step further and put your view conditions (using if, not if:else) inside a snippet and use preload\_replace.

```
{embed="layout/.default{sn_view_switch}"}

```

And of course you would then need to create that extra .default\_dev layout. So, whats the benefit of doing it this way? Well, all your special dev view stuff could simply be added into template layout/.default\_dev. One spot, easy to maintain.

And if you need to show different content for the page, simply wrap using simple conditional like this

```
{if segment_3 == ""}
    {exp:stash:set name='content_class'}category splash{/exp:stash:set}
    {exp:stash:set name='content'}some content or tags{/exp:stash:set}
{/if}
{if segment_3 != ""}
    {exp:stash:set name='content_class'}category splash{/exp:stash:set}
    {exp:stash:set name='content'}some different content or tags{/exp:stash:set}
{/if}

```

Our site is mostly built on that one single default layout, however we do use a total of seven layouts.
> 2 votes

---
Tags: routing, versioning
---


title: Copee Pastee alternative?

text:
# Question
Title: Copee Pastee alternative?
Just wondering whether anyone has come across a replacement / fix for Copee Pastee which no longer appears to work in EE 2.7.

Any insights would be most welcome.

Cheers

Jim

# Answer
Jim Pannell and I worked out a solution, making Copee Pastee work in EE 2.7.

Add the following to /system/expressionengine/third\_party/copee\_pastee/ft.copee\_pastee.php, at line 77.

```
public function display_field($data)
{
    //nothing
}

```
> 4 votes

---
Tags: add-on, 2.7.0
---


title: Server upgrade PHP 5.4 - Any issues?

text:
# Question
Title: Server upgrade PHP 5.4 - Any issues?
I've just been emailed from my site host stating they will upgrade the servers to PHP 5.4.19.

We're hosting a number of sites with them and all range from EE2.2 - EE2.5.

The thing that sparked my interest, over and above due diligience, was these comments:

> * Safe mode is no longer supported. Any applications that rely on safe mode may need adjustment, in terms of security.
> * Magic quotes has been removed. Applications relying on this feature may need to be updated, to avoid security issues. get\_magic\_quotes\_gpc() and get\_magic\_quotes\_runtime() now always return FALSE. set\_magic\_quotes\_runtime() raises an E\_CORE\_ERROR level error.
> * The register\_globals and register\_long\_arrays php.ini directives have been removed.

Does anyone know if I should be on the look out for issues with the sites we're hosting here or should it be plain sailing ?

# Answer
I've EE site (from version 2.3 till 2.6.1) running on PHP5.4, no problem.

Francois
> 0 votes

# Answer
Those PHP features were deprecated long ago, EE core is certainly not using them. You may however run into issues with add-ons, especially on older sites running EE 2.2.

On your up to date versions though you should be fine. I know a large number of EE sites are using PHP 5.4 these days with no issues.
> 1 votes

---
Tags: ee2, php, server, v2.5.5
---


# Question
Title: displaying category tree accordion for 3 levels
I had a previous post here in which I was able to get a category tree working for 2 levels, however I'm having problems getting to work for a third level. I had edited the original post but never received an answer so that's why I'm creating a new question.

I'm trying to get an accordion menu to work with bootstrap and GWCODE Categories. The problem I'm having is determining when a category depth starts and ends so that I can open and close divs appropriately. I have 3 main categories, multiple 2nd level categories, and multiple 3rd level categories. Here's the code I have so far which I'm trying to get to work for the third level of categories:

```
{exp:gwcode_categories  style="linear" group_id="1" depth="1|2|3"}
{if depth1_start}
<div class="accordion-group">
    <div class="accordion-level1-header">
    <!-- LEVEL 1 CONTAINER -->
    <h3><a href="{site_url}index.php/{complete_path}">{cat_name}  »</a> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#{cat_url_title}-level2"><span class="glyphicon glyphicon-plus-sign pull-right"></span></a></h3>
    </div>
    {/if}
    {if depth2_start}
    <!-- LEVEL 2 CONTAINER -->
      <div id="{parent_url_title}-level2" class="accordion-level2 collapse">
    {/if}
      {if depth==2}
        <div class="level2-item"><a href="{site_url}index.php/{complete_path}">{cat_name}  »</a> <a data-toggle="collapse" data-parent="#accordion" href="#{cat_url_title}-level3"><span class="glyphicon glyphicon-plus-sign pull-right"></span></a></div>
      {/if}
        {if depth3_start}
        <!-- LEVEL 3 CONTAINER -->
          <div id="{parent_url_title}-level3" class="accordion-level3 collapse">
        {/if}
          {if depth==3}
            <div class="level3-item"><a href="{site_url}index.php/{complete_path}">{cat_name}  »</a></div>
          {/if}
      {if depth3_end}
        </div><!-- END OF LEVEL 3-->
      {/if}
    {if depth2_end}
      </div><!-- END OF LEVEL 2-->
    {/if}
{if depth1_end}

```

```
{/if}
{/exp:gwcode_categories}

```

The HTML that is output:

```
<!-- LEVEL 1 CONTAINER -->

<h3><a href="#">Data Solutions  »</a> <a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#data-solutions-level2"><span class="glyphicon glyphicon-plus-sign pull-right"></span></a></h3>
</div>
<!-- LEVEL 2 CONTAINER -->
<div id="data-solutions-level2" class="accordion-level2 collapse">
  <div class="level2-item"><a href="#/copper">Copper  »</a> <a data-toggle="collapse" data-parent="#accordion" href="#copper-level3"><span class="glyphicon glyphicon-plus-sign pull-right"></span></a></div>
  <!-- LEVEL 3 CONTAINER -->
  <div id="copper-level3" class="accordion-level3 collapse">
    <div class="level3-item"><a href="#/copper/copper-cable">Copper Cable  »</a></div>
    <div class="level3-item"><a href="#/copper/copper-connectivity">Copper Connectivity  »</a></div>
    <div class="level3-item"><a href="#/copper/plastics">Plastics  »</a></div>
  </div>
  <!-- END OF LEVEL 3-->
</div>
<!-- END OF LEVEL 2-->
<!-- LEVEL 2 CONTAINER -->
<div id="data-solutions-level2" class="accordion-level2 collapse">
  <div class="level2-item"><a href="#/fibre">Fibre  »</a> <a data-toggle="collapse" data-parent="#accordion" href="#fibre-level3"><span class="glyphicon glyphicon-plus-sign pull-right"></span></a></div>
  <!-- LEVEL 3 CONTAINER -->
  <div id="fibre-level3" class="accordion-level3 collapse">
    <div class="level3-item"><a href="#/fibre/fibre-cable">Fibre Cable  »</a></div>
    <div class="level3-item"><a href="#/fibre/fibre-connectivity">Fibre Connectivity  »</a></div>
  </div>
  <!-- END OF LEVEL 3-->
</div>
<!-- END OF LEVEL 2-->

```

# Answer
> 1 votes
Here is the approach i used for 2 levels. Id written my own plugin to generate required categories, so would work equally well with gw cats. I also cached the list for a day.

```
 {exp:stash:set_list name="cats_level1" parse_tags="yes" save="yes" scope="site" replace="yes" refresh="{sn_stash_refresh}" }
        {exp:my_plugin:get_cats level = "1"}
            {stash:cat1_name}{cat_name}{/stash:cat1_name}
            {stash:cat1_id}{cat_id}{/stash:cat1_id}
            {stash:cat1_url}{cat_url_title}{/stash:cat1_url}
            {stash:cat1_count}{cat_count}{/stash:cat1_count}
        {/exp:my_plugin:get_cats}
    {/exp:stash:set_list}

    {exp:stash:get_list name = "cats_level1"}
        {exp:stash:set_list name="cats_level2_{cat1_id}" parse_tags="yes" save="yes" scope="site" replace="yes" refresh="{sn_stash_refresh}" }
            {exp:my_plugin:get_cats level = "2" parent = "{cat1_id}"}
                {stash:cat2_name}{cat_name}{/stash:cat2_name}
                {stash:cat2_url}{cat_url_title}{/stash:cat2_url}
                {stash:cat2_count}{cat_count}{/stash:cat2_count}
            {/exp:my_plugin:get_cats}
        {/exp:stash:set_list}
    {/exp:stash:get_list}

```

You could then loop through depth 3 (just like depth 2 above) and create your lists for each depth 2 category.

And display like this. I used the params to divide the categories into columns. Three columns for desktop, two columns for mobile and tablets.

```
{exp:stash:set_list name="params" parse_conditionals = "yes"}
        {if ress == 3}
            {stash:param}limit = "1/3"{/stash:param}
            {stash:param}offset = "1/3"  limit = "1/3"{/stash:param}
            {stash:param}offset = "2/3"{/stash:param}
        {/if}
        {if ress < 3}
            {stash:param}limit = "1/2"{/stash:param}
            {stash:param}offset = "1/2"{/stash:param}
        {/if}
    {/exp:stash:set_list}

  {exp:stash:get_list name = "params"}
  <div class="category_wrap">
                        {exp:stash:get_list:nested  name="cats_level1" scope="site" {params}}
                            <div class="item_wrap category_item rounded">
                                <a href="#" class="toggle rounded_top_left" cat_1="{cat1_id}"><h2 id="cat_{cat1_id}">{cat1_name} <span>({cat1_count})</span></h2></a>
                                <div class="toggle_{cat1_id}" style="display:none;">
                                    <ul>
                                        <li><a href="{path='{segment_1}/category'}/{cat1_url}">All</a></li>
                                        {exp:stash:get_list:nested:inner name="cats_level2_{cat1_id}" scope="site"}
                                        <li><a href="{path='{segment_1}/category'}/{cat2_url}">{cat2_name} ({cat2_count})</a></li>
                                        {/exp:stash:get_list:nested:inner}
                                    </ul>
                                </div>
                            </div>
                        {/exp:stash:get_list:nested}

                    </div>
                {/exp:stash:get_list}

```

Your inner most get\_list will look like this

```
{exp:stash:get_list:nested:inner:innermost name="cats_level3_{cat2_id}" scope="site"}
<li><a href="{path='{segment_1}/category'}/{cat3_url}">{cat3_name} ({cat3_count})</a></li>
{/exp:stash:get_list:nested:inner:innermost}

```

Sorry for formatting, not so easy on ipad! Hope that gives you an approach. Code copied from live and edited a little, but not tested.

---
Tags: categories, gwcode-categories
---


title: Changes to entry creation in 2.7.0?

text:
# Question
Title: Changes to entry creation in 2.7.0?
I've upgraded to EE 2.7.0 from 2.5.5. I've now noticed a change in how form submissions are handled. In the past I could make a channel entry and then go back with the back button and save that entry again for a new post. This was very useful when making a lot of similar entries. However, this no longer works. If I go back after submitting an entry and then try resaving it, I am redirected to the CP home page.

Is this an intended change and if so is there any way to get back the previous behaviour, via add-ons or settings?

# Answer
> 5 votes
This is the Secure Forms feature doing its job - it's been around for a long time, but perhaps it has gotten more strict as of late.

You can disable it if it's really important to continue this workflow you've been using, but it will do so site-wide, and for front-end form submissions as well, just so you're aware.

---
Tags: 2.7.0
---


# Question
Title: Display "Chosen" Freeform Composer output in EE Template
I've got everything going smoothly with a single form–the composer, notification and template are all set. Works like a charm. In the template, I called the first form specifically as such:

```
{exp:freeform:composer
  form_name="volunteer_application"
  composer_template_name="some_template"
  return="/"
  }

```

However, I am unsure how to allow the template to grab the form\_name chosen in the EE admin–where it gives the user the option to "Choose a Freeform Composer Form to output."

Surely I don't need to create a different template for each form?

# Answer
> 1 votes
Are you saying you are using the channel field for Freeform composer? If so, all you need to do is display it like any other field in channel entries output: {my\_freeform\_field\_name}. The Composer template can be set in the upper left hand corner of Composer itself rather than needing it to be a param and your return can be pre-set in the composer template as an override param.

---
Tags: solspace-freeform
---


# Question
Title: Can't Acess the CP - Unable to load class jquery
Went to log into a local dev site tonight and suddenly get this error:

```
An Error was encountered
Unable to load the requested class: jquery

```

I have no idea what might have changed. I've replaced all of the files in the system folder, and have slowly gone back through the themes folder, replacing everything I could think of, and making sure that all of the add-ons were updated.

Currently running EE 2.6.1 with the master config in place. I enabled debug = 1 in the admin.php file but it doesn't show anything else. The front end of the site comes up as expected.

Anyone happen to see this before?

Todd

# Answer
Looks like it might be an issue with the native jQuery module. Those files are in /system/expressionengine/modules/. Replace those to be sure something didn't get accidently deleted.
> 1 votes

---
Tags: control-panel
---