# Question
Title: EE cookies add leading dot to domain name
Even though I add my domain name without the leading dot in the EE cookies admin panel, the cookies are still served with the leading dot attached. Because of this, they are sent to my subdomains. Any ideas?

# Answer
IMO, this can only be two things.

1. You don't have the cookie settings entered correctly in the control panel
2. You are overriding the CP settings in your config.php file
> 2 votes

---
Tags: ee2, cookies, static
---


title: Can you document EE tags with EE?

text:
# Question
Title: Can you document EE tags with EE?
I've run into this before - and have never found a 'great' solution. The crux of my problem is that I need to document some EE tags, using content in a channel entry.

For example, I'd like to output something like:

```

<pre><code>

{exp:someth:ing}

<code><pre>

```

The issue is, that of course, EE htmlentifies the curly brackets, so what I end up with is:

```

<pre><code>

{exp:someth:ing}

<code><pre>

```

I've tried using CE Str (awesome plugin by the way) to decode these html entities, which it does - flawlessly. However, at that point, due to what I'm assuming is a parse order issue - EE then tries to process those tags rather than just outputting them.

In the past, the only solution I have found required including PHP in my templates which is not really an option anymore. I've tried knocking out a quick plugin - but have had no luck.

Any ideas would be wildly appreciated.

I'm hoping there is some magic addon like:

```

{exp:donot:parsetags}
   ...
{/exp:donot:parsetags}

```

But so far, I cannot find it - and maybe I am just searching for the wrong keywords.

MW

# Answer
> 1 votes
I just saw your question, and decided to release an add-on I wrote a few years ago for my own documentation: CE Highlight.

The add-on has the ability to optionally style the output, use line numbers, highlight specific lines, and a few other things. It leverages Geshi for the heavy lifting. I hope that helps!

# Answer
> 4 votes
You can wrap your code in `[code]{ee_tag_here}[/code]` and that should output `<code>{ee_tag_here}</code>` into your template.

# Answer
> 1 votes
I think you can try Template Code from Rob Sanchez for this. Not sure if it still works with latest EE versions, but you might be able to update it.

https://github.com/rsanchez/template\_code

---
Tags: tags, parse-order, parse
---


# Question
Title: Possible to send member account validation notification email via Profile:Edit?
I've got an EE 2.5.0 site that is using Profile:Edit 1.0.9. I've got member activation set to Manual activation by an Administrator. I can activate the Pending members via the control panel and it sends a default EE email notification fine (the Member Account Validation Notification email, saying that their account has now been activated).

Is it possible to trigger that email notification via the front end using the exp:profile:edit form? I can change a member's group so they change from Pending to another member group, but no emails are sent. Or if not, how else can I trigger an email without going into the backend CMS? Thanks.

Here's my code:

```
{exp:profile:edit include_jquery="no" datepicker="no" return="/extranet" member_id="{segment_4}"}

  <p><label>First name</label></p>
  <p><input name="cf_profile_first_name" placeholder="First Name" type="text" value="{cf_profile_first_name}" /></p>

  <p><label>Last name</label></p>
  <p><input name="cf_profile_last_name" placeholder="Last Name" type="text" value="{cf_profile_last_name}" /></p>

  <p><label>Email</label></p>
  <p><input name="email" placeholder="Email" type="text" value="{email}" /></p>

  <p><label>Member Group</label></p>
  {exp:profile:member_group_select}
    <option value="{option_value}"{if selected} selected="selected"{/if}>{option_name}</option>
  {/exp:profile:member_group_select}

  <input type="submit" value="Approve login request »"  />

{/exp:profile:edit}

```

# Answer
You can definitely use Postmaster for this. You can use Postmaster to send emails for just about anything. Postmaste does a lot more than MX Notify Control, since Postmaster can be extended and passes a lot more variables to the templates, and can perform any amount of custom logic needed should you create your own hooks.

I have attached a screenshot of the available hooks. These hooks are the existing PHP classes included with Postmaster that extend the EE hooks to pass custom variables when specific hooks are triggered. If the desired hook doesn't exist and you need to pass custom variables to the template, you can use the Hook API.

Here is the reference for the Profile:Edit Edit Profile Hook

*On a side note, I just noticed that the User Defined Hook appears twice in the list. This is a bug, I will fix it for the next maintenance release.*
> 1 votes

# Answer
There isn't a great way to do this from the front end with Manual member activation, I think, because changing the member group doesn't actually trigger the hook needed (cp\_members\_validate\_members) to send the email the cp normally sends.

However, if P:E will allow you to register the new members and change their group, thus creating their entries within your established profiles channel, you may be able to use MX Notify to send a custom email based on the creation of said new entry(ies). I'm not sure it'll be able to get to the email addresses though, but there might be a way to work it out.
> 1 votes

---
Tags: email, profile-edit
---


# Question
Title: Assets 2 MSM Cannot Upload or view images
I have a multisite installation of EE 2.5.5 and Assets 2.0.3.

The issue I am running into is that if I log into Site 1 at url.com/admin.php and navigate to the Assets module I can see all my Site 1 images. If I switch to Site 2 using the top right navigation none of the images for Site 2 load. I have verified all the config/file upload settings and everything is correct.

I also cannot index anything from within Site 2, only within Site 1.

I can log into Site 2 and site2url.com/admin.php and the images will show up.

This seems to defeate the MSM system a bit because our client has to log into both site admin sections in order to view files.

From my understanding this ins't correct and I should be able to see the files on both sites by logging into Site 1.

is this a bug or am I missing a config somewhere?

Thanks,

Kevin

# Answer
Kevin - first thing, please update Assets to 2.0.5. Second, can you try adding this to your /system/expressionengine/config/config.php please?

$config\['assets\_site\_url'\] = '/index.php';

Please let me know if either or both of those get you up and running!

Thank you.
> 2 votes

---
Tags: multi-site-manager, pixelandtonic, assets
---


# Question
Title: Trying to pass a Stash variable to a Playa tag
I want to pass the "series\_entry\_id" created in the exp:playa:parents tag as the parent\_id of the exp:playa:siblings tag, but it is not parsing the "series\_entry\_id". I am not sure if there is a better, more efficient way of doing this. Any help is greatly appreciated.

```
{exp:stash:set_list
    name="sermon"
    parse_tags="yes"
    parse_depth="2"
    parse_conditionals="yes"
}

    {exp:channel:entries
        channel="media"
        dynamic="no"
        disable="categories|category_fields|member_data"
        orderby="date"
        url_title="{segment_3}"
        limit="1"
    }

        {stash:entry_id}{entry_id}{/stash:entry_id}
        {stash:title}{title}{/stash:title}
        {stash:url_title}{url_title}{/stash:url_title}
        {stash:speaker}{speaker}{/stash:speaker}
        {stash:description}{description}{/stash:description}
        {stash:vimeo_id}{vimeo_id}{/stash:vimeo_id}
        {stash:message_number}{message_number}{/stash:message_number}
        {stash:transcript_file}{transcript_file}{/stash:transcript_file}
        {stash:transcript_embed}{transcript_embed}{/stash:transcript_embed}
        {stash:entry_date}{entry_date}{/stash:entry_date}

        {!-- Get Series Data --}
        {exp:playa:parents channel="sermon_series" limit="1"}
            {stash:series_entry_id}{entry_id}{/stash:series_entry_id}
            {stash:series_title}{title}{/stash:series_title}
            {stash:series_url_title}{url_title}{/stash:series_url_title}
            {stash:series_graphic}{series_graphic}{/stash:series_graphic}
        {/exp:playa:parents}

        {!-- Get Series Siblings --}
        {exp:stash:set_list:nested
            name="siblings"
            parse_tags="yes"
        }

            {exp:playa:siblings entry_id="{entry_id}" parent_id="{series_entry_id}"}
                {stash:sibling_url_title}{url_title}{/stash:sibling_url_title}
                {stash:sibling_title}{title}{/stash:sibling_title}
                {stash:sibling_entry_date}{entry_date}{/stash:sibling_entry_date}
            {/exp:playa:siblings}

        {/exp:stash:set_list:nested}

    {/exp:channel:entries}

{/exp:stash:set_list}

```

# Answer
> 2 votes
The `series_entry_id` variable is not defined at the point you're calling it. Try simplifying by avoiding the nesting. The siblings tag doesn't need to be inside the channel entries tag since you have already stashed the `entry_id` and can use that outside the loop. (Alternatively you might be able to get a quick win with a few well-placed `parse="inward"` parameters, but personally I find them to be too black-magicky). Something like this perhaps:

```
{exp:stash:set_list
 name="sermon"
 parse_tags="yes"
 parse_depth="2"
 parse_conditionals="yes"
}
  {exp:channel:entries
    channel="media"
    dynamic="no"
    disable="categories|category_fields|member_data"
    orderby="date"
    url_title="{segment_3}"
    limit="1"
  }
    {stash:entry_id}{entry_id}{/stash:entry_id}
    {stash:title}{title}{/stash:title}
    {stash:url_title}{url_title}{/stash:url_title}
    {stash:speaker}{speaker}{/stash:speaker}
    {stash:description}{description}{/stash:description}
    {stash:vimeo_id}{vimeo_id}{/stash:vimeo_id}
    {stash:message_number}{message_number}{/stash:message_number}
    {stash:transcript_file}{transcript_file}{/stash:transcript_file}
    {stash:transcript_embed}{transcript_embed}{/stash:transcript_embed}
    {stash:entry_date}{entry_date}{/stash:entry_date}

    {!-- Get Series Data --}
    {exp:playa:parents channel="sermon_series" limit="1"}
        {stash:series_entry_id}{entry_id}{/stash:series_entry_id}
        {stash:series_title}{title}{/stash:series_title}
        {stash:series_url_title}{url_title}{/stash:series_url_title}
        {stash:series_graphic}{series_graphic}{/stash:series_graphic}
    {/exp:playa:parents}

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

{exp:stash:get_list name="sermon"}
    {!-- Get Series Siblings --}
    {exp:stash:set_list
        name="siblings"
        parse_tags="yes"
    }
        {exp:playa:siblings entry_id="{entry_id}" parent_id="{series_entry_id}"}
            {stash:sibling_url_title}{url_title}{/stash:sibling_url_title}
            {stash:sibling_title}{title}{/stash:sibling_title}
            {stash:sibling_entry_date}{entry_date}{/stash:sibling_entry_date}
        {/exp:playa:siblings}

    {/exp:stash:set_list}
{/exp:stash:get_list}

```

# Answer
> 0 votes
I'm not certain, but maybe try a higher `parse_depth` on your very first `{stash:set_list}` tag. Try `parse_depth=3` or `parse_depth=4` maybe?

```
{exp:stash:set_list
  name="sermon"
  parse_tags="yes"
  parse_depth="4"
  parse_conditionals="yes"
}

```

I find I typically have to bump up the `parse_depth` if I'm using a Playa tag in a `channel:entries` tag in Stash.

---
Tags: playa, stash
---


title: CartThrob Pricing Modifier question

text:
# Question
Title: CartThrob Pricing Modifier question
I'm trying to create a quantity field next to each one of my pricing modifier items, but none of them are coming up in the debug info. What in the world might I be doing wrong here?

Any help would be REALLY appreciated.

THANKS!

```
{exp:cartthrob:add_to_cart_form return="tours/cart"
                            entry_id="{entry_id}"
                            return="tours/cart"
                    }
                    {exp:cartthrob:item_options entry_id="{entry_id}"}
                        {tour_options}
                            <input type="input" name="quantity" size="3" value=""> {option_name} {price}<br />
                        {/tour_options}

                            <input type="hidden" name="item_options[tour_options]" value="{option_value}">
                     {/exp:cartthrob:item_options}

                        <input type="submit" name="submit" value="Add Tour to Cart">

                     {/exp:cartthrob:add_to_cart_form}

```

# Answer
> 1 votes
Try changing {tour\_options} to simply {options} -- it's should loop through using CartThrob's options loop, not your custom field name's loop.

As for the $5, that's possibly due to a global shipping setting. Check your CT shipping settings and see if $5 is being added there.

Otherwise, it might also be a global tax thing possibly as well.

Does that help?

---
Tags: cartthrob
---


title: Accepting Donations Economically

text:
# Question
Title: Accepting Donations Economically
I am setting up an EE website for a non-profit start-up, but the budget is extremely limited. Donations would include one-time payment, recurring payments, and purchasing bracelets, etc.

I would like the process of donations to be as painless as possible and ideally all on my site (without having to be redirected back and forth), but I am not a fan of PayPal. I have heard/seen that Stripe seems to be a good service with fair rates, but without spending hundreds of dollars, I don't see many options for using something other than PayPal.

I am a developer myself and would be willing to get into the weeds to customize the simple commerce module, but wouldn't even know where to start since this is my first EE site.

Is there a way for me to achieve using a different payment gateway for the simple commerce and a custom donation form without spending much, ideally any, money?

# Answer
I'd say this should be a case of thinking about what's good for your client, rather than what services you don't like. But also, you may need to know more about the client's online donations. Do they get lots of online donations with a mix of big and small options? Do they get little online donations but of larger values? Do they just get a small amount of donations at small amounts? Are they actually processing no online donations but want to improve their transaction rates?

There are a number of services, and you don't need to process things through Simple Commerce. You could start with the easy services like Network for Good, JustGive, Razoo. These are services built for accepting nonprofit donations. You'd just need to create a landing page in ExpressionEngine that takes the user to the selected service.

Amazon Simple Pay Donations and Google Checkout will also process donations.

Simple Commerce only needs to be part of the process, if you are trying to store transactional history with ExpressionEngine. There are other methods for doing that as well, for example if create an email account for transaction confirmation emails. You can set-up EE to bring those emails into EE for creating a log as well.

Generally speaking, if the nonprofit just wants to accept donations online, doesn't a get a lot of donations (historically), and doesn't get frequent large donation amounts (say over $5,000), then going with a donation service like Network for Good, JustGive, Razoo, etc. isn't a bad option. Obviously, you'd want to tell the user about the 3rd-party site, but many donors are familiar with the three listed.

PayPal, Amazon, and Google Checkout work well for mixed transactions. Donations, bracelet sales, etc. The transaction rates for nonprofits (after qualified) are low. PayPal is simple and easy to use, and typically not problematic for thousands and thousands of nonprofits. If the nonprofit occasionally processes very large donations online (single transaction of $5k, $10k or more), then that needs to be consider, but it provides the least friction for the potential donor.

Amazon services is also good, just like PayPal tons of folks on the internet have Amazon accounts, and using their service to process donations can work. I'm not certain if they allow reoccurring donations (you'd need to check). Personally not a fan of Google Checkout/Wallet mix, but it's viable, not as frequently used, so could halt some donations in their track. You're always looking for that mix of viable, low transaction fees, donor doesn't hesitate to use with nonprofits.

Simple Commerce is the easiest option for tracking both the sales and the donations (I believe you can do like Store for donation, set an item for $1, then use the quantity field to set donation amount 50 items = $50 donation). If the nonprofit really wants more payment gateway options, then I'd look at Store by Exp:resso. They'd have to pay for it, but it pays for itself pretty quickly, if they're handling regular transactions or if you design donation pages that increase their transactions.
> 2 votes

# Answer
@Benny - as the client is on a tight budget, you're working for free, and they don't yet know how much in donations they are likely to receive, I'd suggest looking at the direct payment methods offers by nonprofit\_tech (Paypal, Amazon, Google).

These are easy to set up and can get your client up and running quickly. Let it run for a while and monitor the clients income, ,if to see if there are finances (or your time) available at a later date, you can look at enhancing things.
> 0 votes

---
Tags: ecommerce, payment-gateway
---


# Question
Title: Pagination on template that is same as directory name and index.php removal
I have a template that is same that directory name (namely, 'video'). Both template and files in directory are linked thoughout the site, so they cannot be removed.

I'm trying to remove index.php from all links, but the recommended method does not work in this particular case.

I've added following lines to my .htaccess, that makes the template 'main' page to be displayed correctly, but the pagination links still do not work. I'm getting 404 returned by server, not EE. I.e /video/ works, but /video/P10 does not.

```
RewriteCond %{REQUEST_URI} !^video$ [NC]
RewriteCond $1 !\.(css|js|gif|jpe?g|png|pdf|swf|flv|avi|mpe?g) [NC]
RewriteRule ^video(.*)$  index.php/video$1 [L]

```

Can anyone give me advice on what directive do I have to add to .htaccess so that /video/ and /video/P10 would be correctly served by EE, but /video/some\_file.avi would be served by file system?

# Answer
> 1 votes
Have you tried the paginate\_base parameter? - http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#paginate-base

```
paginate_base="/"

```

may work?

---
Tags: .htaccess
---


title: {count} is not working

text:
# Question
Title: {count} is not working
The {count} variable is completely not working in my entries. It is just returning 1.

The last thing we installed for plugins was the structure\_url\_alias module.

Is this a known ee bug?

Here is the requested code. It was working right before we installed structure\_url\_alais. We have over 100 aliases now running so we are hesitant to uninstall the module and see if it is the reason {count} stopped working.

```
{exp:channel:entries channel="news" limit="6" category="not 20"}
{if count < 4}
Count {count}
<div class="content_{count}">
<div class="date date_1">
<h4 align="center" style="margin-top:16px">
<span class="month">{entry_date format="%M"}</span>
<span class="day">{entry_date format="%d"}</span>
</h4>
</div>
<div class="text_1">
<h3 style="margin-left:13px;">
<a href="{page_url}">{title}</a>
</h3>
{exp:char_limit total="160"}
{news_excerpt}
{/exp:char_limit}
</div>
</div>
<!-- News and Events End -->
{if:else}
{if count==4}
<!-- Older News Articles -->
<h1 style="margin-top:10px; margin-bottom:1px;">OLDER NEWS:</h1>
<div class="news_box" style="padding-top:5px;">{/if}
<div class="news_{count}">
<h6>
<a href="{page_url}">{title}</a>
</h6>
<div class="excerpt">
<span class="date">{entry_date format="%M. %d"} - </span> {exp:char_limit total="200"}{news_excerpt}{/exp:char_limit}
</div>
</div>
<!-- Older News Articles End -->
{if count == total_results}</div>{/if}
{/if}
{/exp:channel:entries}

```

Edit....

We narrowed the problem down to the structure alais plugin, but we don't want to uninstall it to see for sure because we already have over 100 alaises set up. Any suggestions?

# Answer
Just confirm that the Structure URL Alias break the native EE Tags. Structure URL Alias v1.3.1 fix this problem.

Can you download the latest version and test it, there are no databases changes, just code changes.

http://devot-ee.com/add-ons/structure-url-alias

Please let me know if there are any troubles.
> 1 votes

# Answer
I can't see why {count} isn't working but there is something that's wrong:

```
{if:else}
{if count==4}
{/if}

```

This should be:

`{if:elseif count == 4}<-- Code Here -->{/if}` or `{if:else}<-- Code here -->{/if}`
> 0 votes

# Answer
Try writing the conditional like this:

```
{if "{count}" == "4"}

```
> 0 votes

# Answer
It sounds like there is an outer module tag being parsed first — with a {count} variable equal to 1. (So, the inner Channel Entries tag doesn't ever have a chance to parse its own {count} variables, because all it sees is "1" in the tagdata.)

It would be easier to help you troubleshoot if you could post enough of your template that we could see the opening and closing of all EE tags...
> 0 votes

---
Tags: channel-entries, channel, structure, categories
---


title: Cross-Referenced Relationships

text:
# Question
Title: Cross-Referenced Relationships
While I wait for Playa to be approved for use in my project, I've put together this structure to enable cross-referencing:

3 Channels:

1. products
2. all\_colors
3. product\_colors

The all\_colors channel just has a file fieldtype set for images.

The product\_colors channel just has 2 relationship fields: related\_products and related\_colors. So, for each product (products), we want to be able to select a number of colors (all\_colors), and we do that through the cross-reference (product\_colors).

Here's my template:

```
{exp:channel:entries channel="products" limit="1" }
<div id="hero"><img src="{hero_image}" /></div>
{embed='includes/topnav'}
{if no_results}
<p>Unknown product.</p>
{/if}
<div id="prodinfo">
    <h1>{title}</h1>

    <div id="description" class="desc">{product_description}</div>
    <div id="productcolors">
    <ul id="prodcolors">
        {reverse_related_entries channel="product_colors"}
        <li>
            Related Product: {related_product}<br>
            Related Color: {related_color}
        </li>
        {related_entries id="related_color"}
        <li><img src="{color_swatch}" /></li>
        {/related_entries}
        {/reverse_related_entries}
    </ul>
    </div>

</div> <!-- END #prodinfo -->
{/exp:channel:entries}

```

And here's the output:

```
Related Product: 19
Related Color:
{REL[20][related_color]jPUgzXDsREL}
Related Product: 17
Related Color:
{REL[18][related_color]jPUgzXDsREL}

```

The first LI is just for debugging purposes. The funky looking token in the curly braces changes on every request. I've no idea where it comes from. The template doesn't even produce my img tag, or the second LI, for that matter.

\[EDIT\] Why is the Related Color coming out empty? \[/EDIT\]

What am I doing wrong? Can this even be done with EE out-of-the-box?

Thank you.

# Answer
> 1 votes
> Why is the Related Color coming out empty?

Because when a Relationship field is used as a single tag (`{related_color}`), it doesn't know what to output (as its just a pointer to another entry). Relationships fields can *only* be output using the `{related_entries id="field_name"}` tag pair.

What you're getting in your output is the cached relationship data stored in the field, which is only properly decoded when you use the `{related_entries}` tag pair.

Also, `related_entries` tags cannot be used inside `reverse_related_entries` tags.

For now, James' answer of using an embed is the way to go if you have to stay native to EE.

# Answer
> 1 votes
Doing this without Playa will be a world of pain. Without it I think there are two ways:

First, (and this is really bad for performance, but here it is anyway)... using an embedded template in place of the `related_entries` tag:

```
    ...
    <ul id="prodcolors">
      {reverse_related_entries channel="product_colors"}
        <li>
            Related Product: {related_product}<br>
            Related Color: {related_color}
        </li>
        {embed="related-color" entry_id="{entry_id}"}
      {/reverse_related_entries}
    </ul>

```

Embedded 'related-color' template:

```
{exp:channel:entries entry_id="{embed:entry_id}" dynamic="no"}
   {related_entries id="related_color"}
     <li><img src="{color_swatch}" /></li>
   {/related_entries}
{/exp:channel:entries}

```

The second way would be to do some gymnastics with Stash to avoid calling the embed per-entry. I tried to come up with a working example of that, but it's really complicated - you're much better off just getting Playa! (Writing a custom plugin would be simpler than what you'd need to do with Stash here).

---
Tags: templates, relationships
---


title: Cartthrob 2 / Moneris Payment Gateway

text:
# Question
Title: Cartthrob 2 / Moneris Payment Gateway
Is there a difference in US based Moneris accounts and CA based Moneris accounts in terms of API integration / payment gateway plugin usage.

Client has a US-based account, but my developer cannot get it to work with the current plugin (which, according to Moneris, appear to be trying to access the CA-based API).

Any thoughts?

Sam

# Answer
There are two API's for Moneris: one for the Canada payment gateway and one for the USA payment gateway.

#1. To use the USA gateway you will need to first download the Moneris USA API.

> Both the USA API and Canada API can be downloaded from http://developer.moneris.com (free registration required)

#2. Once you have the USA API you then need to make some minor changes to your code so that it works with the USA API. Refer to the sample code that comes with the USA API in order to identify the exact changes that you need to make.

> Here's an example change that you need to make if you do purchase transactions: change the transaction type from purchase to us\_purchase.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Console Error with Assets when Attempting to Index Amazon S3 folder
When I attempt to Index an Amazon S3 folder, I was getting no response. I get the bar, but no progress.

Everything works fine when I'm indexing a local folder.

So I tried doing it with the Console on while in Firefox and got the following error:

```
SyntaxError: missing ) in parenthetical @
{my site name}/themes/third_party/assets/scripts/assets.min.js?2.0.5:11

```

Safari gives a similar error:

```
SyntaxError: Expected token ')'

```

I'm using Assets 2.0.5 on EE 2.5.5

If you need other details to diagnose, let me know...

Edited to add:

Ran it in the Firebug console - Syntax Error appears to be related to a memory problem:

```
Fatal error: Allowed memory size of 67108864 bytes exhausted (trie

assets.js?2.0.5 (line 5618, col 6)

```

# Answer
OK. I found the answer to my own problem. I was storing three years worth of Logs in my Amazon S3 folder which made an insane number of files for Assets to index, causing the memory error.

So if you turn on Logging for Amazon S3, don't keep the logs in the same bucket that you keep your... ahem... assets. Keep the logs in a separate log-only bucket that you don't hook up with Assets.
> 2 votes

# Answer
that's really odd.

You can either try re-uploading that file (because it kind of seems that it wasn't uploaded correctly), or you can try adding this line to your ExpressionEngine config: $config\['assets\_use\_uncompressed\_js'\] = TRUE;

Cheers, Andris
> 1 votes

---
Tags: assets
---


title: Get array of entries based of catagory

text:
# Question
Title: Get array of entries based of catagory
I'd like to start editing a template, the template uses php to create an array. Is their documentation about how to only get an array for a certain category? Or are they channels? Sorry.

I can't modify the code too much, but simply need to get the entries from an archive category / channel.

```
    <h2><span>Selected Projects</span></h2>
  <ul id="project_list">
  <?php foreach ($entries_query->result_array() as $entry): ?>  <li>
      <h3><a href="/projects/<?= $entry['url_title'] ?>/"><?= $entry['title'] ?></a></h3>
      <?php if ($entry['rollover_image']): ?>
        {exp:imgsizer:size image="<?= str_replace('{filedir_1}', '/images/projects/', $entry['rollover_image']) ?>" width="320" alt="" quality="90"}
      <?php else: ?>
        {exp:imgsizer:size image="<?= $images[$entry['entry_id']] ?>" width="320" alt="" quality="90"}
      <?php endif; ?>
      <ul><?php
        foreach ($categories_query->result_array() as $cat):
          if ($cat['entry_id'] == $entry['entry_id']) {
            echo '<li><span class="'.$cat['cat_url_title'].'">'.$cat['name'].'</span></li>';
          }
        endforeach;
      ?></ul>
    </li>
  <?php endforeach; ?>

```

Thanks for any help.

# Answer
> 2 votes
Instead of using the PHP code for populating the entries of category/categories, you should use the channel entry tag like:

```
{exp:channel:entries channel="CHANNEL_NAME" category="CATEGORY_ID"}
    <P>{title}</P>
{/exp:channel:entries}

```

take a reference from here to get list of all the parameters and variables to be used with channel entry tag.

http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html

---
Tags: categories, channel, php
---


# Question
Title: Channel:categories of entries that have category from different category group
**What we are trying to do:**
I am using three category-groups, "product category", brands and country of origin, to create a navigation in a shop with the ability to filter the content of each product category with a specific brand or country.

The product category group is used to generate the main navigation and when a category is selected a listing-page is displayed with the entries of that category.

The display page in turn shows a "sub-nav" of the different brands and countries of origins.

**Structure of the product category group:**

```
Main category 1
    sub-category 1
    sub-category 2
Main category 2
    sub-category 3

```

When i pick a sub-category my url looks like this:

```
domain.com/products/[sub-category]

```

This page should show all products in this category and possible 3rd levels of product groups in the top and then brands and countries in a sub-nav.

It should look a little like this:

```
3rd lvl sub-category
-
Brands
    Brand 2
    Brand 5
Countries of origin
    Country 1
    Country 3

```

Where Brand 1/3/4 and Country 2 are not shown since no product with the \[sub-category\] has them selected.

When i select a brand or country that segment is added to the url and {segment\_category\_ids} gives me all the matched categories for use in the {exp:channel:entries} tag.

**This is where i am having some problems..**
I cant get my head around how to display only the brands and countries that have entries in the already selected \[sub-category\].

By default it displays every category that is used by any entry in the products channel. We haven't used categories all that much so i am not sure that i am going at it the right way.

I have tried to create a list of all the entry\_id's from the subset and use those pipe-separated in the show-parameter of the {exp:channel:categories} tag-pair but i haven't gotten it to work yet.

We have mostly been using Playa for relations between different entries and "pages" before but i thought i could be good to get a grip on how to do it natively.

Does anyone have a better approach or any ideas on what i should do?

# Answer
> 2 votes
I don't think you can achieve this result with pure EE,but if you don't mind using some php, you could do something along these lines:

This runs through you entries ( it's a dynamic ee tag, so if your product category is defined in the url, it should only show the entries in that category ) and adds their categories to an array in PHP.

```
<?php $categories = array(); $i = 0; ?>
{exp:channel:entries channel="products"}
    {categories}
       <?php
           if(!in_array("{category_url_title}", $categories)){
               $categories[$i][0] = "{category_id}";
               $categories[$i][1] = "{category_name}";
               $categories[$i][2] = "{category_url_title}";
               $i++;
           }
       ?>
    {/categories}
{/exp:channel:entries}

```

You can use this PHP array to output the categories. This array should only contain the categories that have entries which are in the product-category of the page you're on.

It might very well be that there's a much easier, and especially cleaner, way to achieve this result though.. but it should work. :)

# Answer
> 2 votes
We handle this by placing the categories in the URL as segments (example.com/store/category\_foo/category\_bar), and use the seg2cat add-on, which will give you a {segment\_category\_ids} variable, which can be used like this:

{exp:channel:entries category="{segment\_category\_ids}" dynamic="no"}

This will give you the ability to handle multiple category id's in the URL, which I believe might be part of the problem you're trying to solve.

# Answer
> 0 votes
So my approach to this sort of thing is to use Low's seg2cat extension. As the name suggests, this lets you get from a url segment to a category\_id/name etc.

Hence if your URL is `http://example.com/fruit/apples`, then `{segment_2_category_id}` will be the category\_id of your "fruit" category.

You can then push this into your `channel:entries` tag:

```
{exp:channel:entries
  channel="brands"
  category="{segment_2_category_id}"
  dynamic="no"
}
  <li>{title}</li>
{/exp:channel:entries}

```

**Extra tip:** If you need this to work with a fallback category (when no cat in the URL) you can take advantage of the parse order and the way `preload_replace` works to do something like this:

```
{if segment_2_category_id}
  {preload_replace:pre_current_category="{segment_2_category_id}"}
{/if}
{preload_replace:pre_current_category="n"}

{exp:channel:entries
  channel="brands"
  category="{pre_current_cat}"
  dynamic="no"
}
  <li>{title}</li>
{/exp:channel:entries}

```

As attempts to redefine a `preload_replace` are ignored and the first value used, and simple conditionals are parsed **before** `preload_replace`s.

# Answer
> 0 votes
It looks like you've got your navigation working how you want but it's displaying categories and sub-categories that's the problem? GWCode Categories Addon: http://gwcode.com/add-ons/gwcode-categories is excellent for going through a hierarchy of categories.

I'm struggling a bit with your question. With your actual category groups and an example layout I'd be able to offer some code as well.

# Answer
> 0 votes
Kim,

Can you share your PHP solution with me that apparently solved your issue\> I'm running into a similar situation with multiple categories to filter on. I'm a PHP newbe....

---
Tags: categories
---


# Question
Title: Stashing a structure variable and using it as a channel parameter
Here's the code i'm essentially trying to achieve

```
{exp:stash:set="page_content"}
    {exp:channel:entries channel="photos" dynamaic="off" entry_id="{structure:child_ids_for:1}"}
        {!-- My Code --}
    {/exp:channel:entries}
{/exp:stash:set}

```

This is my first problem `{structure:child_ids_for:1}` is unable to output as a channel parmater. I tried to stash that structure variable, I tried it as a snippet and no luck with both. I'm also using template partials so that's why `page_content` is being set.

This following code works with static values but not the `{structure:child_ids_for:1}` tag in the stash set.

```
Works:        {exp:stash:set name="photo_child_ids"}2|3|4{/exp:stash:set}
Doesn't Work: {exp:stash:set name="photo_child_ids"}{structure:child_ids_for:1}{/exp:stash:set}

```

**Template Code**

```
{exp:stash:set="page_content"}
    {exp:stash:parse process="end"}
        {exp:channel:entries channel="photos" parse="inward" dynamaic="off" entry_id="{stash:photo_child_ids}"}
            {!-- EE Code --}
        {/exp:channel:entries}
    {/exp:stash:parse}
{/exp:stash:set}

```

Any Ideas?

---

**EDIT: Thanks for the answers. The solution is below.**

**This stashes the structure child ID tag**

```
{exp:stash:set name="photo_child_ids" process="end" parse_tags="yes"}{structure:child_ids_for:1}{/exp:stash:set}

```

**This code gets that photo\_child\_ids stash variable and sets it as a parameter**

```
{exp:stash:set name="page_content"}
    {exp:stash:parse process="end"}
        {exp:channel:entries channel="photos" parse="inward" dynamic="off" entry_id="{stash:photo_child_ids}"}
            {!-- My Code --}
        {/exp:channel:entries}
    {/exp:stash:parse}
{/exp:stash:set}

```

# Answer
First, **dynamic** is misspelled.

Second, Try to add parse\_tags="yes" to the stash set.

```
{exp:stash:set="page_content" parse_tags="yes"}
    {exp:channel:entries channel="photos" dynamic="off" entry_id="{structure:child_ids_for:1}" parse="inward"}
         {!-- My Code --}
    {/exp:channel:entries}
{/exp:stash:set}

```

The parse\_tags="yes" tells stash to parse whatever tags are inside rather than simply stashing the code as text.
> 1 votes

# Answer
Put the channel entry tags within an embedded template and pass the structure value as embed parameter as

```
{exp:stash:set="page_content"}
{embed="temp_grp/temp_name" entry_ids="{structure:child_ids_for:1}"}
{/exp:stash:set}

```

within "temp\_grp/temp\_name"

```
{exp:channel:entries channel="photos" dynamic="no" entry_id="{embed:entry_ids}" parse="inward"}
{!-- My Code --}
{/exp:channel:entries}

```

I hope, it would help you.
> 0 votes

---
Tags: templates, stash, structure, parse-order
---


# Question
Title: How to inject inline HTML tags into the "Title" field
**I'm in need of a solution to have this output:**

```
<h1>My Title <sup>®</sup></h1>

```

**And in my template I have this:**

```
<h1>{title}</h1>

```

I was thinking that I could search for all `&regs;` within an `h1` then wrap it with the `®` with the `<sup>` tag using jQuery.

Maybe i'm looking for something to not strip HTML from the title tag? Does anyone have any other solutions?

# Answer
The Low Replace plugin is ideal for this.

If your title field contains `My Title ®` then in your template you can do...

```
{exp:low_replace find="®" replace="<sup>®</sup>"}{title}{/exp:low_replace}

```

...which will output `My Title <sup>®</sup>` as you wanted.
> 4 votes

# Answer
Unless I am misunderstanding something, you should be able to easily do it like so

```
<h1>{title} <sup>®</sup></h1>

```

Or, if you want to keep your HTML clean, use the :after pseudo-class in your CSS?
> 0 votes

# Answer
It looks like EE has replaced the character entity with the actual character by the time it outputs the `{title}`. So you'd have to search for the character rather than the entity.

The jQuery to do what you want would be:

```
var title = $('h1');
title.html(title.text().split('®').join('<sup>®</sup>'));

```

That would find all instances of the ® character in your h1 and wrap them in `sup` tags.

If you didn't want to use Javascript you could do it with PHP and a plugin. Let me know if you'd like to go down that route.
> 0 votes

---
Tags: templates, html
---


title: How to Display an Entry's Category?

text:
# Question
Title: How to Display an Entry's Category?
I'm on a single product entry page. The URL does not specify the category. In fact, the entry has 3 category groups associated with it. I want to display the first category assigned from each of the category groups.

Here's the code I have so far:

```
{exp:channel:entries channel="products" limit="1" }
<div id="prodinfo">
    <h1>{title}</h1>

    {exp:channel:categories category_group="4" note="vehicle type"}
    {category_name}
    {/exp:channel:categories}

</div> <!-- END #prodinfo -->
{/exp:channel:entries}

```

This is displaying all the categories in the group. I've also tried using the {if active} conditional variable, but as it relies on the URI, it's not working for me.

Thanks for your help.

# Answer
I think you're trying to use the wrong tag here.

That exp:channel:categories tag is for when you want to display a list of all the categories on your site - and possibly link to those "category listing" pages.

Here's how I display an individual entry's category:

```
{exp:channel:entries channel="spc-content" limit="1" rdf="off" show_future_entries="no" status="open|Featured" require_entry="yes"}
<h1>{title}</h1>
{categories}<a href="{path=obsessive/compulsions}">{category_name}</a> {/categories}
{/exp:channel:entries}

```

To change your code to display what you want, try this:

```
{exp:channel:entries channel="products" limit="1" }
<div id="prodinfo">
    <h1>{title}</h1>

    {categories}
    {category_name}
    {/categories}

</div> <!-- END #prodinfo -->
{/exp:channel:entries}

```
> 9 votes

---
Tags: templates, conditionals, categories
---


# Question
Title: Query module: lost connection to MySQL server during query
I have a query being compiled in a template but by the time it's run, it appears that the query module has lost it's connection to the DB:

```
Error Number: 2013

Lost connection to MySQL server during query

..query here...

Filename: modules/query/mod.query.php

Line Number: 181

```

Is there any way to extend the database connection period so this can be avoided?

# Answer
> 1 votes
Sounds like you need to increase the **connect\_timeout** setting in my.cnf or adjust your query so it processes faster. If you aren't on a VPS, you'll have to contact your host to figure out how you make the my.cnf change in their setup.

---
Tags: database, query
---


title: Expresso Store: Custom PDF generation

text:
# Question
Title: Expresso Store: Custom PDF generation
Is it possible to customise PDF generation when, eg, generating PDF Reports? Client is wanting to know if it is possible to append custom information to the PDF report, eg packaging information and returns information which they are using for packing slips with client orders.

# Answer
To the best of my knowledge, no. You can't customize the PDFs, because the current reports aren't really customizable. You would need to create an add-on for Store, like Custom Inventory Columns did or export the data and create custom reports on your desktop. You could possibly also create custom report layouts just using the Query Module in EE, and make them protected pages for your client.
> 1 votes

# Answer
Have you checked out PDF Press? http://devot-ee.com/add-ons/pdf-press

There are a few other options, too, including writing your own code if you're feeling adventurous.
> 0 votes

---
Tags: expresso-store
---


title: Assets 2.05 + Wygwam 2.7 - Paths Broken

text:
# Question
Title: Assets 2.05 + Wygwam 2.7 - Paths Broken
Relinked a bunch of Assets in Wygwam fields to take of advantage of the dynamic link to the Asset. Moved the Assets from a local file upload source to and S3 source. As a result, assets paths now look like this when rendered in a Wygwam field on the front-end:

```
<img src="{assets_412:http://s3.amazonaws.com/API/images/about/filename.jpg}" />

```

Looks like a bug? Is there a fix for this?

# Answer
> 1 votes
I've got a bug report posted about this, but I do not have a fix for it at the moment. I've added a note to update you here once the release is in that fixes it.

---
Tags: wygwam, assets, bug
---


title: Site Structure with Subdomains

text:
# Question
Title: Site Structure with Subdomains
Firstly, I'm sorry if this has been answered elsewhere, but I did a search and couldn't find an answer to my specific query.

I work for a company that has outsourced it's web production and I'm not sure if the design firm have set up the sites in the most cost effective and efficient way.

Essentially, we have three identical sites that are basically a CRM system. There is a database of clients and a list of investments they currently hold. They are for three sub-companies and are each hosted at www.example1.com, www.example2.com and www.example3.com. The web design company have paid for three separate EE licences and three separate MSM licences.

Firstly, I was wondering if the MSM licences were necessary given that each domain is hosting a separate (albeit identical) EE setup with a separate licence? Secondly, would there be anything stopping us from using subdomains with one of the MSM licences so having a set up like:

siteone.example1.com, sitetwo.example1.com and sitethree.example1.com

The three sites are for 3 sub companies and we would not want the users from each sub company to have access to the other sub companies (will this be the issue with using the subdomain/MSM idea? Is there a way of assigning access to only one subdomain to a user?).

The host we use offer unlimited subdomains and mySQL.

Thanks in advance for any assistance you can give!

# Answer
> 1 votes
Based of what you've written, yes you could have one install of EE, with 3 MSM licenses, this is assuming that the other developer isn't using the other MSM licenses to resolve some other issue.

We sometimes use a MSM license on a client's site to hide data that doesn't need to be accessed regularly, but is stored in Channel Entries. For example, for some clients we bring over their Twitter feed directly to EE. Them seeing their tweets amongst their post can be annoying, so they are stored in MSM, so they are accessible, but not actively visible. We've done this for membership directories as well, when members are being stored in channels. Staff needs access to the members, but for content creators, it can be a bit discerning to see 'non-posts' pop-up in Edit Channel Entries.

Anyway, that's just to say, you probably want to know more about why they are using 3 MSM licenses for 3 EE installs.

If they aren't using them at all then, yes you can group to a single install, single license. Even if they are using them, you maybe able to group to a single install and 6 MSM license instead of 3 full EE copies.

As for MSM, it can handle subdomains or actual domains. So if you already own, and want to continue to use example1.com, example2.com, and example3.com the can all be pointed to a single install of EE using MSM, or you could use subdomains, like site1.example.com, site2.example.com, etc.

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


# Question
Title: performance issues - is it the database?
I'm experiencing pages loading very slowly, it's happening intermittently on a low traffic EE site. Most of the traffic is just me.

When they load slow, they take a good 30 seconds or so.

But when the load fast they are very quick. Less than a second.

The template debugger and output profiler numbers look good as far as I can tell.

Could this be due to mysql table locking?

---

updates:

For future reference, I upgraded MySQL to MariaDB (a drop-in MySQL replacement) on the host and also changed DB tables from the default MyISAM to InnoDB (actually XtraDB) and have continued to watch it. These changes have had a positive impact on performance so far.

# Answer
I've hosted one project on a Wired tree VPS and had similar issues. I think they changed how PHP was setup on the server for me which got things running better. Best to contact them directly. They'll know what to do. I doubt it's an EE issue.
> 1 votes

---
Tags: database, mysql, performance
---


# Question
Title: Multisite Manager and Assets Duplication Problem
We added MSM to a site where Assets is used to manage the images on the default site.

When creating a new site and duplicating the channel info etc. everything is duplicating apart from the Assets data.

Is this due to Assets being a custom fieldtype?

Many thanks Jonny

# Answer
> 1 votes
Jonny. Yes, the settings should copy over, but unfortunately, the data won't. There isn't a hook in there for us to add that ability cleanly; you would need to hack the data duplication in.

---
Tags: assets, multi-site-manager
---


# Question
Title: Expresso Store — multiple shipping addresses?
I know I can use different shipping and billing addresses for an order, which is stored by member purchasing but I wanted to see what was the best way to do the following:

Have one billing address, and be able to store multiple shipping addresses, being able to choose the one I want when I get to the checkout process in this part. A lot like an Amazon-type effort, bill all the time to the same person, ship to different stored addresses.

I am thinking this might be a plugin added to it, or if anyone has already done it, could you point me in the right direction?

# Answer
> 0 votes
There is not a way built into Store that would allow you to do what you want to do out of the box. If you are storing the shipping details as channel entries it would be pretty easy to link the customer to multiple channel entries (by making them the author) and show those on the top of your checkout template. Then when the user has select a specific address you can use the entry\_id to output the address into your Store checkout fields.

---
Tags: expresso-store, plugin, shipping
---


title: Using structure on existing site

text:
# Question
Title: Using structure on existing site
I have a site that was developed several years ago by someone else, using an addon cpNavBreadcrumb, about which I can find no information at all on the net!!! I just upgraded the site from ee 1.6.7 to ee 2.5.5 and all of the pages which reference cpNavBreadcrumb (ie all except the homepage) did not load until I commented out the relevant code.

I have installed Structure which I was hoping to use to replace cpNavBreadcrumb, but it appears that this is not a straightforward as I had hoped.

How do you add Structure to an existing site?

# Answer
You would need to follow the setup and intro articles from our Getting Started section here: http://buildwithstructure.com/documentation

You would setup the channels you want Structure to use and resave them, dragging them into place in the hierarchy and then adding our dynamic tags to your templates for the navigation.
> 1 votes

---
Tags: structure
---


# Question
Title: How can Safecracker check for a unique url_title field?
I have a safecracker form that allows users to enter a url\_title. If url\_title is already used, by default, a number gets added to url\_title so it’s unique. But instead of having this automated behavior where number gets added to url\_title, Is there a way i can notify the user that the url\_title typed is already taken so user can enter a new one?

# Answer
> 2 votes
You could build a custom extension that queries the database (I think exp\_channel\_titles) for the url\_title supplied, then return an error to the user if it already exists. You would probably want to look into the safecracker\_submit\_entry\_start hook.

Alternatively, you could use JavaScript and perform some validation on the front end that passes the url\_title to an AJAX request that ultimately does a query like the option above. You could take that response and determine whether to prevent the form submission and notify the user if that url\_title is taken or continue as normal if the url\_title is not taken.

# Answer
> 1 votes
> Alternatively, you could use JavaScript and perform some validation on the front end that passes the url\_title to an AJAX request that ultimately does a query like the option above. You could take that response and determine whether to prevent the form submission and notify the user if that url\_title is taken or continue as normal if the url\_title is not taken.

That's sort of what I do.

I also check for a maximum character length of 50 (EE has a url\_title char length of 75 I believe).

**I use the following in a template with php on input to check if the url\_title exists**

\*(Assuming segment\_3 contains your url\_title):\*

```
<?php
if(isset($_SERVER['HTTP_X_REQUESTED_WITH']) && ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest')){
    $seg3 = $this->EE->uri->segment(3);
    if(isset($seg3) && ($seg3 != '')){
        $shopurl = utf8_decode($seg3);
        $length = strlen(utf8_decode($shopurl));
        $shopurl = $this->EE->db->escape_str($seg3);
        $query = $this->EE->db->query("SELECT count(url_title) AS count FROM exp2_channel_titles WHERE channel_id = '17' AND url_title = '$shopurl'");
        $count = $query->row('count');
        if($length >= '51'){
?>
    <div id="shopUrlMessage" class="userMessageSmall userMessageError shopUrlTaken">
        <p>
            Please choose a shorter name.
        </p>
    </div>
<? } if($length < '51' && $count != '0'){?>
    <div id="shopUrlMessage" class="userMessageSmall userMessageError shopUrlTaken">
        <p>
            Sorry that name is taken.
        </p>
    </div>
<? } if($length < '51' && $count == '0') {?>
    <div id="shopUrlMessage" class="userMessageSmall userMessageSuccess">
        <p>
            Hooray! That name is available.
        </p>
    </div>
<? } }
} else {
    exit('No direct script access allowed');
}
?>

```

---
Tags: safecracker, url-title, validation
---


title: Why ExpressionEngine?

text:
# Question
Title: Why ExpressionEngine?
I need multiple-domain support, some e-commerce catalog, uploading files from users and some forum feauteres in future. Is it good choice for this tasks? Why not Drupal, or Modx, or wordpress - for free? Any ExpressionEngine advantages? Thanks

# Answer
> 2 votes
> I need multiple-domain support, some e-commerce catalog, uploading files from users and some forum feauteres in future. Is it good choice for this tasks?

Yes, ExpressionEngine can do all those tasks, although for multi-domain support you will probably need the Multiple Site Manager (available for purchase separately) , and for the ecommerce you will probably need third party software. Here are a few options you can compare.

> Why not Drupal, or Modx, or wordpress - for free? Any ExpressionEngine advantages?

Use whatever tool best fits the job. I usually choose ExpressionEngine because:

* **It has a great combination of power and flexibility.** You can build almost anything with it, by defining you own custom fields. It makes no assumptions about the architecture of your site. It fits in around your needs, not the other way round.
* I am primarily a content creator, graphic designer and front-end dev. I'm not a heavy-duty programmer. **ExpressionEngine's template tag syntax is easy to learn and understand** (example).
* Anything that ExpressionEngine can't do out-of-the-box, can be done with **add-ons, of which there are many** (both free and paid). Check out http://devot-ee.com/
* **The ExpressionEngine community** are a fantastic, active, and helpful bunch. Because it's a commercial product, **it's supported**, so anything the community can't help you with, EllisLab can.

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


# Question
Title: Losing Active Status of Category in Pagination
I'm using this code to display the active category as the title of the page before the channel entries are listed out, however, if you go to the next page using the pagination the category seems to lose it's active status and nothing is returned. Any suggestions?

Example:

1st page returns: Category \> Active Category Name

2nd page returns: Category \>

1st page URL: /sustainability/stories\_and\_video/category/pillars\_passion\_for\_people

2nd page URL: /sustainability/stories\_and\_video/category/pillars\_passion\_for\_people/P3

```
{exp:channel:entries channel="stories" disable="member_data" orderby="article_publish_date" sort="desc" limit="3" pagination="bottom"}
  {if count == 1}
      <h2>
           Category > {categories}{if active}{category_name}{/if}{/categories}
      </h2>
  {/if}
  <div class="pageBlock newsBlock">
    {if story_image != ""}<img class="sus_small_img" src="{story_image:small_images}" />{/if}
    <h2><a href="{page_url}">{title}</a></h2>
    {story_blurb}
    <span id="more"><a href="  {url_title_path='sustainability/story_detail'}">Read more</a></span>
</div>
{paginate}
    <p>Page {current_page} of {total_pages} pages {pagination_links}</p>
{/paginate}
{/exp:channel:entries}

```

# Answer
I haven't used the active variable before so I'm not sure why it's not working with pagination, however you should be able to use the segment variable in your conditional instead:

```
{categories}
    {if category_url_title == segment_4}{category_name}{/if}
{/categories}

```
> 2 votes

---
Tags: categories, pagination
---


# Question
Title: What are the settings for emailing a member through CP?
I have a membergroup "Admins" and 3 other member groups. I want to give the admins the ability to email a member via the CP.

I'm using ZooVistor here (zoovistior fieldtype)

But I keep getting the following message when I click 'Email member'

> An Error Was Encountered You are not authorized to access this page

I enabled the following settings already:

* Can access TOOLS: Communication
* Can send email via the ControlPanel
* Can send email to Member Groups
* Can send email to Mailing List
* Can view/send cached email
* Can administrate members accounts

I'm using EE v2.5.3 - Build Date: 20120911

Thanks

# Answer
Try adding "Can access TOOLS section" to the permissions for the member group.
> 0 votes

---
Tags: members, control-panel, zoo-visitor, permissions
---


title: Change Language in CP

text:
# Question
Title: Change Language in CP
I am developing a site for a German client.

Is there a way to set the language of a member group?

Does Zoo Flexible Admin offer that as an option?

# Answer
You cannot set CP language by member group and Zoo Flexible Admin doesn't allow language switching from any setting I see but your menus can be in any language you want specific to the member group since you are manually setting up and naming the links.

---

You can set a "Default Language" on the **General Configuration** page:

Then you can override that setting per member on the **Localization Settings** page in their My Account area:
> 2 votes

# Answer
In additional what Anna said - sometimes this can be more simple to do with sql request:

go to **CP -\>Tools -\> Data -\> SQL Manager -\> Database Query Form**

```
UPDATE exp_members SET language="german" WHERE group_id = YOUR_GROUP_ID

```
> 3 votes

---
Tags: control-panel, multilingual
---


# Question
Title: Conditional Formatting: if the value matches one of these
I'm using a multi-author field (VZ Members) that outputs this for author IDs;

```
4333|3871|3957

```

How can I show entries that match the logged in user? Something like:

```
If logged_in_member_id matches one of these, 4333|3871|3957, then show entry.

```

Is there a built-in EE way or does this jump to embedded php? (I hope this question isn't too trivial... it feels that way)

# Answer
> 2 votes
For a normal conditional to work you would have to write it like this:

```
{if logged_in_member_id == "4333" || logged_in_member_id == "3871"}

```

However that's not very flexible and isn't going to work with a piped list of IDs. I've written a custom plugin in the past to solve a similar issue. There's a plugin called Pvl Check If on Devot:ee that I think would work in this situation. Your code using the plugin would look something like this:

```
{exp:pvl_checkif value="{logged_in_member_id}" is_in="{members_field}{id}|{/members_field}" parse="inward"}
    <p>Yes Sir!</p>
{else}
    <p>No Sir!</p>
{/exp:pvl_checkif}

```

I'm not sure how the variable pair will go inside the plugin parameter... you may need to play around with it a bit. Perhaps try with hardcoded values first.

# Answer
> 1 votes
You should just be able to do `{if logged_in_member_id == "4333|3871|3957"}`.

Or with VZ Members, which I'm not familiar with, it should be `{if logged_in_member_id == "{members_field}{id}|{/members_field}"}`

---
Tags: conditionals
---


# Question
Title: Cart Throb Custom Colour Select Price Config
I have a custom color selection option in Cart Throb. IT has been working great when all colors are the same price.

But now I need to have a color option that is a different price. I know this is easy using CT out of the box (product modifier)

But how would I do it using my code?

```
<select id="swatch_select_menu" name="item_options[colour]" onChange="showDiv(this.value);">
<option value="">Select Colour</option>
{exp:channel:entries channel="colours" category="5|35|34" orderby="title" sort="asc" limit="999" dynamic="no" disable="pagination"}
<option value="{url_title}">{title}</option>
{/exp:channel:entries}
</select>

```

# Answer
> 1 votes
You need to configure a price modifier fieldtype as part of your product channel entry. You then populate this field with all the different colours and prices available for each configurable product.

In your template, you can then use code similar to this (lifted from the docs)

```
{exp:channel:entries channel="products" url_title="{segment_3}"}

  {exp:cartthrob:add_to_cart_form entry_id="{entry_id}"}

    {exp:cartthrob:item_options entry_id="{entry_id}" }
        {select}
            <option {selected} value="{option_value}">{option_name} {price}</option>
        {/select}
    {/exp:cartthrob:item_options}

  {/exp:cartthrob:add_to_cart_form}

{/exp:channel:entries}

```

Notice how cartthrob gives you the `{select}` tag to help with generating the dropdown.

Hopefully this will help, but if not, there is some great documentation here: http://cartthrob.com/docs/tutorials/using\_price\_modifiers\_and\_product\_options/index.html

Joe

---
Tags: cartthrob
---


# Question
Title: Expresso FreeMember - reset password form email
I'm testing the reset password form for FreeMember and emails are not arriving. Here's the code (same as here).

```
{exp:freemember:forgot_password return="/account/forgot_sent" }

            <p>
                <label for="email">Email</label><br />
                {field:email}<br />
                {error:email}
            <p>

            <p>
                <input type="submit" value="Submit" />
            </p>

      {/exp:freemember:forgot_password}

```

No errors appear. No emails arrive. I've tested EE's native emailer and the emails arrive, so that's not the issue. Any thoughts?

# Answer
It's almost certainly being caught in some form of spam filter.

As a starting point, I suggest you sign up for a service such as SendGrid (free for up to 200 emails/day) rather than sending email directly from your server. This will help diagnose the issue as you can log into their web console and check the emails are actually being sent.
> 1 votes

---
Tags: freemember
---


# Question
Title: Need a Hack: Channel Entries Search Parameter
I need to display entries by searching a custom field like so:

```
{exp:channel:entries channel="my_channel" search:my_field="#{segment_2}\W" limit="20"}

```

Note the **#** sign. I'm specifically searching for hashtags.

If I leave off the **\W** it works just fine. But it does not always return the exact words – (eg. *#cat* also returns *#catnap*) – exactly as you'd expect.

So I really need that whole word feature to work.

I believe I've traced the breaking point down to the code below (approx. line 1145-1155 in mod.channel.php):

```
elseif (strpos($term, '\W') !== FALSE) // full word only, no partial matches
    {
    // Note: MySQL's nutty POSIX regex word boundary is [[:>:]]
    $term = '([[:<:]]|^)'.preg_quote(str_replace('\W', '', $term)).'([[:>:]]|$)';

    $fields_sql .= ' (wd.site_id=' . $site_id
    . ' AND wd.field_id_' . $this->cfields[$site_id][$field_name] . ' ' . $not
    . ' REGEXP "' . $this->EE->db->escape_str($term).'") '
    . $andor;
}

```

Someone correct me if I'm wrong, but I think that REGEXP escape\_str($term) bit is breaking it.

So I'm looking for a workaround. It would be best not to hack the code directly (of course), but this is the only time that function is being used on the site... So I'm not totally opposed to hacking a fix right there.

Any ideas?

# Answer
> 2 votes
The problem stems from the opening pattern in the regex, `([[:<:]]|^)`. That will return a match for either the start of a string or a word boundary. Here's the definition of a word boundary:

> `[:<:]` These markers stand for word boundaries. They match the beginning and end of words, respectively. A word is a sequence of word characters that is not preceded by or followed by word characters. A word character is an alphanumeric character in the alnum class or an underscore (\_).

As such searches will only perform reliably if your search terms begins with an alphanumeric character or an underscore. You can change this behaviour by switching the opening pattern to a specific character class. For example, instead of searching for strings starting with a word boundary you could search for strings preceded by a `[:space:]`. Here's the definition of a space:

> Space, tab, newline, and carriage return

To make this change replace this line of code:

```
$term = '([[:<:]]|^)'.preg_quote(str_replace('\W', '', $term)).'([[:>:]]|$)';

```

With this:

```
$term = '([[:space:]]|^)'.preg_quote(str_replace('\W', '', $term)).'([[:>:]]|$)';

```

For your usage that should work nicely, but it wouldn't necessarily be a better default behaviour. Unfortunately there's no hook for rewriting channel entry queries, so this would need to be a core hack.

# Answer
> 2 votes
If you want to search for whole words only, (exact matching) you can use
search:my\_field="=#{segment\_2}" (note the extra = inside the quotes)

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

---
Tags: ee2, channel-entries, search
---


# Question
Title: FreeForm Pro, Composer form not displaying Captcha, despite Show for logged_in = YES
Latest version of FreeForm Pro 4.0.11 Version of EE is 2.4.0 (but I would only upgrade if I really really have to) Freeform form made with Composer, captcha added. (But it wont appear on fronted) Tried logging in/out, tried other browser/device as well

# Answer
Sounds like you might need to enable the **"Require captcha with logged-in members?**" settings in Captcha Preferences.
> 1 votes

---
Tags: solspace-freeform, captcha
---


# Question
Title: After Upgrading Matrix 2.4.3 → 2.5.3 P&T Dropdown Fields Fail in Templates
After upgrading from Matrix 2.4.3 to 2.5.3 on EE 2.5.5, P&T Dropdowns (1.0.3) used within Matrix fields are no longer parsing in templates. They simply return nothing.

Nothing looks out of place in the CP following the upgrade and I'm not receiving any errors. I haven't touched my template code.

I've tried removing a matrix row from one of my Channel Entries, saving it empty and then re-inputing the value with no luck.

Any thoughts?

# Answer
After further debugging the issue actually doesn't have anything to do with *P&T Dropdown*, but rather the use of a `var_prefix` name in a template that was identical to the Matrix field *short name*.

In Matrix 2.4.3 this didn't appear to be a problem (although I have now come to question why I had originally used a `var_prefix` as it was unnecessary). In 2.5.3 this causes the template to stop processing when it encounters the Matrix field and doesn't report any errors.

Example of what **NOT** to do:

```
{matrix var_prefix="matrix"}
    {matrix:name}
{/matrix}

```
> 1 votes

# Answer
I'd try upgrading to the latest version of P&T Field Pack on github (version 1.1). I tried it out and this version of P&T Dropdowns works on EE 2.5.5 for me. If that still doesn't work on your install, please post your field settings and template code.
> 0 votes

---
Tags: matrix
---


# Question
Title: Are there benefits to using {site_url} rather than a relative path?
Should I use {site\_url}? I prefer to use relative paths in my templates.

Example:

```
/resources/glossary/category/{category_url_title}

```

Rather than:

```
{site_url}/resources/glossary/category/{category_url_title}

```

I was wondering if anyone could provide an argument of why one should be used over the other? Is it a personal preference thing? Should I always use {site\_url}? Should I never use {site\_url}?

My reasoning for not using it is because I believe it takes less resources to use a relative path. Logically, one would think that because EE doesn't have to replace {site\_url} with http://www.example.com in every template, the page would load faster?

I'm using FocusLab Master Config on all of my sites.

# Answer
In most cases, using relative paths are fine, though you won't see any performance gain there (replacing global variables like `{site_url}` is the tiniest of tasks).

But in the cases where you do want a full URL generated, `{site_url}` is not the best way to do it - instead, you should use `{path=""}`, `{permalink=""}`, `{title_permalink=""}`, etc. This way you'll never run into issues with slashed/unslashed URLs, and it's much cleaner.

So when would you want to use `{path}`? If you have some parts of your site which run under SSL, this will prevent all of your nav links, etc, from being linked to with an `https` URL when leaving those SSL-protected areas.
> 13 votes

# Answer
I would like to point out that your first example is *not* a relative path - it's an absolute path with a variable domain. This crucial difference explains why the full path in your second example is the preferred form.

If you have a page at `example.com/foo.html`, and a page at `example.com/bar/baz.html`, there's a few ways to link to the second page from the first:

* Absolute path with site\_url: `{ site_url }/bar/baz.html`
* Absolute path without site\_url: `/bar/baz.html`
* Relative path: `bar/baz.html`

In this case, it's pretty straightforward. Now imagine the reverse - how exactly will `baz.html` link back to `foo.html`?

* Absolute path with site\_url: `{ site_url }/foo.html`
* Absolute path without site\_url: `/foo.html`
* Relative path: `../foo.html`

The relative paths for the pages have an entirely different format, because they're relative to where the linking page is. This is bad, it means your URL formatters have to be context-sensitive. So that's out.

So either form of absolute path looks good, right? Not quite. Imagine you wrote your code on a server that gives you the subdomain `user.example.com`, and you used the second form, that doesn't use site\_url, because it was simplest at the time. Everything will work perfectly.

Then, later, you have to migrate to a server that puts your account at the url `example.com/user/`.

Well, crap. Now all your links are going to go to `example.com/foo.html` instead of the required `example.com/user/foo.html`. You can go through and update every single reference, but that's unnecessary work.

If you'd written them using `{ site_url }` from the start, you only have to change that one setting.
> 5 votes

# Answer
Speed wise I would go for the relative paths (less DNS lookups) Also for java and css (minified) I would use relative paths. (major speed increase)

So basically if you are running one website with EE, I would go for relative paths. Speed increase is not due to the fact that EE needs to enter the domain in every {site\_url} tag. it's due to the DNS lookups/requests.
> 3 votes

---
Tags: tags
---


title: Self-Referenced Relationships

text:
# Question
Title: Self-Referenced Relationships
I've set up three relationships in my products channel, pointing at...wait for it...the products channel. They're called also\_like\_1, 2 and 3.

In my main template, inside my {exp:channel:entries channel="products" limit="1"} tag, I have this:

```
{if also_like_1 > ''}
<div id="alsolike">
    <h3>You May Also Like</h3>
    {related_entries id="also_like_1"}
    {embed="includes/productsummary" prod="{entry_id}"}
    {/related_entries}
{/if}
{if also_like_2 > ''}
    {related_entries id="also_like_2"}
    {embed="includes/productsummary" prod="{entry_id}"}
    {/related_entries}
{/if}
{if also_like_3 > ''}
    {related_entries id="also_like_3"}
    {embed="includes/productsummary" prod="{entry_id}"}
    {/related_entries}
{/if}
{if also_like_1 > ''}
</div> <!-- END #alsolike -->
<div class="clearboth"></div>
{/if}

```

Here's what the productsummary template looks like:

```
{exp:channel:entries channel="products" id="{embed:prod}" limit="1" }
<div class="prodsumm">
{embed:prod}{title}
</div>
{/exp:channel:entries}

```

So, I'm getting the right values for {embed:prod}, which are the desired products entry\_id's; but the {title} keeps coming out with the parent's title. :(

Main question: how do I get the desired products entry in the embedded template?

Side question: is there any way to reference the enclosing entry's fields in the inner channel:entries tag? (Either with an embed or without.)

Thanks for your help.

# Answer
> 1 votes
Your embed code is incorrect. You need to use `entry_id`, not `id` as the parameter. Also, you should use the `disable` parameter when embedding templates to reduce queries.

```
{exp:channel:entries channel="products" entry_id="{embed:prod}" limit="1" disable="member_data|pagination|categories"}
<div class="prodsumm">
    {embed:prod} - {title}
</div>
{/exp:channel:entries}

```

**EDIT:** See Jean's answer, the embed is actually not required at all.

# Answer
> 2 votes
Are you sure the embed is needed. Can relationship fields be self-referencing on their own without the need for an embed? Have you tried simply using:

```
{related_entries id="also_like_1"}
    {title}
{/related_entries}

```

Does that not generate the correct output for you? I'm so used to using playa for relationships like that, I can't remember what native relationship fields will allow you to do.

---
Tags: embeds, relationships
---


title: Parent/child data from Playa 3 loop

text:
# Question
Title: Parent/child data from Playa 3 loop
Is there a way to retreive parent/child data from within the Playa 3 loops? I tried using `{parent:title}`, but that just prints that string.

# Answer
> 1 votes
As it turns out, using `{reverse_related_entries}{title}{/reverse_related_entries}` does the trick.

---
Tags: add-on, playa, pixelandtonic
---


title: Retrieving an entry archive with Stash

text:
# Question
Title: Retrieving an entry archive with Stash
Trying to build an archive with **Stash** & **Low Yearly Archive**, but not getting it to work as I need. The result that I get with the code below is:

```
 - 2013
 - 2012

```

Everything within the nested list is not getting set it seems. Can you help spot what I am missing?

**Setting the list with:**

```
      {exp:stash:set_list name="yearly-archive" parse_tags="yes" parse_depth="2"}
            {exp:low_yearly_archives channel="news" start_month="1" status="not closed" sort="desc" dynamic="off"}
                {stash:year}{year}{/stash:year}
                {stash:year_count}{year_count}{/stash:year_count}
                {stash:total_years}{total_years}{/stash:total_years}
                {exp:stash:set_list:nested name="news_months_{year}" parse_tags="yes"}
                    {months}
                        {stash:num_entries}{num_entries}{/stash:num_entries}
                        {stash:month}{month}{/stash:month}
                        {stash:month_short}{month_short}{/stash:month_short}
                        {stash:month_num}{month_num}{/stash:month_num}
                    {/months}
                {/exp:stash:set_list:nested}
            {/exp:low_yearly_archives}
        {/exp:stash:set_list}

```

**Retrieving with:**

```
 {exp:stash:get_list name="yearly-archive" parse_tags="yes"}
 {if year_count == '1'}<ul>{/if}
      <li>
      {year}
      <ul>
      {exp:stash:get_list:nested name="news_months_{year}" parse_conditionals="yes" parse_tags="yes"}
           <li>
           {if num_entries != 0}
                <a href="{path=blog/archive}{year}/{month_num}/" title="{num_entries} entries in {month} {year}">{month_short}</a>
           {if:else}
                {month_short}
           {/if}
           </li>
      {/exp:stash:get_list:nested}
      </ul>
 </li>
 {if year_count == total_years}</ul>{/if}
 {/exp:stash:get_list}

```

When adding output="yes" to the set\_list & set\_list:nested tags the outer tag outputs as expected:

```
 year|=|2013|&|year_count|=|1|&|total_years|=|2|+|year|=|2012|&|year_count|=|2|&|total_years|=|2

```

The inner (nested tag) outputs nothing...

Thanks for taking a gander!

# Answer
It could be that the `{months}` variable pair tagdata is removed from the template and appended to the output later on.

Please could you try this: instead of wrapping the inner `{exp:stash:set_list}` around the tag pair, use `{exp:stash:append_list}` *inside* the tag pair. Also, when you get the list, don't use `parse_tags="yes"` on either of the get\_list tags - no further parsing is required at that point.
> 1 votes

---
Tags: stash, low-yearly-archives
---


# Question
Title: Adding a .htaccess redirect to https that plays nicely with existing EE .htaccess rules
I've got an extranet (mywebsite.com/extranet) and would like to make sure that just this section is always under https, even if the user types the URL without https in it. Likewise (as a bonus, if possible, and if it doesn't add an unnecessary overhead), I'd like to make sure that the rest of the website is always http, even the user types https.

How would I go about doing this in the following .htaccess file (I'd rather not change the existing rules if possible as they seem to work well on my existing servers)? I've tried various pieces of code after searching around, but I can't get anything to play nicely with the existing rules. Also, I'd rather not use any third party add-ons as I'd like to keep my EE install as lightweight as possible, thanks.

Here's my existing .htaccess code:

```
RewriteEngine On

# Remove trailing slashes
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]

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

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

```

# Answer
> 3 votes
The two chunks of code you require are:

```
# Redirect certain site pages to SSL and vice-versa
RewriteCond %{REQUEST_URI} !(extranet|themes|images|assets)
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

RewriteCond %{REQUEST_URI} (extranet)
RewriteCond %{HTTPS} !=on
#RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

```

The first 4 lines force it to non-SSL, the last 4 lines force it to SSL. The important bit is the first line:

```
RewriteCond %{REQUEST_URI} !(extranet|themes|images|assets)

```

This lists the first segments of the URL that you don't want to change to http (from https). You need to include any URLs that will be on the extranet site - images, CSS and Javascript includes.

Some servers don't like `RewriteCond %{HTTPS} !=on`, so you may need to use the port number instead: `RewriteCond %{SERVER_PORT} !^443$` \- I've included it in the above but commented out just in case.

The order you place it in the .htaccess is important, based on my working version order and the code you supplied it would look like this:

```
RewriteEngine On

# Remove trailing slashes
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)/$ /$1 [R=301,L]

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

# Redirect certain site pages to SSL and vice-versa
RewriteCond %{REQUEST_URI} !(extranet|themes|images|assets)
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{HTTPS} on
RewriteRule ^(.*)$ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

RewriteCond %{REQUEST_URI} (extranet)
RewriteCond %{HTTPS} !=on
#RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

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

```

---
Tags: htaccess, ssl
---


title: Expresso Store Stock Conditionals

text:
# Question
Title: Expresso Store Stock Conditionals
I know how to make the stock show as 'in stock' or 'out of stock' by using: {if total\_stock} In Stock {if:else} Out of Stock {/if}

How can I code the following: "In stock" if we have more than 5 items available, "Low stock" if we only have 5 and under or "Out of stock" if we are sold out

# Answer
> 2 votes
You would want to do something along the lines of:

```
{if total_stock > 5}
In Stock
{if:elseif total_stock <= 5 && total_stock != 0}
Low Stock
{if:else}
Out of Stock
{/if}

```

The EE User Guide has all of the other operators you can use.

---
Tags: expresso-store, ee2, conditionals
---


title: Geofinder not working after upgrade

text:
# Question
Title: Geofinder not working after upgrade
I just upgraded from ee 1.6.7 to ee 2.5.5. The original site used geofinder and so I installed the latest version of geofinder and the relevant page does not load. It could be unrelated, but is there any change in the syntax I should know about? This is an except from the template:

```
{exp:geofinder:location_results channel="results_groups" status="open" limit="10" geoquery="{segment_6}" radius="100"  latitude="{latitude}" longitude="{longitude}" google_maps_api_key="" distance_mode="miles" disable="member_data|category_fields|trackbacks"  orderby="state|title" sort="asc|asc"}

```

# Answer
> 1 votes
Sounds like there might be a PHP error occurring.

First, turn on debugging in the CP by enabling **Display Output Profiler** and **Display Template Debugging**. When you reload the page, you will see debugging info at the bottom.

Then check the following:

1. Make sure you are logged in as a Super Admin user
2. Make sure **Debug Preference** is set to "PHP/SQL error messages shown only to Super Admins"
3. In your config.php change $config\['log\_threshold'\] = 0; to $config\['log\_threshold'\] = 4;
4. In you config.php make sure $debug = 1; is set
5. Check your php error logs

---

This article is also a good read for tracking down issues in EE:
**Troubleshooting ExpressionEngine**

---
Tags: geofinder
---


# Question
Title: Matrix 2.5.3 with Assets 2.0.5 - not behaving correctly
I'm having a very bizarre issue with a fresh install of EE 2.5.5, Matrix 2.5.3 & Assets 2.0.5

I created a field group and then created a matrix field. When I did so the matrix cp did not look like it normally. Additionally when changing a cell type, none of the options change. However if I save it and reload then the options have changed to the appropriate cell type. Also on the publish page everything looks wonky.

What I've done so far, re-uploaded both assets & matrix to the site. That didn't change anything so then I re-uploaded the entire EE themes folder - still no change.

If I change the cell type to date and save I'm redirected to the CP home and have to renavigate back to custom fields. If I then change the cell type back to assets I get the following php errors.

> A PHP Error was encountered
>
> Severity: Notice
>
> Message: Undefined index: assets
>
> Filename: assets/ft.assets.php
>
> Line Number: 268
>
> A PHP Error was encountered
>
> Severity: Warning
>
> Message: Cannot modify header information - headers already sent by (output started at /path/to/system/codeigniter/system/core/Exceptions.php:170)
>
> Filename: libraries/Functions.php
>
> Line Number: 809
>
> A PHP Error was encountered
>
> Severity: Warning
>
> Message: Cannot modify header information - headers already sent by (output started at /path/to/system/codeigniter/system/core/Exceptions.php:170)
>
> Filename: libraries/Functions.php
>
> Line Number: 405

I'm sure the error is somehow related to not finding files correctly. I've re-uploaded everything and checked path settings and everything checks out.

# Answer
So after further investigation including completely reinstalling EE I found the issue.

In my config.php file I had added the following which I've used in several other sites.

```
// add-on themes path
$config['path_third_themes'] = '/path/to/public_html/addons/themes/';
$config['url_third_themes'] = '/addons/themes/';

// add-on system path
$config['third_party_path'] = '/path/to/public_html/addons/system/';

```

The issue was with url\_third\_themes - I've always used a relative url but I'm working on a new server this time and the new server does not like relative urls here. Once I added in the full url including http:// everything was working as expected.
> 0 votes

# Answer
you've posted a few problems here. Can we focus on the Matrix issue first?

Can you delete and re-upload /themes/third\_party/matrix? Usually if you can't see some options showing up, then the issue is the themes folder. I'm curious how much of this will fall into place if the themes are for sure fine.

Also, what FTP client are you using? And what kind of server is it? PHP, MySQL, Apache or IIS? Those things.

Thank you!
> 2 votes

---
Tags: assets, matrix, php-errors
---


# Question
Title: Using categories to build a location filter
I'm building a site that has a directory listing and I want to allow the user to browse by location. The ideal scenario would be that they would follow this sort of a path:

* go to site.com/browse and select a country
* this loads site.com/browse/category/uk, then select a region
* this loads site.com/browse/category/uk/northern-ireland, then select a county
* this loads site.com/browse/category/uk/northern-ireland/antrim, then select a town/city/area
* this loads site.com/browse/category/uk/northern-ireland/antrim/belfast

Now, I think I can do this using EE categories. I could even load up the sub categories over ajax each time they select a parent category.

The category structure in EE for locations would look something like this:

* Country
    + Region/State
        - County
            * Town/City/Area

My issue is that even with 1 country, there would be a lot of categories. I can handle this neatly on the frontend using GWcode Categories I think. But what about the EE CP. If I click to edit an entry, it would need to load up all these categories in a list. That's a lot. What about when we decide to add another country and need loads more categories again. I want to build this right from the start and don't want to have to re-engineer it later. Another problem is trying to import all those categories. There doesn't seem to be a way to do it. I know there are addons like WB Category Select and JP Category Select, but they still don't solve the issue of having 1000s of categories.

This leads me to believe that I should put all the locations into their own channel and use Playa or a relationship field as a way to display them and allow the user to choose them. But if I do this, is there a way in the channel entry page to allow the user to select the first level (country), which would then populate the second level, and so on? Maybe we need to make our own field type or is there something out there I just haven't found yet.

Then, if this is possible, I would need to filter the entries based on their relationship field. I suppose I'd need to use a mix of freebie to get the filter from the url and use playa to filter based on this.

I suppose I'm asking if I'm over complicating this whole thing or is there an easier way of doing this? Any advice or suggestions would be greatly appreciated.

Thanks, Dave

# Answer
Personally, I think using categories would be a nightmare. Especially when you consider how frequently, this type of data is updated.

I'm not certain where you are getting your data from, but the best option is to store it in new data table within your EE install, and query it.

We haven't had to do lots of countries, but we had to do a State -\> County -\> City -\> Zip Codes set-up for a service directory for a client, before. We downloaded a US Zip Codes database with Counties to use. It's updated annually, I believe. But I'd look at MaxMind products for your situation. The have a free World Cities database. It's stored as common separated text, and can be uploaded to a MySQL table.

We then use a combination of url segments, PHP in template, and EE Queries to produce the drill down. Our's is really all about the 'counties', but you could adapt for 'countries'.

Here's some sample code:

```
<?php $county=''; ?>

{exp:query sql="
    SELECT DISTINCT county, city, state
    FROM counties
    WHERE state='{segment_3}'
        ORDER BY county ASC, city ASC;
"}

<?php if ($county != '{county}')
   echo '<h5>{county} County  <span align="right"><small>(<a href="{domain}/location/county/{county}/" title="View all of {county} County">view county</a>)</small></span></h5>'; ?>

       <a href="{domain}/location/{state}/{city}/" title="{city}">{city}</a>,

<?php $county='{county}'; ?>

{/exp:query}

```

That template, then leads to a listing of cities in the county, and people select a city to display services. I'd provide the sample code for that, except, it's more complicated, because our services by city are then broken down by category. So we had to related the city listing to the categories database, to create, so it's more code than you need.

We have both a list and a map implementation, which was fairly easy to do, you just need to make sure every record contains the fields you need. For us, that meant adding 'county' to the normal address field, so our addresses, were

```
{project}
{street_address}
{city}, {state} {zip code}
{county}

```

Your's would need to include region, and country. We go back and update the client's zip\_codes with counties database once a year. The segment searches are very quick, because the extra table is indexed, and the query module will allow you to access any tabled stored in the database used for EE.
> 2 votes

---
Tags: categories, playa, filter
---


# Question
Title: Plugin development: How do you support date formatting in parse_variables?
I'm trying to support date formatting of a tag's output, per the Plugin Development & Template Class documentation. I have this code on the backend, with some redundancy on the timestamp value to ensure that, yes, this is a timestamp!

```
$append = array(
        'timestamp' => strtotime(date('Y-m-d H:i:s',$row['timestamp'])),
        'username' => $row['username'],
        'screen_name' => $row['screen_name'],
        'email' => $row['email']
    );
$output .= $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $append);

```

If I use the tag `{timestamp}` in my template, I get the timestamp value: 1363956000.

If I use `{timestamp format="%l, %F %j, %Y - %g:%i %A"}` in my template, the output is: `{timestamp format="%l, %F %j, %Y - %g:%i %A"}`.

According to the docs, this should just work, though – Template Class/Date Variables.

How do you support formatting of timestamp values in a plugin's output?

# Answer
> 2 votes
It looks as though you're passing a single row to `parse_variables` (which normally expects an array of rows). If you switch to parse\_variables\_row that should help:

> You may also parse the result rows yourself, which could be useful if for some reason you need to modify the tagdata for each row based on certain criteria. You can still benefit from the simplified variable parsing by using parse\_variables\_row(), though you will no longer automatically have {count}, {total\_results}, or {switch=} variables. To include these variables when parsing your own result rows, you will need to add them yourself.

If you'd prefer to retain `count`, `total_results` etc then you can also easily tweak your existing code by wrapping `$append` in its own array:

```
$output .= $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, array($append));

```

# Answer
> 1 votes
Following @Dom Stubbs' recommendation I used gmmktime(), it said it was type:int:

```
'timestamp' => gmmktime(date('H',$row['timestamp']),
    date('i',$row['timestamp']),
    date('s',$row['timestamp']),
    date('m',$row['timestamp']),
    date('d',$row['timestamp']),
    date('Y',$row['timestamp'])
    ),
        'username' => $row['username'],
        'screen_name' => $row['screen_name'],
        'email' => $row['email']
    );
var_dump($append);

```

Further following Dom's recommendation, switching to `$this->EE->TMPL->parse_variables_row` instead of `$this->EE->TMPL->parse_variables` is returning the correct value.

I was then able to switch back to:

```
$append = array(
        'timestamp' => $row['timestamp'],
        'username' => $row['username'],
        'screen_name' => $row['screen_name'],
        'email' => $row['email']
    );
$output .= $this->EE->TMPL->parse_variables_row($this->EE->TMPL->tagdata, $append);

```

Thanks, Dom!

---
Tags: templates, add-on-development, plugin, date-format
---