# Question
Title: How to capture EE embed output with Stash variable?
I have an EE embed that processes PHP code. I would like to capture that output with a Stash variable.

I'm using a model/view approach, ie. have one template to retrieve the data and another to output the page.

I have this code working correctly in my model:

```
{exp:stash:set name="my_var"}
    {embed="resources/store-post-data"}
{/exp:stash:set}

<h2>Test</h2>
{exp:stash:my_var}

```

and get results as expected:

```
Test
MyPostParameterValueHere

```

But when I use the exact same code

```
{exp:stash:my_var}

```

in my view I get the string

```
{embed="resources/store-post-data"}

```

and not the output of the embed.

What am I missing?

# Answer
I've contacted Mark Croxton, author of Stash, and he has answered this question.
> 0 votes

---
Tags: stash, php
---


# Question
Title: The default field selection in a Content Elements variable in Low Variables keeps self-replicating
(EE 2.9.2, Low Vars 2.5.0, and Content Elements 1.7.0)

I've created a variable in Low Vars (LV) and made it a Content Elements (CE) type. By default (and understandably yet still annoyingly, I might add), CE displays all possible field types it can handle in new variables: Code, Gallery, Heading, Rich Text, etc. So I go about the usual routine of deleting them all to clear the board for my own custom-named fields, including things like "Image (full width)", "Image (on left)", "Image (on right)", etc.

I then click on the "Save Changes" button, and it loads up the screen where I can begin to add the different CE types as I please and populate them with content... except after all the custom fields I created, I see all the default fields as if they had never been deleted... O.o

Going back in to the CE var's settings, I do indeed see my fields followed by all the default fields. Leaving things as-is and clicking "Save Changes" results in 3 sets of fields to select from - my custom ones, and then *2 sets* of the default CE fields. o.O

So each time I save the CE variable, it re-adds the default set of fields. :-/

I might add that the process of saving changes and/or loading the page after that takes an inordinately long time - 45-60 seconds or so. The rest of the EE backend typically responds in a couple of seconds. \>.\<

Any ideas?

# Answer
> 1 votes
> I then click on the "Save Changes" button, and it loads up the screen where I can begin to add the different CE types as I please and populate them with content... except after all the custom fields I created, I see all the default fields as if they had never been deleted... O.o

Today has been released new version of Content Elements and this bug has been fixed.

---
Tags: low-variables, bug, content-elements
---


# Question
Title: How to deal with 'sort by' on author field (playa) where there are multiple authors
I have a project where we display a table of books and a column in that table represents a playa field where 1 or more related authors may be selected. I would really like to then be able to sort on author with the first playa entry for each book being considered the 'primary' author and the sort apply to that...

The results I get when trying to order by this field appear to be rather random, wondering if this is partially related to Using Playa field to order channel entries list

# Answer
> 1 votes
Instead of sorting based on the *contents* of the TD, it would probably be better to set a data attribute to that TD and sort by that value. So instead of...

```
<td>2 Authors<br>Joe Bloggs<br>Bloggsy Malone</td>

```

You would want

```
<td data-primary_author="Joe Bloggs">2 Authors<br>Joe Bloggs<br>Bloggsy Malone</td>

```

Which could be achieved with

```
<td data-primary_author="{exp:playa:parents channel='author' limit='1'}{title}{/exp:playa:parents}">

```

You'd also have to adjust your JavaScript to sort by data attribute rather than contents.

---
Tags: playa, sort, sorting
---


# Question
Title: cannot update certain entries, error 1064
My site was working just fine, when all of a sudden editing certain pages lead to the error below. Now it seems as if i'm also not able to create entries in that channel anymore. After hitting submit i keep getting these errors.

Help is geatly appreciated, since this is a live site...

i am running EE 2.8.1

A Database Error Occurred Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Transfer Needs for Europe's Biggest Sides in Summer,229,682,725,193,188,447,109,' at line 3

SELECT entry\_id, channel\_id, title, url\_title, status FROM exp\_channel\_titles WHERE entry\_id IN (1,303,55,305,103,166,170,168,167,165,4,2,466,56,726,8,13,64,5,169,106,65,174,3,63,306,100,727,186,58,14,420,753,242,489,236,286,327,256,250,549,255,247,323,258,15 Transfer Needs for Europe's Biggest Sides in Summer,229,682,725,193,188,447,109,77,432) ORDER BY entry\_id DESC

Filename: /path/to/public\_html/assets/addons/wygwam/helper.php

Line Number: 1200

# Answer
"Transfer Needs for Europe's Biggest Sides in Summer" isn't an entry\_id and should not be in the where in clause.

Wygwam is pulling those entry ids from EE's page ids.

Check the page module and any config overrides.
> 3 votes

---
Tags: wygwam, error, php-errors
---


# Question
Title: Unserialize error for libraries/Extensions.php after EE upgrade from 2.5.2 to 2.5.5
I've tried upgrading EE from 2.5.2 to 2.5.5. The upgrade apparently went through OK, but when I login to the CP - none of the menu items are clickable and also the rounded borders on the menu items don't display.

I'm also getting an error when CP tries to load the following as a script;

```
admin.php?S=0&D=cp&C=javascript&M=load&file=css&theme=default&v=1356028154

```

When I check the Sources tab in Chrome Developer tool, I see the following;

```
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  unserialize(): Error at offset 0 of 88 bytes</p>
<p>Filename: libraries/Extensions.php</p>
<p>Line Number: 229</p>

</div>(function($, doc) {var adv_css = {".button a,\n.cp_button a,\n#search form,\ndiv.contentMenu,\n#mainContent .formArea,\n#navigationTabs .first_level:not(.addTab)":{"border-radius":"10px"},"#navigationTabs .addTab":{"border-radius":"none"},"#accessoryTabs li,\n.heading":{"overflow":"hidden","border-top-right-radius":"10px","border-top-left-radius":"10px"},".tableFooter,\ndiv.pageContents,\n#mainContent #publishForm":{"border-bottom-right-radius":"10px","border-bottom-left-radius":"10px"},".newTemplate":{"border-radius":"5px"},"#write_mode_writer":{"border-radius":"15px"},".js_hide":{"display":"none"}}, selector, compat_el = doc.createElement("ee_compat"),supported = false,inline_css = [],use = ["", "", "$1$3"],prefixes = " webkit o ms moz Moz".split(" "),corners = " -top-right -top-left -bottom-right -bottom-left".split(" "),regex = /^-(.)(.*?)-(.)(.*)/,css_radii = {};$.each(prefixes, function(i) {var name = i ? this+"BorderRadius" : "borderRadius";if (compat_el.style[name] !== undefined) {if (i == 0) {use = ["border", "-radius", ""];}else if (i < 3) {use = ["-"+this+"-border", "-radius", ""];}else {use = ["-moz-border-radius", "", "-$1$2$3$4"];}supported = true;return false;}});$.each(corners, function(i, v) {if (use[2]) {v = v.replace(regex, use[2]);}css_radii["border"+this+"-radius"] = use[0]+v+use[1];});function process_css(key, value) {if (key.indexOf("@") == -1) {var apply_radius = "",sep = (supported) ? ":" : " ",jQel;for (radius in css_radii) {if (value[radius]) {apply_radius += css_radii[radius]+sep+value[radius]+";";delete(value[radius]);}}if (supported) {inline_css.push(key+"{"+apply_radius+"}");}else {jQel = $(key).css(value);if (apply_radius) {}}}else if (key.indexOf("@"+EE.router_class) != -1) {$.each(value, process_css);}}if (supported) {$.each(adv_css, process_css);var head = doc.getElementsByTagName("head")[0],ss_txt = doc.createTextNode(inline_css.join("\n")),ss_el = doc.createElement("style");ss_el.setAttribute("type", "text/css");ss_el.appendChild(ss_txt);head.appendChild(ss_el);}else {$(doc).ready(function() {$.each(adv_css, process_css);});}})(jQuery, this.document)

```

Wondered if anyone else had this issue? :/

# Answer
An unserialise error with extensions probably means extension settings. Try disabling each extension one by one (backup first)
> 0 votes

---
Tags: error, upgrade, ee2-upgrades, php-errors
---


title: Pagination with Matrix fields?

text:
# Question
Title: Pagination with Matrix fields?
I hear rumors that this is possible.

I want to set up a photo gallery that only shows 10 of 100+ photos. User click paginated links to see more photos.

Anybody ever have to set this up? I hear a rumor it requires Simple Math?

If you have a solution, share it!

# Answer
> 1 votes
Here's a fairly simple pagination with only a previous and next button example. It should give you a good place to start. The example uses pagination number in the 3rd segment and instead of Simple Math uses Math plugin. May have over commented, but:

```
{!--   how many matrix rows per page?   --}
{preload_replace:rows_per_page="2"}

{exp:channel:entries channel="YOUR_CHANNEL" url_title="YOUR_URL_TITLE" dynamic="no"}

    {if YOUR_MATRIX_FIELD}

        {!--   matrix rows   --}
        {YOUR_MATRIX_FIELD offset="{segment_3}" limit="{rows_per_page}"}
            {cell_1}<br>
            {cell_2}<br>
            {cell_3}
            {!--   etc...   --}
            <hr>
        {/YOUR_MATRIX_FIELD}

        {!-- ----------------------
        previous link
        ---------------------- --}
        {!--   if we're on the second page   --}
        {if "{segment_3}" == "{rows_per_page}"}
            <a href="{path='YOUR_TEMPLATE_GROUP/YOUR_TEMPLATE'}">Prev</a>

        {!--   else if we're further along in pages   --}
        {if:elseif "{segment_3}" > "{rows_per_page}"}
            <a href="{path='YOUR_TEMPLATE_GROUP/YOUR_TEMPLATE/{exp:math formula='{segment_3} - {rows_per_page}' absolute='yes'}'}">Prev</a>
        {/if}

        {!-- ----------------------
        next link
        ---------------------- --}
        {!--   if the total matrix rows are greater than sum of pagination segment plus rows per page   --}
        {if "{YOUR_MATRIX_FIELD:total_rows}" > "{exp:math formula='{segment_3} + {rows_per_page}' absolute='yes'}"}
            {!--   if not on the first page calculate next page segment, else show link to second page   --}
            <a href="{path='YOUR_TEMPLATE_GROUP/YOUR_TEMPLATE/{if segment_3}{exp:math formula='{segment_3} + {rows_per_page}' absolute='yes'}{if:else}{rows_per_page}{/if}'}">Next</a>
        {/if}

    {/if}
{/exp:channel:entries}

```

(this example builds on a related answer here)

# Answer
> 0 votes
First don't get it to work (next area) {YOUR\_MATRIX\_FIELD:total\_rows} returns the entry of cell\_1 if I use

if "{{YOUR\_MATRIX\_FIELD limit="1"}{field\_total\_rows}{/YOUR\_MATRIX\_FIELD}}" \> "{exp:math formula='{segment\_3} + {rows\_per\_page}' absolute='yes'}"}

It works fine

---
Tags: matrix, pagination
---


# Question
Title: New to EE 2.9.2 - Linking Content Together
So {vehicle\_make} is the channel field I have created, and it's using a dropdown select. I have entered in 100 vehicle make names, line by line, into this dropdown select.

Now I would like show the appropriate {vehicle\_emblem} image linked to each {vehicle\_make} on my template.

1. My first question is with how to link these two channels together: If I pull the {vehicle\_make} of Acura (based on segment\_3 possibly, if my URL structure is example.com/browse/make/acura), how can I show the {vehicle\_emblem} image of the Acura logo next to the {vehicle\_make} word of "Acura"?
2. My second question is how do I link from a list view template page to a details view template page, of the generated {vehicle} channel group content?

Thanks!

# Answer
> 1 votes
You could do that way easier! create a channel called something like "vehicle\_brands". create a field group with all the fields you can need for the brands such as:

* {title}
* {vehicles\_brand\_name}
* {vehicles\_logo}
* {vehicles\_country}
* {vehicles\_rel\_models} (relationship field to a models channel)
* etc

This way you have all data in from the desired make in one channel entry. So on the example.com/browse/ page you can easily show a listing of all makes, with logo's etc:

```
{exp:channel:entries channel="vehicle_brands" dynamic="no"}
{vehicles_brand_name} - <img src="{vehicles_logo}" /><br>
This car comes from {vehicles_country}<br>
<a href="/browse/make/{url_title}/">View all details</a><br>
{/exp:channel:entries}

```

Then for the detail page, create a template in the browse group called make. In there you can show all details like this:

```
{exp:channel:entries channel="vehicle_brands" dynamic="no" url_title="segment_3" limit="1"}
{vehicles_brand_name} - <img src="{vehicles_logo}" /><br>
This car comes from {vehicles_country}<br>
More details
{/exp:channel:entries}

```

---
Tags: channel-entries
---


title: Maximum number of categories

text:
# Question
Title: Maximum number of categories
I'm planning a site that will have approximately 10,000 categories in the installation.Does ExpressionEngine allow this? Is there a maximum number of categories allowed?

# Answer
> 1 votes
There is no maximum number of categories in EE. However, if you have 10k categories in a group, the Publish Form will get quite unwieldy, listing out all of the categories in a list.

You might want to look at add-ons like Categories Field to improve on the default interface, or perhaps use Relationships rather than Categories.

---
Tags: categories
---


# Question
Title: custom class example to get nested category in expression engine
how to get expression engine categories with different tag like child category and parent category using custom class in php.
like

```
{parent category} - should show all parent.

{child category} - should show all child for any depth weather the parent are not passed from parameter.
```

# Answer
You haven't supplied much info, would this module be of benefit: http://gwcode.com/add-ons/gwcode-categories/examples/example1
> 0 votes

# Answer
It looks like you want to reinvent Category Parents add-on. If you want to reproduce the functionality in your own add-on, use the code as an example.
> 0 votes

---
Tags: ee2, categories
---


title: Child Page templates

text:
# Question
Title: Child Page templates
I have just downloaded the latest EE from Ellis Lab today. I am trying to create various child pages, each with a different template. Is this possible? I keep getting the following message:

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

If this message doesnt occur, the parent template is inherited.

Thanks

# Answer
> 2 votes
ExpressionEngine relationships between pages / entries in the core are linear, there is no such thing as a child page.

If you want to have nested URLs, have a look at third-party add-ons, such as Structure.

You may also achieve nested URLs with built-in Pages module, but it's not as visual as Structure

---
Tags: channel-entries, templates, structure, pages
---


# Question
Title: Linking to an Anchor on another page - help
Im trying the link to an anchor on another page which is possible with html but when I try in EE it is not working as it adds the last segment of my current page, like so:

Im linking from this page:

```
http://www.mysite.com/contact

```

The link from this page is:

```
http://www.mysite.com/#bottom

```

but the link gives this result

```
http://www.mysite.com/contact#bottom

```

It is adding the last segment of the current page??

# Answer
I would need to see the anchor link you have at the moment but try this.

```
<a href="/#bottom">Your link here</a>

```
> 0 votes

# Answer
If Chris Barber-Riley's syntax doesn't work you could also try:

```
<a href="{site_url}#bottom">Your link here</a>

```
> 0 votes

---
Tags: links
---


title: Stash - needs page refresh to reset

text:
# Question
Title: Stash - needs page refresh to reset
I am new to the stash plugin so i am probably doing something wrong.

At the top of a layout template, i have a channel entry loop that sets a stash variable like so:

```
    {exp:stash:set
    save="yes"
    scope="user"
    parse_tags="yes"
    replace="yes"
    refresh="60"
    output="no"
}
    {exp:channel:entries
        channel="subscribers"
        disable="categories|category_fields|member_data|pagination|trackbacks"
        dynamic="off"
        limit="1"
        author_id="CURRENT_USER"
    }
        {subscriber_children search:child_active="=YES" limit="1"}
            {stash:child_name}{child_name}{/stash:child_name}
            {stash:year_group}{year_group}{/stash:year_group}
        {/subscriber_children}
    {/exp:channel:entries}
{/exp:stash:set}

```

In the page, there is a dropdown that allows the user to change the active\_child, so on /page1 the user can select child2 to set to active, this jumps to /switch-child/entry\_id where it sets the child to active, then redirects back to /page1. What i am seeing is that i have to manually refresh /page1 again to update the stash variable (child\_name)

```
{exp:stash:get name="child_name"}

```

How do i get it to update when /page1 loads?

# Answer
> 0 votes
The stash:get is probably being run in the template parse order before it's value is available. One fix is to have the stash:get run later using process="end" parameter:

```
{exp:stash:get name="child_name" process="end"}

```

---
Tags: stash
---


# Question
Title: How can we include multiple images on a page?
I want to add several images to one page, but I only see the space to upload one image. Is it possible to add more?

# Answer
If this is regular File field, then you can only upload only file to it. If you need multiple files within one field, it is best to set up Grid field with one column being File field. This will require some changes in template code as well.
> 2 votes

---
Tags: image
---


title: Solspace Importer not set up correctly?

text:
# Question
Title: Solspace Importer not set up correctly?
I've taken over an EE project on which Importer has already been installed but not used yet (there are no Profiles set).

If I try to set up a profile, even though I have the correct ftp details for the file I get an Ajax error: AJAX Request was not successful. I know the ftp details are correct as I can connect via Filezilla using the same credentials.

If I ignore that failure and 'Continue' I get some PHP errors. The first is a warning:

Message: require\_once(/mnt/www/xyz.co.uk/system/codeigniter/system/libraries/FTP.php): failed to open stream: No such file or directory

Filename: libraries/Solspace\_ftp.php

Line Number: 16

The second is an error:

Fatal error: require\_once(): Failed opening required '/mnt/www/xyz.co.uk/system/codeigniter/system/libraries/FTP.php' (include\_path='.:/usr/share/php:/usr/share/pear') in /mnt/www/xyz.co.uk/system/expressionengine/third\_party/importer/libraries/Solspace\_ftp.php on line 16

Has the module been set up incorrectly? Or am I missing something obvious?

Many thanks - Jon

# Answer
> 1 votes
Your errors are saying that files are missing so it's safe to deduce that something isn't set up correctly. I suggest redownloading the files from your Solspace account and reuploading them to your server to test your theory.

---
Tags: ee, solspace-importer
---


# Question
Title: Channel Entries Tag Will Not Sort Using Category Parameter
This is a strange issue, I can't get the channel entries tag to sort by category. I only want entries that are in this category to display.

When you remove the category="13" it produces results but if it's there it will not.

```
{exp:channel:entries channel="people" category="13" limit="10" paginate="bottom"}
     <div class="person">
          {exp:ce_img:single src="http://XXXX.com/images/member_photos/{photo_filename}" max="125" }
          <h2><a href="{path=people/detail}/{member_id}/{url_title}">{title}</a></h2>
          <p>{person_excerpt}</p>
          <br class="clear_both" />
     </div>
    {paginate}
         <div id="pagination">
              {pagination_links}
         </div>
    {/paginate}
{/exp:channel:entries}

```

Any tips will be appreciated!

# Answer
Try adding `dynamic="no"` to your entries {exp:channel:entries} tag. This will stop EE from doing some things that it does automatically based on the page's URL.

https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#dynamic
> 0 votes

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


# Question
Title: Freemember form jumps to top on inline_errors
I have a freemember registration form that is working. However my form is at the bottom of the page. When inline errors are triggered, my form jumps to the top of the page, instead of the top of the form or error.

# Answer
> 0 votes
One way to solve (work around) this is to use some jQuery to check for the presence of errors in your form and then scroll to them if there are any.

```
if ($('.error').length > 0) {
    $('html, body').animate({
        scrollTop: $('.error').first().offset().top
    }, 2000);
}

```

Or to insert a notice at the top of the page prompting the user to scroll down and check for errors in their form.

```
if ($('.error').length > 0) {
    $('h1').after('<p class="error">There were errors with your submission. Please see below.</p>');
}

```

This example assumes you set the Freemember error handling to inline and your error delimiters use the class `.error` (see the docs).

---
Tags: freemember
---


title: Removing the CartThrob "Ecommerce" tab

text:
# Question
Title: Removing the CartThrob "Ecommerce" tab
Does anyone know how to remove the E-commerce tab? It's not really useful for us and can't be removed as far as I can tell — which is a problem on MSM sites that cannot have access to CT.

I'm hacking it with ZooFlexible Admin but it's a pain configuring this every MSM install (there are many and it's growing).

Thanks

# Answer
> 0 votes
Add CartThrob Tab to CP Main Menu? Adds a navigation tab to the CP for easy access to CartThrob settings and channels. Requires EE 2.1.5 or higher.

Are you referring to this setting? Under the Global settings for the module?

---
Tags: cartthrob, accessory
---


# Question
Title: Taxonomy nav for levels 1 through 3, while current page is level 4?
My multi-level menu works fine for pages at levels 1, 2 and 3.

```
{exp:taxonomy:nav
 tree_id="1"
 display_root="no"
 active_branch_start_level="1"
 depth="3"
    {if {embed:entry_id} }
        entry_id="{embed:entry_id}"
    {/if}
    {if {embed:node_id} }
        node_id="{embed:node_id}"
    {/if}
 }

```

However, when I reach a URL at level 4, the menu disappears. This is to be expected, because of the depth="3" parameter. If I change it to "4", then my menu expands to show all four levels, but that's not what I want. I want the menu to show only three levels, even if the current URL is in level 4.

How can I show the same 3-level menu at all times, even when I'm on a level 4 page?

# Answer
When you pass an `entry_id` or `node_id` parameter, Taxonomy is looking for that active node in the tree and assigns all the appropriate vars like `{active}`, `{active_parent}` etc. If the active node is not found in the tree, Taxonomy will not output the nav.

As you're asking for a subset of the tree, flagging that you want an active branch subset, and supplying the active node which doesn't exist in that subset; Taxonomy is not rendering anything.

So, remove the depth param, and wrap the `{children}` variable in a conditonal, for example:

```
{exp:taxonomy:nav
    entry_id="{entry_id}"
    tree_id="1"
    display_root="no"
    active_branch_start_level="1"
}
    <li><a href="{node_url}">{node_title}</a>{if node_level < 3}{children}{/if}</li>
{/exp:taxonomy:nav}

```

There are a few other ways of doing it, but this would be the most straight forward. Let me know if you're still not getting the results you need.
> 2 votes

---
Tags: navigation, taxonomy
---


# Question
Title: Images: wrong permissions and owner is 99 - no thumbnail
All of my images have no thumbnail preview in the CP.

All images uploaded are automatically set to: 666 Owner: 99 Group: 99

I can't change it through ftp or the the Media Temple file manager

EE: v 2.92 Media Temple DV server

I do have assets installed but I'm not sure if that matters

# Answer
Sounds like you need to change your uploads directory permissions. The non-generation of thumbnails pretty much verifies that it is a permissions problem.

First, take a general look at the EE Upgrade Instructions, in particular the section on Verify File Permissions. Check everything matches the recommendations.

Then check your **File Manager Permissions** in `Control Panel > Content > Files`. Make sure you have your upload directory defined.

Finally, if you are allowing users to upload files via the Control Panel, the web server daemon `user:group` (typically `apache:apache` or `www:www`) needs to have write permission to the uploads directory. Try to avoid making permissions 777 (which is global read/write/execute) and just enable read/write for the web server daemon. This should be a simple check and fix that you can do via your FTP agent. Good luck.
> 1 votes

---
Tags: file-manager
---


# Question
Title: Conditional subnav display with Taxonomy
I have a tree like this:

```
About Us
 - Alpha
 - Beta
 - Delta
  * Three Sub 1
  * Three Sub 2
Careers
  - Full time

```

When the current page is 'Beta', since 'Beta' does not have any child entries *and* is at the second level of navigation, I want to hide my navigation breadcrumbs.

I have the breadcrumbs displaying fine, but how would I use a condition to check that a node is both at a certain level, and also has no children?

# Answer
You can get information about any node via the get\_node tag.

From there, you can find out if the node has children, as well as the depth of the current node.

Something like:

```
{exp:taxonomy:get_node tree_id="1" entry_id="{entry_id}"}
    {if this_node_level > 2 && this_node_has_children}
        {exp:taxonomy:breadcrumbs tree_id="1" entry_id="{entry_id}"}
    {/if}
{/exp:taxonomy:get_node}

```
> 1 votes

---
Tags: navigation, taxonomy
---


# Question
Title: How to modify existing plugins parameters
I am trying to modify the Low Yearly Archive plugin to display months as descending as opposed to ascending. I did not install the plugin and have very little experience with websites/cms. I believe I would have to go to the php file under third party directory but I am not sure where to find this. Website is hosted on Amazon web services if that makes a difference.

Help! Thanks!

# Answer
> 1 votes
You don't need to edit the file for that. You can just use `monthsort="desc"` on the tag. Check out docs to see what other parameters are available.

---
Tags: plugin, low-yearly-archives
---


title: Resource Routing on mutiple URLs

text:
# Question
Title: Resource Routing on mutiple URLs
Just jumping into Resource Router by Rob Sanchez and hit a wall already. I've forgone the category URL indicator as I believe it works without it. I'm attempting to achieve the following URL structure:

/posts/ *-Display a list of ALL categories*

/posts/category\_url *-Display a list of entries belonging to the category*

/posts/category\_url/entry\_url *-Display an entry that has the category*

I currently have:

```
$env_config['resource_router'] = array(
        'posts/:category/:any' => function($router, $wildcard_1, $wildcard_2) {
                // is segment_3 a valid URL title?
                if ($wildcard_2->isValidUrlTitle()) {
                    $router->setTemplate('templates/view');
                }   //is segment_2 a valid category URL title?
                elseif ($wildcard_1->isValidCategoryUrlTitle()) {
                    $router->setTemplate('templates/cat_entries');
                }
                else { //We're at the root - show category list
                    $router->setTemplate('templates/cat_overview');
                }
         }
);

```

The Valid URL title portion works but stumped on what I require to get the other 2 working. Any insight gratefully accepted.

# Answer
You can do this without a callback function:

```
$config['resource_router'] = array(
    'posts' => 'templates/index',
    'posts/:category_url_title' => 'templates/cat_entries',
    'posts/:category_url_title/:any' => 'templates/view',
);

```
> 5 votes

# Answer
The way I've done it before:

```
posts/:any           => templates/index,
posts/:any/:any      => templates/cat_entries,
posts/:any/:any/:any => templates/view

```
> 0 votes

---
Tags: stash, routing, resource-router
---


# Question
Title: Displaying search results if more than one template group
i have been pulling my hair out trying to understand this so any help is appreciated.

I have a channel 'Content' which is just the 'pages' of the site. My template groups are setup using only the 'index' template: template\_group/template

eg,
coaching/index
management/index

And my navigation (done using Navee): template\_group/entry1 (from 'Content' channel)

coaching/schools
coaching/instructors
management/forms

All straight forward. Now i have a simple search form which i want people to be able to search the entries on the site (from the 'Content' channel) but i need to know how to produce the correct search results page.

In channel preferences \> path settings \> channel URL ... ..my 'Content' channel does not have a specific url - since it is different depending on the template group.

eg, If i enter and save http://www.example.com/coaching/ into the field, then do a search for 'schools', the results display http://www.example.com/coaching/schools which is correct. But if i search 'forms' the results brings up http://www.example.com/coaching/forms instead of http://www.example.com/management/forms

So since the 'Content' channel does not have a specific 'Channel URL', how do i get search results to product the link to the correct page/entry??

UPDATE. My Solution.
I created categories for each of the six template groups, then assigned each page/entry to a category. I then used the below conditionals to produce the correct search results:

```
{if category_url_title == "ONE"}
<h3><a href="/ONE/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "TWO"}
<h3><a href="/TWO/{url_title}">{title}</a></h3>{/if}

{if category_url_title == "THREE"}
<h3><a href="/THREE/{url_title}">{title}</a></h3>{/if}

```

etc, etc..

Ps. Using the above with {excerpt} just duplicated the excerpt from the first result, to each other result. So instead of excerpt i used a custom field (meta description text field).

# Answer
ZEDG: if I'm understanding your setup correctly, each entry in your 'Content' channel equates to a specific page on the site, right? So each 'page' has its own entry\_id. Thus, you could run a conditional to examine on the entry\_id of each result, and provide specific template code for each possibility. (Switchee would be a better option for this task than native if/else conditionals, as it would only parse the template code for the matching entry\_id, rather than parsing the code for every possible entry\_id and then discarding the non-matches).
> 1 votes

# Answer
A workaround would be to assign each channel a category and then base the url slugs on that in the search result output.
> 0 votes

---
Tags: templates, search, url, navee
---


# Question
Title: When does EE apply a URL redirect to links?
I'm finding that *some* external links to external sites are being directed to an intermediate page ( http://www.example.com/?URL=http://www.link-destination.com ) with the "To proceed to the URL you have requested, click the link below:" line, followed by the destination URL as a link.

The links I am finding this with are being set inside a text\_area field which is itself inside a Grid field. The text\_area itself has formatting buttons shown (bold, italic and link only). The channel itself is set to 'Allow only safe HTML' and it has "Automatically turn URLs and email addresses into links?" set to 'No' (so links are explicitly made using the formatting button on the text\_area field).

Other external links do not show this redirection behaviour, but they are created either using an Expresso field type or by simply being hardcoded into the template. Internal links of course use the {path=""} tag and so do not show this behaviour either.

I'm at a loss as to how to stop the text\_area links from routing themselves through the intermediate page. It's not going to please the client if users have to click twice, once as normal then again on this transitional page.

What determines whether EE performs this redirection routine, and how can I prevent it (and have the external links go directly to their destination)?

# Answer
I'm not sure of this behavior being applied to other fields than comments, but maybe it worth to try.

On *Control Panel \> Admin \> Security and Privacy \> Security and Sessions*, look for **Apply Rank Denial to User-submitted Links**.
> 2 votes

---
Tags: links, querystring, redirection
---


# Question
Title: How to create development website instance to preview changes made before going live?
I'd like to know if there's any way I can set up a duplicate of the live website I have running on amazon web services so that I can preview changes I'd like to make without effective the live website. So far it doesn't seem like there are any options to preview changes on expressionengine

# Answer
> 1 votes
It's not exactly clear what you mean here. Your question mentions creating a "development website instance" but also talk of "preview\[ing\] changes".

If you mean that you want to be able to preview content changes before publishing them in your live site then there are a couple of add-ons that spring to mind.

These will allow the creation of draft entries which need to be reviewed and publish. This is commonly referred to as "Workflow control".

If, however, you are referring to making changes to the actual build of the site (i.e. templates, add-on files etc) then the common practice would be to set up a totally separate site. When developing I would normally have a local development version, a staging (or preview) version which my client can test, and the a live (or production) version. Each uses their own database and filesystem so they do not impact one another.

At its simplest you would simply clone the site - copy the files and database and set them up somewhere else. The clone would need a different config setup.

If that is the case then you need to create a new copy of your site files and database, install them on a server and have them accessible via a different domain to your live site. This might be a local set up or a site also hosted on AWS. If this is the case then I would also advise making sure the preview site is turned off (so it is only accessible to logged in Super Admins).

Working this way means one needs to be careful about where changes are made to files and data. For instance, it is desirable to push changes to templates *up* the chain from development-\>staging-\>production but undesirable to push content/data changes. Equally, any changes to content on the production site should be passed *down* the chain from production-\>staging-\>development.

To help in managing all of this you will probably also need to use a config system such as Focus Labs Config. This will allow you to create separate configuration files for each environment which greatly simplifies deployment.

---
Tags: aws
---


# Question
Title: Fixed day in different years lists with Low Events
I'm using a Low Events field to store member birthdays, it's easy to calculate ages, display all members who were born in a given year, etc... and even to account for deceased members if necessary with the end date, but I'm having problems making a list of birthdays on a given day, ie, display everyone who was born on September 10th, is there a way to do this that I'm missing?

I'm using EE 2.9 and the latest versions of add-ons, I have Low Search too, just in case it helps any.

Thank you!

# Answer
> 0 votes
I over-complicated the solution. Using the search parameter on a channel:entries or low\_events:entries solves the problem. I knew I was missing something.

# Answer
> 0 votes
The latest version (1.4.0) also supports displaying events as anniversaries with `anniversaries="yes"`, see http://gotolow.com/addons/low-events/docs/tags#entries-tag

---
Tags: low-events
---


title: Weekly Email of Channel Entries

text:
# Question
Title: Weekly Email of Channel Entries
We need to be able to email subscribed members (that we add to Mailchimp via Postmaster) a weekly email of the latest posts made to the site.

Can anyone point me in the right direction and provide some tips on how we can accomplish this?

Thanks! Dan

# Answer
> 2 votes
First of all you should install the RSS module which is provided. Then you would create an RSS Template in this form:

```
{exp:rss:feed channel="your_news_channel" debug="yes" status="open" }
<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
    xmlns:dc="http://purl.org/dc/elements/1.1/"
    xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
    xmlns:admin="http://webns.net/mvcb/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:content="http://purl.org/rss/1.0/modules/content/"
    xmlns:atom="http://www.w3.org/2005/Atom">
    <channel>
    <atom:link href="http://yourdomain.com/path-to/rss-template" rel="self" type="application/rss+xml" />
    <title>Our cool website</title>
    <link>http://yourdomain.com</link>
    <description>News from Our cool website</description>
    <dc:language>{channel_language}</dc:language>
    <dc:creator>info@yourdomain.com</dc:creator>
    <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
    <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    <admin:generatorAgent rdf:resource="http://expressionengine.com/" />
{exp:channel:entries channel="your_news_channel" limit="10" dynamic_start="on" disable="member_data" sort="asc" status="open|featured"}
    <item>
      <title>{exp:xml_encode}{title}{/exp:xml_encode}</title>
      <link>{comment_url_title_auto_path}</link>
      <guid>{comment_url_title_auto_path}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
      <description><![CDATA[{news_excerpt_tag}]]></description>
      <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
    </item>
{/exp:channel:entries}
    </channel>
</rss>
{/exp:rss:feed}

```

Test this template by navigating with your browser to `http://yourdomain.com/path-to/rss-template`

Then create an RSS driven campaign on Mailchimp and give the above address as an RSS feed URL. (Campaigns/Create Campaign/Rss Driven Campaign). Then you will be given the opportunity to configure the campaign to be sent at set intervals (in your case weekly), given the fact new entries are found. Follow the RSS merge tags instructions to provide a template. http://kb.mailchimp.com/campaigns/rss-in-campaigns/create-an-rss-driven-campaign

---
Tags: email, postmaster, notification
---


title: how to check if grid field is empty

text:
# Question
Title: how to check if grid field is empty
I just need to check if one field artist\_gallery:image in a grid field is set, if not the markup should not be rendered. This syntax {if "{artist\_gallery:total\_rows}” \> 0} or {if artist\_gallery:total\_rows \> 0} is not working ... if there is no image, the markup is rendered.

Any ideas? Thank you!

```
    {if "{artist_gallery:total_rows}" > 0}
 <div id="artistgallery">
  <div class="cycle-slideshow">
   {artist_gallery}
    <img src="{artist_gallery:image}">
   {/artist_gallery}
  </div>
  <div id="adv-custom-pager" ></div>
  <div class="clb"></div>
 </div>
{/if}

```

# Answer
Try

```
{if my_grid_field}
    {my_grid_field}
        Stuff in here if the grid field has rows
    {/my_grid_field}
{/if}

```
> 3 votes

# Answer
I've now discovered that it is a bug in 2.9.2 and there is a fix, see this question and the answers: Grid Conditionals not working
> 0 votes

---
Tags: grid
---


title: Relationship Count (Number) Needed

text:
# Question
Title: Relationship Count (Number) Needed
I have 2 channels, "vehicle" and "make". Vehicle uses a text input channel field, make uses a dropdown select channel field.

In the "vehicle" channel I also have a relationship field to "make".

I would like to have a count for how many times I have set a vehicle to a particular make. Let's take Acura for example. I have entered in 20 Acura cars, and 5 Nissan cars. I would like to show 20 next to Acura.

And perhaps a total\_count would be good too, of all of the vehicle+make relationships that are combined. (25)

Can this be done relatively easily in EE 2.9.2?

Thanks!

# Answer
> 1 votes
You should be able to use `{relationship_field:total_results}` to get the total results with `relationship_field` changed to whatever your field name is for your relationship field.

There are a bunch of parameters you can further use to further filter your results in the Relationship documentation.

---
Tags: relationships
---


title: Feature with Question and Answers

text:
# Question
Title: Feature with Question and Answers
I run a football/soccer site and I am looking to create a feature on my site that asks a member several questions about themselves, club etc. All they will need to do is answer the questions. The questions will be predefined by myself and will probably use Channel Form for them to fill in.

What would be the best way to create the question fields. Is just one field for each question using text area type. Or is there a better way.

# Answer
> 1 votes
Needs to understand how flexible your solution should be, how often questions can change and how do you want to use answers in future.

1. As you suggest, it can be just a fields: one question - one field.

\+ it is fast to build and no additional costs

\- every time when you need to add/edit question - you need to create/edit EE field and edit template
2. Create a master channel entry where filled in questions inside the Grid fieldtype (it is can be even in same channel which you will use for answers). Then in Channel form you need to create same list using original list as pattern.

example (just base):

```
{exp:channel:entries entry_id="1" dynamic="off"}
    {exp:channel:form channel="users_answers"}
        {grid_field}
            <input type="hidden" name="grid_field[rows][row_id_{grid_field:count}][col_id_1]" value="{question}">
             <textarea name="grid_field[rows][row_id_{grid_field:count}}][col_id_2]"></textarea>
        {/grid_field}
    {/exp:channel:form}
{/exp:channel:entries}

```
3. Use forms modules like

DevDemon Forms

ProForm Drag and Drop Form Builder

Freeform

But based on your description I think that you don't need to use form builder and stay with solution #2 or even #1 if your question will not change for next 2-3y.

---
Tags: channel, fields
---


title: {filedir_X} variable for Assets S3?

text:
# Question
Title: {filedir_X} variable for Assets S3?
Is there an Assets variable like {filedir\_X} that will output the S3 server path? I'm moving my images to S3 and I have referenced images in several channel entries in a textarea like `<img src="{filedir_X}imagename.jpg"/>` and I'd prefer not to hard code the S3 URL.

# Answer
No there's not, but there's nothing stopping you from using a global variable for this purpose.
> 1 votes

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


title: Braintree payment

text:
# Question
Title: Braintree payment
I need to use Braintree payment gateway (https://www.braintreepayments.com/), made by Paypal

Is there any commerce modules or plugins available to support this?

Thanks

# Answer
No e-commerce modules available for EE currently come bundled with Braintree gateway plugins, but all support the development of custom gateways. So I'd choose your module based on the features you need, then tackle the Braintree gateway after.
> 3 votes

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


# Question
Title: Expresso Store, shipping address not working
I'm using Expresso Store 2.3.1 and EE 2.9.2. I can't get the shipping same as billing address to work. I tick the box, put in a different address, but on the next page, it just says Shipping same as billing, it won't show the second address.

**Billing Details Page:**

```
    {exp:store:checkout
form_class="form--checkout"
next="cart/confirm"
error_handling="inline"
error_delimiters='<span class="help-inline">|</span>'
require="name|address1|city|country|order_email|billing_phone|shipping_phone"}
<section class="section">
    <div class="">
        <div class="order_details">
            {if no_items}
            {redirect="cart/index"}
            {/if}
            <fieldset id="billing_details" class="billing-details">
                <h3 class="section__title">Billing Details</h3>
                <div class="control-group {if error:billing_name}error{/if}">
                    <label class="control-label" for="billing_name">Name *{error:billing_name}</label>
                    <div class="controls">
                        {field:billing_name}
                    </div>
                </div>
                <div class="control-group {if error:billing_address1}error{/if}">
                    <label class="control-label" for="billing_address1">Address *{error:billing_address1}</label>
                    <div class="controls">
                        {field:billing_address1}
                    </div>
                </div>
                <div class="control-group {if error:billing_address2}error{/if}">
                    <div class="controls">
                        {field:billing_address2} {error:billing_address2}
                    </div>
                </div>
                <div class="control-group {if error:billing_city}error{/if}">
                    <label class="control-label" for="billing_city">City *{error:billing_city}</label>
                    <div class="controls">
                        {field:billing_city}
                    </div>
                </div>
                <div class="control-group {if error:billing_postcode}error{/if}">
                    <label class="control-label" for="billing_postcode">Postcode</label>
                    <div class="controls">
                        {field:billing_postcode} {error:billing_postcode}
                    </div>
                </div>
                <div class="control-group {if error:billing_state}error{/if}">
                    <label class="control-label" for="billing_state">County</label>
                    <div class="controls">
                        {field:billing_state} {error:billing_state}
                    </div>
                </div>
                <div class="control-group {if error:billing_country}error{/if}">
                    <label class="control-label" for="billing_country">Country</label>
                    <div class="controls">
                        {field:billing_country} {error:billing_country}
                    </div>
                </div>
                <div class="control-group {if error:billing_phone}error{/if}">
                    <label class="control-label" for="billing_phone">Phone *{error:billing_phone}</label>
                    <div class="controls">
                        {field:billing_phone}
                    </div>
                </div>
                <div class="control-group {if error:order_email}error{/if}">
                    <label class="control-label" for="order_email">Email *{error:order_email}</label>
                    <div class="controls">
                        {field:order_email}
                    </div>
                </div>
            </fieldset>
            <fieldset class="shipping-details">
                <h3 class="section__title">Shipping Details</h3>
                <label for="shipping_same_as_billing" class="checkbox">
                    {field:shipping_same_as_billing} Tick to use the same address as Billing Details
                </label>
                <div id="shipping_details_drawer">
                    <div class="control-group {if error:shipping_name}error{/if}">
                        <label class="control-label" for="shipping_name">Name *{error:shipping_name}</label>
                        <div class="controls">
                            {field:shipping_name}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_address1}error{/if}">
                        <label class="control-label" for="shipping_address1">Address *{error:shipping_address1}</label>
                        <div class="controls">
                            {field:shipping_address1}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_address2}error{/if}">
                        <div class="controls">
                            {field:shipping_address2} {error:shipping_address2}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_city}error{/if}">
                        <label class="control-label" for="shipping_city">City *{error:shipping_city}</label>
                        <div class="controls">
                            {field:shipping_city}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_postcode}error{/if}">
                        <label class="control-label" for="shipping_postcode">Postcode</label>
                        <div class="controls">
                            {field:shipping_postcode} {error:shipping_postcode}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_state}error{/if}">
                        <label class="control-label" for="shipping_state">County</label>
                        <div class="controls">
                            {field:shipping_state} {error:shipping_state}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_country}error{/if}">
                        <label class="control-label" for="shipping_country">Country</label>
                        <div class="controls">
                            {field:shipping_country} {error:shipping_country}
                        </div>
                    </div>
                    <div class="control-group {if error:shipping_phone}error{/if}">
                        <label class="control-label" for="shipping_phone">Phone *{error:shipping_phone}</label>
                        <div class="controls">
                            {field:shipping_phone}
                        </div>
                    </div>
                </div>
            </fieldset>
            <div class="form-actions-container">
                <div class="form-actions">
                    <span class="order_button"><a href="{path='cart/index'}" class="button--solid">Back</a></span>
                    <span class="order_button"><input type="submit" name="next" value="Review Order" class="button--solid" /></span>
                </div>
            </div>
            {/exp:store:checkout}

```

**Payment Details Page:**

```
{exp:store:checkout
form_class="form--confirm"
return="cart/order/ORDER_HASH"
error_handling="inline"
payment_method="stripe"
error_delimiters='<span class="help-inline">|</span>'}
<section class="section">
<div>
    <div class="section__inner">
        <h3 class="section__title">Order Summary</h3>
        <table class="table--cart">
            <colgroup>
            <col span="1" style="width: 41%;">
            <col span="1" style="width: 25%;">
            <col span="1" style="width: 16%;">
            <col span="1" style="width: 16%;">
            </colgroup>
            <thead>
                <tr>
                    <th></th>
                    <th>Price</th>
                    <th>Qty</th>
                    <th>Total</th>
                </tr>
            </thead>
            <tbody>
                {items}
                <tr>
                    <td>
                        <h4><a href="{path='store_example/product'}/{url_title}">{title}</a></h4>
                        <p><small>
                        <b>SKU:</b> {sku}<br />
                        {modifiers}
                        <b>{modifier_name}</b>: {modifier_value} {if price_mod_val}({price_mod}){/if}<br />
                        {/modifiers}
                        </small></p>
                    </td>
                    <td class="price">{price}</td>
                    <td><input name="items[{key}][item_qty]" value="{item_qty}" class="input-mini" /></td>
                    <td>{item_subtotal}</td>
                </tr>
                {/items}
                <tr>
                    <th class="middle" colspan="1"><input type="submit" name="update_cart" value="Update Totals" class="button--solid" /></th>
                    <th class="middle text--right" colspan="3">Subtotal: <span class="price">{order_subtotal}</span></th>
                </tr>
            </tbody>
        </table>
        <div class="table--cart extra">
            <table class="table--cart">
                <tr>
                    <td class="middle">Promo Code</td>
                    <td colspan="2" class="middle">{field:promo_code}</td>
                    <td class="middle">{order_discount}</td>
                </tr>
                {if order_handling_val}
                <tr>
                    <td>Handling</td>
                    <td>{order_handling}</td>
                </tr>
                {/if}
                {if tax_name}
                <tr>
                    <td>{tax_name} ({tax_percent}%)</td>
                    <td>{order_tax}</td>
                </tr>
                {/if}
                <tr>
                    <th class="price text--right" colspan="4"><h4>Total:</h4> {order_total}</th>
                </tr>
            </table>
        </div>
        <div class="order_details" style="clear: both;">
            {if no_items}
            {redirect="shop-online/index"}
            {/if}
            <div class="row">
                <div class="columns medium-12 large-12">
                    <div class="row">
                        <div class="columns medium-6 large-6">
                            <fieldset>
                                <h3 class="section__title">Billing Details</h3>
                                <div class="control-group">
                                    <p><b>{billing_name}</b><br/>
                                    {billing_address1}<br/>
                                    {billing_address2}<br/>
                                    {billing_city} {billing_postcode}<br/>
                                    {billing_state_name}<br/>
                                    {billing_country_name}<br/>
                                    {billing_phone}<br/>
                                    {order_email}</p>
                                </div>
                            </fieldset>
                        </div>
                        <div class="columns medium-6 large-6">
                            <fieldset>
                                <h3 class="section__title">Shipping Details</h3>
                                <div class="control-group">
                                    {if shipping_same_as_billing}
                                    <p>Same as Billing Details</p>
                                    {if:else}
                                    <p><b>{shipping_name}</b><br/>
                                    {shipping_address1}<br/>
                                    {shipping_address2}<br/>
                                    {shipping_city} {shipping_postcode}<br/>
                                    {shipping_state_name}<br/>
                                    {shipping_country_name}<br/>
                                    {shipping_phone}</p>
                                    {/if}
                                </div>
                            </fieldset>
                        </div>
                    </div>
                    <fieldset class="columns medium-6 large-6">
                        <h3 class="section__title">Payment</h3>
                        {if error:payment_method}
                        <div class="alert alert-error">{error:payment_method}</div>
                        {/if}

                        <input type="hidden" id="payment_method" name="payment_method" value="Stripe">

                        <div>
                            <label for="payment_name">Name</label>
                            <input type="text" id="payment_name" data-stripe="name" value="" />
                        </div>

                        <div>
                            <label for="payment_card_no">Card No</label>
                            <input type="text" id="payment_card_no" data-stripe="number" value="" />
                        </div>

                        <div class="col">
                            <label for="payment_exp_month">Expiry</label>
                            <select id="payment_exp_month" data-stripe="exp-month" style="width:auto">
                                <option value=""></option>
                                {exp_month_options}
                            </select>
                            <select id="payment_exp_year" data-stripe="exp-year" style="width:auto">
                                <option value=""></option>
                                {exp_year_options}
                            </select>
                        </div>

                        <div class="col">
                            <label for="payment_csc">CSC</label>
                            <input type="text" id="payment_csc" value="" data-stripe="cvc" class="input-mini" />
                        </div>

                        <input type="hidden" id="payment_token" name="payment[token]" value="" />
                        <input type="hidden" id="order_custom1" name="order_custom1" value="" />
                    </fieldset>
                </div>
            </div>
        </div>
        <div class="form-actions">
            <span class="order_button"><a href="{path='shop/checkout'}" class="button--solid">Back</a></span>
            <span class="order_button"><input id="checkout_submit" type="submit" name="submit" value="Place Order" class="button--solid" /></span>
        </div>
    </div>
</div>
</section>
{/exp:store:checkout}

```

# Answer
> 1 votes
I see the issue, in 2.9.2 the conditionals have changed. To test for the conditional you need to do this:

```
{if shipping_same_as_billing == 1}

```

Brad

# Answer
> 0 votes
First, I would update to the current release designed for EE 2.9.2. The current release is Store 2.4.1. The version you are using should work, but I recommend using the current version so we can do proper debugging.

---
Tags: expresso-store
---


title: redirect domain to another subdomain

text:
# Question
Title: redirect domain to another subdomain
I got a request to redirect the current domain for a website to another one. So the basic scenario is:

Site is hosted on domain.com and should stay there, but all the links should be shown as site.domain2.com. The basic URL structure of the site should remain the same but the parent domain needs to be changed.

Basically another site is buying the current one and they want their subdomain to be the new default one.

I don't have ownership of domain2.com and it will reside on another server.

Is this possible to do with just .htaccess or do I have to change all of my template links to reflect this as well.

# Answer
**METHOD 1: PERMANENT REDIRECT AND EE CONFIG**

This is a two part answer, and probably doesn't address your unique question (about keeping the old domain and having all links redirect to the new domain), but it is the easiest way.

1. What is the web server you are using? Apache? Nginx? You just need a permanent redirect (code `301`) in the config file to redirect all queries from `domain.com` to `site.domain2.com`. See your respective web server docs for instructions on that. That should ensure that your SEO remains as all queries will be redirected to the new domain.
2. The only EE part is the name of the site that you define in `Control Panel > Administration > General Configuration`. That will update all references in your templates **provided** you are using the standard EE global variables `{site_url}` in your templates. List of all EE global variables. If your templates have *hard-coded* references to `domain.com` then you **will** need to update them all.

**METHOD 2: DEFINE A NEW GLOBAL VARIABLE**

An alternative approach would be to define a new variable in `Control Panel > Design > Templates > Global Variables` called something like `{new_subdomain}`. This would have the new subdomain you want links to point to. Then do a find and replace in all your templates for any reference to `{site_url}` and replace with `{new_subdomain}`.

Good luck.
> 0 votes

---
Tags: htaccess, subdomain, domain
---


# Question
Title: Expresso Store/USPS plugin and multiple services/methods
I recently purchased the USPS plugin and wanted to know if it's possible to run more than one service (I'd like to offer priority or express to my customers) without using the "All" option. Is this possible?

# Answer
> 1 votes
I emailed the developer and they sent me an updated version of the USPS extension which they plan on releasing soon. It has multiple choice options along with international shipping options as well.

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


title: One return page for multiple forms

text:
# Question
Title: One return page for multiple forms
I've got a site with six contact forms, and was hoping to be able to use a single return page for all of them and then filter the {exp:freeform:entries} data using something like Switchee (using it to examine the variable {freeform:form\_name}. My freeform:entries tag has the form\_name parameter populated with a pipe-separated list of all six forms, but I only seem to be getting entries from the first form displayed. Is it not possible to set up a catch-all 'Thank you' page in this way? Here's my code. First a truncated version of one of the forms (they all follow the same pattern):

```
{exp:freeform:form
    form_name="new_client"
    return="contact/thank-you/%%entry_id%%"
    }

    --- form inputs --

{/exp:freeform:form}

```

And then the template code on the return 'Thank you' page:

```
{exp:freeform:entries status="open" form_name="new_client|maintenance|payments|sales|complaints|work_with_us" limit="1"}
    <p>Thank you, {freeform:field:name}<br>
    You submitted contact form:</p>

    {!-- now check for which form submitted this entry --}

    {exp:switchee variable = "{freeform:form_name}" parse="inward"}
        {case value="new_client|complaints|work_with_us"}
            <p>NEW CLIENT, COMPLAINTS or WORK WITH US</p>
        {/case}
        {case value="maintenance"}
            <p>MAINTENANCE</p>
        {/case}
        {case value="payments|sales"}
            <p>PAYMENTS OR SALES</p>
        {/case}
    {/exp:switchee}
{/exp:freeform:entries}

```

No matter which form I submit from the return page shows the first entry (not even the most recent one) from the first form. I tried rearranging the order of the forms in the form\_name parameter in case whichever was listed first gets used and the rest get ignored, but it makes no difference. What shows in the thank you template is the form-filler's name from the *earliest* form entry submitted, and Switchee uses the first case. the entry ID appended to the URL seems to do nothing. What's the correct way to set this up?

# Answer
> 1 votes
I would try specifying the entry id in freeform entries tag. This would ensure that you are getting the correct entry in those tags

---
Tags: solspace-freeform
---


# Question
Title: Unable to upload images with Channel Images: Uncaught TypeError in Console in CP
have been scrachting my head about this for the last 2 days:

I created a new channel (duplicated another channel) and set everything up else up as desired.

ATM the channel holds about 28 entries. Some of the entries show problems with Channel Images, some not. It seems to be totally random to me.

When in an entry with problems the CP doesn't seem to be loading correctly. It shows this at the bottom:

In the Chrome Console I get this error:

When trying to upload an image everything looks right, after Submitting and going back into the entry no images are shown though. The images are on the server - I checked that with FTP and the directory settings and permission are identical to other entries that are working.

Anybody with an idea or better skills with the Console to point me into the right direction?

# Answer
Something in jQuery is failing on your install. Make sure you are up to date with ExpressionEngine, so that you can rule out a bug in EE. If that doesn't fix it, reinstall Channel Images and make sure your permissions are correct on the files. If none of that works, make a ticket at DevDemon.com and we will need to see what is killing your jQuery.

Also, other fieldtypes with bugs could cause this, so possibly make another channel field group with just Channel Images in it and see if it fails.
> 1 votes

---
Tags: control-panel, error, channel-images
---


title: Stock tracking in Expresso Store

text:
# Question
Title: Stock tracking in Expresso Store
How do we control the stock in Store?

I enter the stock level into field Limit Stock. The store nows now that there is some stock.

What is the meaning of the check box?

And will Store change the number when 1 item is ordered? It does not in our case. Is this normal that we need to change the number in the entry by hand?

I might have overseen something in the documentation.

# Answer
The limit stock button will tell store that it can only sell so much of that particular sku. Once that sku is down to 0 the item will be out of stock and can no longer be purchased. If you get more of that item in you will need to edit the entry with the updated quantity.

If I remember correctly you will only see the stock change if you have check the limit stock box.
> 0 votes

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


# Question
Title: Does channel videos work with channel form
I am trying to add an SAEF for members to upload videos and currently have channel videos, does anyone know if it works and what the template code would be.

Thanks

# Answer
> 0 votes
I have done this some time ago, I thought by using this code which generates all you need in your form. Docs here https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_form/#other-channel-fields (edit: 2015-02-10 This worked for me EE v.2.7.2 Channel Videos v. 3.1.5)

```
{exp:channel:form channel="video" return="edit-embed/wijzig-video/ENTRY_ID/upload-success" entry_id="{segment_3}"}
{field:youtube}
{/exp:channel:form}

```

---
Tags: safecracker, channel-videos
---


# Question
Title: Shipping Address Validation in Store Module
I've been running into an issue on our website where a customer (likely on accident) does not change their state in the Shipping Address, so that they might end up with a Shipping Address in Los Angeles, AL. They obviously meant Los Angeles, CA, but now we don't charge them shipping because it's outside of California.

Is there any way that we could validate the shipping address before the customer moves onto the next stage in the purchase process?

# Answer
There is nothing built into Store that would allow actual address verification if you are using the default shipping plugin. Third party plugins USPS, UPS, FedEx offer some verification between City, State, & Zip but won't stop a user from checking out in most cases.

If you do not offer free shipping on your site you could easily prevent the user from being able to checkout by making sure the shipping total is higher then 0.

```
{exp:store:checkout ...}
    ... other template code ...
  {if order_shipping_total > 0}
   <input type="submit" value"submit" name="submit" />
  {else}
    Something appears to be wrong with your shipping details please make sure everything is valid
    <input type="submit" name="update_cart" value="Update Cart" />
  {/if}
{/exp:store:checkout}

```

There are multiple address verification APIs that you could also integrate yourself. I personally use SmartyStreets on a few of my clients sites but there are many other too. EasyPost is very nice and also allows you to print shipping labels and connect to many other shipping providers (would require a custom shipping extension), PostCoder Web, USPS, UPS, StrikeIron World, or StrikeIron NA just to name a few.
> 0 votes

---
Tags: expresso-store
---


# Question
Title: Database error when updating Assets 1.1.4 to latest (2.2.4)
**EE v2.4** but also tried updating first to EE 2.8 with same results as per below.

Christiaan

**When trying to update I receive the following:**

```
A Database Error Occurred
Error Number: 1265

Data truncated for column 'folder_id' at row 2

ALTER TABLE exp_assets_files MODIFY COLUMN `folder_id` INT(10) NOT NULL AFTER `file_id`

Filename: /Library/WebServer/sites/disegno/_ee/_third_party/assets/upd.assets.php

Line Number: 551

```

**And then if I try again I get the following:**

```
A Database Error Occurred
Error Number: 1146

Table 'disegno_com_au.exp_assets_entries' doesn't exist

SHOW COLUMNS FROM `exp_assets_entries` LIKE "var_id"

Filename: /Library/WebServer/sites/disegno/_ee/_third_party/assets/upd.assets.php

Line Number: 341

```

# Answer
> 1 votes
Follow-up and fix from P&T support... 'about to be' released v2.2.5 solved the issue.

> the most common error for this is because some of the files that are registered for Assets fields are missing and during the update to Assets 2.x, Assets does not know where in folder structure the file belongs, so it gets a folder\_id of NULL. After that, there's a migration that sets the folder\_id column to NOT NULL, so that produces the error you're having about data being truncated.
>
> Then, when you run it again, some tables have been modified already, but Assets begins the process anew and that produces the second error :)
>
> Try the attached 2.2.5 version which is not yet released - it should work for you. You will have to revert the DB to the state it was before the failed update, though.

# Answer
> 0 votes
Here's how I fixed this issue, I've had it on a couple of different sites.

Basically it's because of corrupted data in the exp\_assets or the exp\_assets\_files table.

If you're on an earlier version of Assets you'll only have the exp\_assets table.

Check the data in that table. If there is a row in that table that contains a file that *doesn't* start with {filedir\_1} (or {filedir\_2} etc.) you have a problem. Delete or fix any row that has a filename without {filedir\_1}.

Then, if you have an newer version of Assets, you'll have the exp\_assets\_files table instead. If there are any entries in this that has folder\_id NULL those need to be set to any valid folder id (e.g. 1). Or just deleted.

---
Tags: assets, pixelandtonic
---


title: Low Yearly Archives

text:
# Question
Title: Low Yearly Archives
Im trying to use Low Yearly Archives to show a list months with a list to an individual month of articles.

I also want to show a list of years excluding the current year so the page will look something like this:

Jan Feb

2014 2013 2012

Ive had this running on earlier versions of EE but can't get it join on 2.9

Here is the code:

PHP:

```
<?php
$year = $this->EE->localize->decode_date("%Y", $this->EE->localize->now);
?>

```

Tag:

```
{exp:low_yearly_archives channel="news" start_month="1" status="not closed" sort="desc" show_future_entries="no" start_year="<?=$year?>" end_year="<?=$year?>" dynamic="yes"}
{months}
{if num_entries > 0}
<a href="{site_url}news/archive/{year}/{month_num}/" title="{num_entries} entries in {month} {year}">{month}</a> | {num_entries}
{/if}
{/months}
{/exp:low_yearly_archives}

{exp:low_yearly_archives channel="news" status="not closed" sort="desc" end_year="<?=$year-1?>" dynamic="no"}
{if year == "<?=$year?>"}
{if:else}
{if entries_in_year > 0}
<a href="{site_url}news/year/{year}/" title="{entries_in_year} entries in {year}"><strong>{year}</strong></a>
{/if}
{/if}
{/exp:low_yearly_archives}

```

Im sure it has something to due with the php part but I can't get it working.

# Answer
> 0 votes
I figured it out. I needed to change: decode\_date to format\_date

```
<?php
$year = $this->EE->localize->format_date("%Y", $this->EE->localize->now);
?>

```

---
Tags: low-yearly-archives
---


title: Large file upload error

text:
# Question
Title: Large file upload error
I've a site running EE 2.8.1 and the allowed filesize on the server is 512M however, if I try to upload a large PDF I receive the following error: "This form has expired. Please refresh and try again."

This error does not appear on my local, development version of the site, however I have no idea what I'd need to configure or set on the server to get this working for production.

Thanks in advance.

# Answer
Several things to think about.

Apache: Keep-Alive Timeout should be more than 5 (2GB files is around 100)

PHP: upload\_max\_filesize, memory\_limit, max\_input\_time, post\_max\_size

Server: your /tmp partition needs to be more more than the to uploading file. Most /tmp partitions are 512M if your file is larger it won't work. (unless you use a mac at work, mac it's /tmp is not a separate partition that's why it works)

I guess that your problem lies -\> /tmp

Regards.
> 0 votes

---
Tags: file-uploads
---


# Question
Title: How to get results from a grid field in low search
I have the field for my grid marked as searchable and the interior fields marked searchable and added to a collection, but I can't get anything inside the grid to show up on a search... I've kept it super simple:

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

```

Both of my other collections return the right results...

# Answer
Did you mark the Grid field as searchable *after* creating entries? If so, you need to re-save those entries in order to populate the `exp_channel_data` table with searchable data, which Low Search in turn uses for its collection index.
> 3 votes

---
Tags: grid, low-search, low
---


# Question
Title: og:description not pulling contents from meta
I am recently experiencing problems with metadata for Facebook and I was wondering if any other EE user has experienced the same.

In principle, the code should be fine and was actually working till not long ago. At some point it stopped doing so and FB scraps no content for og:description (and neither for meta:description for that matter). I thought it might have been aproblem with my descriptions starting with the

tag so I installed streeng and did this:

```
<meta property="og:type" content="article">
<meta property="og:title" content="{pages_title}">
<meta property="og:description" {exp:streeng allowed="none"}content="{pages_summary}"{/exp:streeng}>
{if picture}
<meta property="og:image" content="{picture}">
{if:else}
<meta property="og:image" content="http://www.ecfr.eu/page/-/logoxfb.png?v=1415186136948">
<meta property="og:url" content="{url_title_path='article'}">

```

but still no result. All other meta works.. any idea?

# Answer
> 1 votes
I know this will sound silly but have you tried changing your quotation marks within the EE tag to single quotes. I run into this issue all the time even though it 'looks' like it shouldn't be an issue.

```
<meta property="og:description" {exp:streeng allowed='none'}content="{pages_summary}"{/exp:streeng}>

```

I always use single quotes ( ' ) within an EE tag since HTML uses double ones ( " ).

# Answer
> 0 votes
Facebook caches data so if you're testing a specific URL and not seeing the results as you'd expect, it's most likely their cache is storing incorrect information.

You can force clear the Facebook cache for a specific url using their **Debugger tool**.

---
Tags: facebook, metadata
---


# Question
Title: Filter by entries starting with in Low Search
I have a Low Search form which I'm using to perform simple text searches with on a collection. However I would like to also include the ability to search for all entries beginning with a specific character (A, B, C etc).

MY existing Low Search results tag is as follows:

```
{exp:low_search:results
        channel="book_authors"
        default:orderby="title"
        default:sort="asc"
        query="{segment_3}"
        result_page="explore/library/authors"
        limit="20"
        }

```

How would I now pass to this results page a search string which will return all authors with surnames (field name {a\_surname}) beginning with 'A' for example?

**Update:**

Thanks to the pointers from Low I got this working with the following code:

```
{exp:low_search:results
        collection="book_authors"
        default:orderby="title"
        default:sort="asc"
        {if get:search:a_surname}search:a_surname="^{get:search:a_surname}"{/if}
        result_page="explore/library/authors"
        limit="20"
        }

```

# Answer
Use the Field Search filter, and specifically, the `starts_with` parameter:

```
search:a_surname="A" starts_with="search:a_surname"

```

Which is identical to:

```
search:a_surname="^A"

```
> 0 votes

---
Tags: low-search
---


title: unable to update the site_pages field

text:
# Question
Title: unable to update the site_pages field
I'm having an issue that seems to originate in the site\_pages field in the exp\_sites table of my database. somehow an entry title made it's way into that array. So, i copied the contents of the field, decoded and unserialized it. Next, i took out the culprit lines. then, i made a new template, and put this script in there:

```
    <?php
$uris = array(
'1' => '/',
'58' => '/sport/',
'8' => '/gokuitleg/',
'14' => '/sportsnews/',
'55' => '/about-betbaas/',
'56' => '/disclaimer/',
'2' => '/broederliefde-in-brazilie/',
'3' => '/nog-een-artikel/',
'4' => '/bla-die-bla/',
'5' => '/joepie-de-poepie/',
'9' => '/vette-wedstrijd-man-cashen/',
'13' => '/gokuitleg/veilig-online-gokken/',
'64' => '/gokuitleg/verantwoord-online-gokken/',
'65' => '/kan-sc-heerenveen-de-ban-breken-en-weer-eens-winnen/',
'67' => '/wqeqweqwe/',
'100' => '/ron-jans-puzzelt-met-spits/',
'63' => '/over-betbaas/',
'103' => '/algemene-voorwaarden/',
'105' => '/zorgt-huub-stevens-voor-een-stevens-effect-bij-vfb-stuttgart/',
'106' => '/kan-dordrecht-in-eigen-huis-winnen-van-willem-ii/',
'165' => '/bayer-leverkusen-en-gladbach-gelijkwaardig/',
'166' => '/almeria-op-papier-kansloos-tegen-real-madrid/',
'167' => '/barcelona-wil-in-spoor-real-blijven/',
'168' => '/atletico-madrid-zoekt-aansluiting-met-real-en-barca/',
'169' => '/juve-wil-koppositie-verstevigen/',
'170' => '/as-roma-wil-gat-slaan-met-genoa/',
'174' => '/milan-wilt-winnen-van-napoli/',
'186' => '/southampton-aast-op-3-punten/',
'303' => '/404/',
'304' => '/will-nigeria-successfully-defe/',
'305' => '/ajax-want-that-5th-championship/',
'306' => '/pec-zwolle-in-great-form/',
'466' => '/can-fc-dordrecht-notch-up-another-home-win/',
'552' => '/the-bundesliga-es-geht-wieder-los/',
'726' => '/eredivisie-round-21-pec-zwolle-looking-to-attack-top-3/',
'727' => '/round-19-for-the-bundesliga/',
'805' => '/the-7-golden-secrets-of-successful-sports-betting/',
'884' => '/sportsnews/ghana-vs.-equatorial-guinea-winners-and-losers-from-afcon-semi-final/',
'886' => '/sportsnews/i-wont-resign-klopp/',
'888' => '/sportsnews/ghana-3-0-equatorial-guinea-black-stars-clinch-victory-to-seal-ivory-coast-final/',
'890' => '/sportsnews/africa-cup-of-nations-semi-final-suspended-amid-fan-chaos/',
'892' => '/sportsnews/ill-regret-world-cup-final-forever-messi/',
'894' => '/sportsnews/james-undergoes-foot-surgery/',
'895' => '/sportsnews/steven-gerrards-la-galaxy-shirt-goes-on-pre-sale-for-a-whopping-114/',
'897' => '/sportsnews/kaka-scores-1st-goal-for-orlando-city-in-the-most-low-key-way-imaginable/',
'899' => '/sportsnews/do-pictures-of-smoking-partying-wilshere-rub-arsenal-fans-the-wrong-way/',
'901' => '/sportsnews/chelsea-wise-to-take-no-risks-with-cesc-fabregas-ahead-of-champions-league/',
'904' => '/sportsnews/manchester-united-transfer-news-dani-alves-admission-sparks-red-devils-rumours/',
'906' => '/sportsnews/pochettino-dismisses-lloris-to-real-madrid-psg-rumours/',
'908' => '/sportsnews/koeman-southampton-job-is-like-a-holiday/',
'917' => '/sportsnews/stans-5-point-stance-arsenal-still-in-title-race-mourinhos-master-stroke/',
'918' => '/sportsnews/chelsea-transfer-news-latest-rumours-on-mario-mandzukic-and-edinson-cavani/',
'919' => '/sportsnews/real-madrid-transfer-news-raheem-sterling-rumours-re-emerge-ahead-of-clear-out/',
'920' => '/sportsnews/liverpool-transfer-news-kit-deal-sparks-henrikh-mkhitaryan-marco-reus-rumours/',
'921' => '/sportsnews/ac-milan-stadium-plans-represent-a-step-in-the-right-direction/',
'922' => '/sportsnews/5-storylines-to-follow-in-serie-a-for-the-weekend-of-february-7/',
'923' => '/sportsnews/daniel-sturridge-video-of-raheem-sterling-dancing-worth-it-for-balotelli-cameo/',
'924' => '/sportsnews/kevin-grosskreutz-injury-updates-on-borussia-dortmund-stars-hamstring-return/',
'925' => '/sportsnews/quiet-transfer-window-is-not-a-disaster-for-manchester-united/',
'926' => '/sportsnews/manchester-united-transfer-news-adnan-januzaj-rumours-spark-marquinhos-talk/',
'927' => '/sportsnews/atletico-madrid-vs.-real-madrid-complete-positional-breakdown-of-liga-derby/',
'931' => '/can-atletico-remain-unbeaten-against-real/',
'932' => '/another-weekend-another-eredivisie-combo-banger/',
'978' => '/sportsnews/juventus-vs.-ac-milan-score-grades-reaction-from-serie-a-game/',
'990' => '/sportsnews/atletico-restore-la-liga-credentials-as-real-madrid-left-to-lick-open-wounds/',
'994' => '/sportsnews/everton-vs.-liverpool-score-grades-reaction-from-merseyside-derby/',
'1002' => '/sportsnews/epl-table-latest-week-24-results-scores-and-2015-premier-league-standings/',
'1003' => '/sportsnews/lucas-leiva-injury-updates-on-liverpool-stars-status-and-return/',
'1004' => '/sportsnews/manchester-city-vs.-hull-city-winners-and-losers-from-premier-league-game/',
'1005' => '/sportsnews/aston-villa-vs.-chelsea-winners-and-losers-from-premier-league-game/',
'1006' => '/sportsnews/epl-results-week-24-premier-league-scores-top-scorers-and-2015-table-tracker/',
'1007' => '/sportsnews/atletico-madrid-vs.-real-madrid-derby-winners-and-losers-from-la-liga/',
'1008' => '/sportsnews/aston-villa-vs.-chelsea-score-grades-and-reaction-from-premier-league-match/',
'1009' => '/sportsnews/ilkay-gundogan-clicks-borussia-dortmund-into-gear-with-a-win-at-freiburg/',
'1010' => '/sportsnews/manchester-city-vs.-hull-score-grades-and-reaction-from-premier-league-match/',
'1011' => '/sportsnews/atletico-madrid-vs.-real-madrid-derby-score-grades-reaction-from-la-liga/',
'1012' => '/sportsnews/sami-khedira-injury-updates-on-real-madrid-stars-hamstring-and-return/',
'1013' => '/sportsnews/leighton-baines-injury-updates-on-everton-stars-knee-and-return/',
'1014' => '/sportsnews/danny-rose-mousa-dembele-reward-pochettinos-faith-in-tottenhams-derby-win/',
'1015' => '/sportsnews/lack-of-santi-cazorla-influence-hurts-arsenal-in-derby-defeat-at-tottenham/',
'1016' => '/sportsnews/juventus-vs.-ac-milan-live-score-highlights-from-serie-a-game/',
'1017' => '/sportsnews/harry-kane-caps-off-statement-spurs-win-as-arsenal-make-same-old-mistakes/',
'1018' => '/sportsnews/tottenham-hotspur-vs.-arsenal-winners-and-losers-from-north-london-derby/',
'1019' => '/sportsnews/koke-injury-updates-on-atletico-madrid-stars-hamstring-and-return/',
'1022' => '/sportsnews/afcon-2015-final-score-and-twitter-reaction-for-ivory-coast-vs.-ghana/',
'1024' => '/sportsnews/athletic-bilbao-vs.-barcelona-score-grades-reaction-from-la-liga-game/',
'1026' => '/sportsnews/united-states-michael-bradley-scores-directly-off-corner-kick-vs.-panama/',
'1027' => '/sportsnews/cote-divoire-0-0-ghana-9-8-on-pens-elephants-win-africa-cup-of-nations-final/',
'1030' => '/sportsnews/athletic-bilbao-vs.-barcelona-goals-highlights-from-la-liga-match/',
'1032' => '/sportsnews/athletic-2-5-barcelona-catalans-attackers-seal-confident-win/',
'1034' => '/sportsnews/inter-3-0-palermo-guarin-and-icardi-fire-mancinis-men-to-victory/',
'1035' => '/sportsnews/live-cote-divoire-vs-ghana/',
'1037' => '/sportsnews/man-utd-draw-feels-like-defeat-noble/',
'1039' => '/sportsnews/blind-unhappy-with-blunt-man-utd-showing/',
'1045' => '/sportsnews/manchester-united-reportedly-investigating-alleged-sex-tape-with-unnamed-player/',
'1046' => '/sportsnews/harry-kane-tells-young-fan-he-wouldnt-sign-a-contract-with-manchester-united/',
'1047' => '/sportsnews/athletic-bilbao-vs.-barcelona-live-score-highlights-from-la-liga-game/',
'1048' => '/sportsnews/ghana-vs.-ivory-coast-live-score-highlights-from-afcon-final/',
'1049' => '/sportsnews/ac-milan-juventus-in-bickering-match-over-camera-angles-for-controversial-goal/',
'1050' => '/sportsnews/real-madrid-transfer-news-major-rumours-surrounding-carlo-ancelottis-squad/',
'1051' => '/sportsnews/afcon-2015-final-live-blog-ivory-coast-vs.-ghana-reaction-and-analysis/',
'1052' => '/sportsnews/barcelona-transfer-news-paul-pogba-targeted-latest-dani-alves-rumours/',
'1053' => '/sportsnews/mickey-van-der-hart-makes-awful-hilarious-blunder-in-goal-vs.-ajax/',
'1054' => '/sportsnews/why-sulley-muntari-is-under-most-pressure-for-ac-milan-following-juventus-game/',
'1055' => '/sportsnews/antoine-griezmann-fulfilling-diego-simeones-vision-of-him-at-atletico-madrid/',
'1056' => '/sportsnews/atletico-madrids-best-fan-in-india-takes-in-the-4-0-drubbing-of-real-madrid/',
'1057' => '/sportsnews/usmnt-watch-championship-pair-star-johannsson-scores-against-ajax/',
'1058' => '/sportsnews/chelsea-transfer-news-major-jose-mourinho-targets-in-rumoured-summer-raid/',
'1059' => '/sportsnews/ravel-morrisons-contract-terminated-by-west-ham-latest-details-and-reaction/',
'1060' => '/sportsnews/10-potential-summer-transfer-targets-for-chelsea/',
'1061' => '/sportsnews/west-ham-vs.-manchester-united-live-score-highlights-from-premier-league-game/',
'1063' => '/sportsnews/moyes-wants-burnley-ace-ings-at-real-sociedad/',
'1065' => '/sportsnews/barclays-under-21-premier-league-2015-table-latest-standings-results-on-feb.-9/',
'1067' => '/sportsnews/zlatan-ibrahimovics-wax-statue-is-unveiled-in-paris/',
'1068' => '/sportsnews/di-maria-very-content-at-manchester-united/',
'1070' => '/sportsnews/luiz-adriano-i-wanted-to-join-roma/',
'1072' => '/sportsnews/real-madrid-fans-angered-by-ronaldo-party-after-derby-thrashing/',
'1074' => '/sportsnews/florentino-perez-rallies-troops-as-real-madrid-reach-crisis-point/',
'1076' => '/sportsnews/transfer-talk-reus-to-sign-new-dortmund-deal/',
'1078' => '/sportsnews/aaron-ramseys-poor-form-should-be-a-major-worry-for-arsenal/',
'1079' => '/sportsnews/video-pitch-invading-dog-brings-ecuador-clash-to-a-standstill/',
'1081' => '/sportsnews/bundesliga-team-of-the-week-schurrle-starts-with-a-bang/',
'1083' => '/sportsnews/leicester-city-manager-pearson-hits-out-at-pundits-after-sacking-rumour/',
'1085' => '/sportsnews/boost-for-bayern-as-boateng-ban-cut-to-two-games/',
'1087' => '/sportsnews/watch-robbens-rocket-and-the-best-bundesliga-goals-of-the-week/',
'1089' => '/sportsnews/everything-ac-milan-fans-need-to-know-about-new-signing-mattia-destro/',
'1090' => '/sportsnews/liverpool-vs.-tottenham-brendan-rodgers-key-takeaways-from-pre-match-presser/',
'1091' => '/sportsnews/bayern-munich-stars-wear-fancy-dress-for-ana-ivanovic-bastian-schweinsteiger/',
'1092' => '/sportsnews/manchester-united-transfer-news-jackson-martinez-rumours-emerge-and-more/',
'1093' => '/sportsnews/why-arda-turan-remains-an-indispensable-part-of-atletico-madrid-project/',
'1094' => '/sportsnews/wayne-rooney-yet-to-have-a-premier-league-shot-on-target-in-2015/',
'1095' => '/sportsnews/borussia-dortmund-5-potential-replacements-should-marco-reus-leave-this-summer/',
'1096' => '/sportsnews/cristiano-ronaldo-8-reasons-why-real-madrid-should-rest-their-star-more/',
'1097' => '/sportsnews/wilfried-zaha-how-manchester-united-failed-the-12-million-england-star/',
'1098' => '/sportsnews/calls-for-manuel-pellegrini-to-leave-manchester-city-ignore-his-work-so-far/',
'1099' => '/sportsnews/epl-table-updated-premier-league-standings-fixtures-title-odds-after-week-24/',
'1100' => '/sportsnews/harry-kane-reportedly-scouted-by-real-madrid/',
'1101' => '/sportsnews/serie-a-controversy-flawed-milan-join-napoli-and-roma-in-attacking-juventus/',
'1102' => '/sportsnews/a-5-point-plan-to-ensure-lyon-fend-off-psg-in-ligue-1-title-race/',
'1103' => '/sportsnews/cristiano-ronaldo-shakes-his-head-in-anger-at-iker-casillas-conceding-goal/',
'1104' => '/sportsnews/la-liga-winners-and-losers-atletico-madrid-blow-away-real-blow-open-title-race/',
'1105' => '/sportsnews/liverpool-transfer-news-reds-watch-mauro-icardi-paulo-dybala-in-latest-rumours/',
'1106' => '/sportsnews/why-mario-gotze-and-robert-lewandowski-are-underperforming-for-bayern-munich/',
'1107' => '/can-liverpool-continue-their-unbeaten-streak/',
'1108' => '/combo-banger-for-round-25-of-the-premier-league/',
'1110' => '/the-copa-del-rey-semi-finals-are-here/',
'1112' => '/sportsnews/arsenal-vs.-leicester-city-winners-and-losers-from-premier-league-game/',
'1113' => '/sportsnews/koeman-barcelona-rumours-are-inevitable/',
'1115' => '/sportsnews/el-shaarawy-ac-milan-players-still-support-inzaghi/',
'1117' => '/sportsnews/liverpool-3-2-tottenham-late-balotelli-strike-settles-five-goal-thriller/',
'1119' => '/sportsnews/arsenal-2-1-leicester-city-walcott-on-target-for-below-par-gunners/',
'1121' => '/sportsnews/sunderland-0-2-qpr-hoops-pick-up-first-away-win/',
'1123' => '/sportsnews/hull-city-2-0-aston-villa-ndoye-stars-on-debut/',
'1125' => '/sportsnews/marquinhos-to-man-utd-we-will-see-in-the-summer-says-agent/',
'1127' => '/sportsnews/martinez-hails-jagielka-stones-defensive-partnership/',
'1129' => '/sportsnews/from-six-manchester-uniteds-to-60-gareth-bales-the-astonishing-numbers-behind-the-premier-leagues-5.14bn-tv-rights-deal/',
'1131' => '/sportsnews/tomkins-signs-new-west-ham-contract/',
'1132' => '/sportsnews/preston-north-end-fan-in-south-africa-will-sell-a-kidney-for-man-united-tickets/',
'1133' => '/sportsnews/what-the-5.136-billion-tv-deal-means-for-premier-league-fans-and-england-team/',
'1134' => '/sportsnews/chelsea-transfer-news-raphael-varane-swoop-thibaut-courtois-to-madrid-rumours/',
'1135' => '/sportsnews/liverpool-transfer-news-latest-rumours-on-vincent-enyeama-to-sign-for-reds/',
'1136' => '/sportsnews/liverpool-vs.-tottenham-hotspur-live-score-highlights-from-premier-league-game/',
'1137' => '/sportsnews/louis-van-gaal-should-look-to-counter-long-ball-united-accusation-on-the-pitch/',
'1138' => '/sportsnews/landon-donovan-girlfriend-hannah-bartell-announce-engagement/',
'1139' => '/sportsnews/arsenal-vs.-leicester-city-live-score-highlights-from-premier-league-game/',
'1140' => '/sportsnews/why-ac-milans-new-stadium-will-propel-the-rossoneri-back-to-the-top-in-europe/',
'1141' => '/sportsnews/manchester-citys-top-5-goals-this-season-james-milner-sergio-aguero-star/',
'1142' => '/sportsnews/stoke-vs.-manchester-city-team-news-preview-live-stream-and-tv-info/',
'1143' => '/sportsnews/manchester-united-transfer-news-marco-reus-contract-sparks-mats-hummels-rumours/',
'1144' => '/sportsnews/lionel-messi-celebrates-10-million-followers-on-instagram-with-special-jacket/',
'1145' => '/sportsnews/can-daniel-sturridge-and-harry-kane-be-the-perfect-attack-for-englands-future/',
'1146' => '/sportsnews/does-marco-reus-new-deal-really-secure-his-future-at-borussia-dortmund/',
'1147' => '/sportsnews/louis-van-gaal-gives-dossier-to-journalists-to-try-disproving-long-ball-critics/',
'1148' => '/sportsnews/manchester-united-vs.-burnley-louis-van-gaals-key-quotes-from-latest-presser/',
'1149' => '/sportsnews/assessing-manchester-citys-summer-signings-on-their-performance-so-far/',
'1150' => '/sportsnews/grading-atletico-madrids-defenders-on-form-so-far-this-season/',
'1151' => '/sportsnews/why-real-madrid-should-keep-denis-cheryshev-in-the-summer/'
);

$templates = array(
'1' => '12',
'8' => '28',
'13' => '28',
'14' => '19',
'55' => '13',
'56' => '13',
'58' => '12',
'2' => '11',
'3' => '11',
'4' => '11',
'5' => '11',
'9' => '12',
'64' => '28',
'65' => '11',
'67' => '11',
'100' => '11',
'63' => '27',
'103' => '27',
'105' => '11',
'106' => '11',
'165' => '11',
'166' => '11',
'167' => '11',
'167' => '11',
'168' => '11',
'169' => '11',
'170' => '11',
'174' => '11',
'186' => '11',
'303' => '32',
'304' => '11',
'305' => '11',
'306' => '11',
'466' => '11',
'552' => '11',
'726' => '11',
'727' => '11',
'805' => '11',
'884' => '19',
'886' => '19',
'888' => '19',
'890' => '19',
'892' => '19',
'894' => '19',
'895' => '19',
'897' => '19',
'899' => '19',
'901' => '19',
'904' => '19',
'906' => '19',
'908' => '19',
'917' => '19',
'918' => '19',
'919' => '19',
'920' => '19',
'921' => '19',
'922' => '19',
'923' => '19',
'924' => '19',
'925' => '19',
'926' => '19',
'927' => '19',
'931' => '11',
'932' => '11',
'978' => '19',
'990' => '19',
'994' => '19',
'1002' => '19',
'1003' => '19',
'1004' => '19',
'1005' => '19',
'1006' => '19',
'1007' => '19',
'1008' => '19',
'1009' => '19',
'1010' => '19',
'1011' => '19',
'1012' => '19',
'1013' => '19',
'1014' => '19',
'1015' => '19',
'1016' => '19',
'1017' => '19',
'1018' => '19',
'1019' => '19',
'1022' => '19',
'1024' => '19',
'1026' => '19',
'1027' => '19',
'1030' => '19',
'1032' => '19',
'1034' => '19',
'1035' => '19',
'1037' => '19',
'1039' => '19',
'1045' => '19',
'1046' => '19',
'1047' => '19',
'1048' => '19',
'1049' => '19',
'1050' => '19',
'1051' => '19',
'1052' => '19',
'1053' => '19',
'1054' => '19',
'1055' => '19',
'1056' => '19',
'1057' => '19',
'1058' => '19',
'1059' => '19',
'1060' => '19',
'1061' => '19',
'1063' => '19',
'1065' => '19',
'1067' => '19',
'1068' => '19',
'1070' => '19',
'1072' => '19',
'1074' => '19',
'1076' => '19',
'1078' => '19',
'1079' => '19',
'1081' => '19',
'1083' => '19',
'1085' => '19',
'1087' => '19',
'1089' => '19',
'1090' => '19',
'1091' => '19',
'1092' => '19',
'1093' => '19',
'1094' => '19',
'1095' => '19',
'1096' => '19',
'1097' => '19',
'1098' => '19',
'1099' => '19',
'1100' => '19',
'1101' => '19',
'1102' => '19',
'1103' => '19',
'1104' => '19',
'1105' => '19',
'1106' => '19',
'1107' => '11',
'1108' => '11',
'1110' => '11',
'1112' => '19',
'1113' => '19',
'1115' => '19',
'1117' => '19',
'1119' => '19',
'1121' => '19',
'1123' => '19',
'1125' => '19',
'1127' => '19',
'1129' => '19',
'1131' => '19',
'1132' => '19',
'1133' => '19',
'1134' => '19',
'1135' => '19',
'1136' => '19',
'1137' => '19',
'1138' => '19',
'1139' => '19',
'1140' => '19',
'1141' => '19',
'1142' => '19',
'1143' => '19',
'1144' => '19',
'1145' => '19',
'1146' => '19',
'1147' => '19',
'1148' => '19',
'1149' => '19',
'1150' => '19',
'1151' => '19'
);

$data['url'] = 'https://www.betbaas.com/';
$data['uris'] = $uris;
$data['templates'] = $templates;

//echo serialize($data);
echo base64_encode(serialize($data));

?>

```

Which generates a cool looking encoded string. When i insert this string into the site\_pages field and save, i get a lot of errors on the frontend:

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: 1
Filename: core/EE_Config.php

Line Number: 356
A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /path/to/codeigniter/system/core/Exceptions.php:170)
Filename: core/EE_Input.php
Line Number: 212

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /path/to/codeigniter/system/core/Exceptions.php:170)
Filename: core/EE_Input.php
Line Number: 212

A PHP Error was encountered
Severity: Warning
Message: Cannot modify header information - headers already sent by (output started at /path/to/codeigniter/system/core/Exceptions.php:170)
Filename: core/Common.php
Line Number: 446

```

I just can't seem to find what's wrong here.

# Answer
Looks like you need to contain everything in its Site ID. So, take the code you have now, but change this:

```
$data['url'] = 'https://www.betbaas.com/';
$data['uris'] = $uris;
$data['templates'] = $templates;

```

To this:

```
$data = array('1' => array(
    'url' => 'https://www.betbaas.com/',
    'uris' => $uris,
    'templates' => $templates
));

```
> 0 votes

# Answer
Have you tried the script over at www.buildwithstructure.com? I realise you might not be using structure, but this script might help you as both the pages and structure modules use this field in the database. Personally I've more experience with structure over the pages module, but I've successfully used this script several times before.

You input your existing encoded value from site\_pages in exp\_sites and you can choose which template IDs you want to change. It then gives you a new encoded string to add back into the database.

Might be worth a shot - but backup backup backup!
> 0 votes

---
Tags: database, php-errors, database-error
---