# Question
Title: View template not fully loading for a certain category [odd!]
I'm coming across a pretty strange error.

I've recently added 2000 entries. Taken a while, but everything is cleaned up and seems to be working well, except for one thing I've found today.

The entries are all property listings. The are organised by categories that are County/County based. i.e parent category is the Country and the child category is the County.

For any entry that has 'Ireland' as the parent category, the 'view' template is not fully loading. It only loads part way and then stops. I kind of get half a page. The index page is fine.

I've switched on template debugging, but that is not loading either.

Not quite sure where to start finding out what the issue is!

# Answer
Thanks for the responses. I had just set about breaking down the template, and start rebuilding to see where it breaks.

Luckily I noticed something early on. I have a tabbed content area, and whilst checking my half loaded page, I clicked into the final tab. This then displayed the debug and what appeared to be the rest of the page code all within the content area.

Check out that section on the view template and realised that I had an `if` statement that (potentially) displayed the postcode field, and it wasn't closed. This was throwing up the error, as none of the properties in Ireland had a postcode.

Doh! Luckily I spotted this early on! Cheers!
> 0 votes

# Answer
Where to start troubleshooting: If there's not too many, I would

* take the entries with Ireland and take off the Ireland category.
* Then create 1 entry with Ireland as the category, but leave all the fields on the entry empty (other than required, but keep the data it as plain as possible).
* Then test, as it might be that there is a character in a field on the Ireland entries that is breaking the display.
> 1 votes

---
Tags: categories, error
---


title: nested conditional and if no_results

text:
# Question
Title: nested conditional and if no_results
I'm trying to display a phrase based on the language\_code This is the code:

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

{if language_code="it"}
    {if no_results}
        <p>Nessuna offerta al momento</p>
    {/if}
{/if}

{if language_code="en"}
    {if no_results}
        <p>No offers at the moment</p>
    {/if}
{/if}

    <h6>{title}</h6>
    <p>{descrizione}</p>

{/exp:channel:entries}

```

the result is that it is shown only the phrase with language\_code it , even if language\_code is en

how can i resolve it? Thanks

# Answer
Resolved. I created a variables and changed the code to this

```
{exp:channel:entries
    channel="offerte_{language_code}"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    dynamic="no"
}

    {if no_results}
        {nessuna_offerta-{language_code}}
    {/if}

    <h6>{title}</h6>
    <p>{descrizione}</p>

{/exp:channel:entries}

```
> 1 votes

---
Tags: conditionals
---


title: Assets conflicting {url} tag

text:
# Question
Title: Assets conflicting {url} tag
At first I had this particular problem where Assets' {url} tag was returning "http://", *all the time for any file*.

```
{page_gallery}
    <li><a href="{url}" class="gallery"><img src="{url}"></a></li>
{/page_gallery}

```

Resulting in:

```
<li><a href="http://" class="gallery"><img src="http://"></a></li>

```

After hours of debugging, I've found that it's because that part of the template is wrapped in a `{exp:member:custom_profile_data}` where `{url}`actually means the user's URL.

I identified the problem, fine, but there is no way I can remove `{exp:member:custom_profile_data}` in this template. Is there any other way to access Assets' `{url}`? Namespace it someway?

# Answer
Another way would be to use the var\_prefix parameter. {page\_gallery var\_prefix="image} {image:url} {/page\_gallery}

And yet another would be just to use the Assets field as a single tag: {page\_gallery}
> 1 votes

# Answer
Try the shortcut tag: `{page_gallery:url}`.
> 2 votes

---
Tags: assets, members
---


# Question
Title: Upgraded 2.5.5 to 2.6 - Too many redirects when access CP
I just tried to upgrade from 2.5.5 to 2.6. I followed all of the instructions here: http://ellislab.com/expressionengine/user-guide/installation/update.html

Now when I try to access my Control Panel (/system), I'm getting "Too many redirects error": http://foo.local/system/index.php?S=0&D=cpC=homepage

I removed my .htacess rewrite rules and am still getting this error.

# Answer
> 5 votes
This looks like a bug in EE2.6. Here's the proposed fix from that report:

> Changed line 407 of system/expression/libraries/core.php from:
>
> `ee()->functions->redirect(BASE.'C=homepage');`
>
> to:
>
> `ee()->functions->redirect(BASE.AMP.'C=homepage');`

# Answer
> 0 votes
Try clearing your cookies.

If the problem persists after that, turn off extensions in your config file. Open system/expressionengine/config/config.php and change allow\_extensions to n: `$config['allow_extensions'] = "n";`

If you can log in after disabling extensions, then you know the culprit is some extension you have installed.

# Answer
> 0 votes
In addition to Rob's suggestion, it's also worth clearing your caches and if the problem persists then run the upgrade again incase something didn't quite copy over.

# Answer
> 0 votes
I get the same "too many redirects"-error on the ExpressionEngine control panel start page. On all other control panel pages I have no problem ...

---
Tags: upgrade
---


# Question
Title: Unexpected results using .htaccess rewrites
I'm working a multilingual site in EE and I am optimizing the URL's for SEO reasons in multi languages as well. The purpose is that people can visit the URL

http://www.domain.com/nl/contact/medewerkers and also http://www.domain.com/fr/contact/personnel

both pointing to the same templategroup 'medewerkers' (medewerkers is staff in English fyi)

Just to be complete: the switch of the language is triggered by the first segment in the URL and works fine

The idea was to have some entries in the .htaccess in the /fr subdir of the site to make the 'translation' of the URL to right template group.

So in this /fr/.htaccess I've specified

```
    RewriteRule ^contact/personnel$ contact/medewerkers

```

However for some reason this does not seem to work properly

# Answer
It might be that this problem is bound to my server environment (although I was able to reproduce this locally with MAMP), but this is how I've got it solved after many hours of swearing.

In the /system/expressionengine/config/config.php file there is a setting the specify how EE should deal with URI's. In a standard EE setup this is specified as

```
$config['uri_protocol'] = 'AUTO';

```

Changing this to

```
$config['uri_protocol'] = 'PATH_INFO';

```

solved my problems and it might solve yours!

regards, Tim
> 1 votes

---
Tags: htaccess, multi-language
---


title: Different Domains with URL Re-Writes

text:
# Question
Title: Different Domains with URL Re-Writes
I have several areas of my website which content authors want they content to be available at their own domain name for identity and advertising reasons. I want to avoid setting up additional multisites as most of these are very small subsections of the much larger parent site.

For example, the current url for a subsection wanting their own domain would look like this...

http://domain.com/section/subsection/category/thisismysite

the content users want to be able to access the site at

http://thisismysite.com

The major issues come when I want to keep the url short for additional subpages within the "thisismysite" sub section, say...

http://thisismysite.com/about would be the same as http://domain.com/section/subsection/category/thisismysite/about

Any ideas on how i can accomplish this for my users?

# Answer
> 1 votes
few months ago I had similar work to do, I had tried many (many) solutions and rewrite hacks but I'm not a htaccess guru and I was almost ready to drop it, but then I remembered I can park domains on my package and once domain is directed to your site, you can do with it something.

So, what I have in my htaccess rules for removing index.php and later I have few lines that handle new domain request. You must have that other domain for testing, besides that iys hard to know if will work.

```
RewriteEngine On
RewriteBase /

#Classic index.php remove
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

#get request from new domain and rewrite destination
#maybe you can do something different, but this worked for me
RewriteCond %{HTTP_HOST} ^(www.)?thisismysite\.com$ [NC]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{DOCUMENT_ROOT}/$1 -f
RewriteRule ^(.*)$ /section/subsection/category/thisismysite/$1 [L]

```

If this doesn't work for you (even I had almost exact requirements as you), maybe you can play around this solution.

# Answer
> 0 votes
I had the same problem and somebody had a solution for me. I think it will be useful for you too. This **free** add-on is called Freeway. Then you can just map up the desired URL with the actual URL like this:

> section/subsection/category/thisismysite/{{entry}} =\> {{entry}}

Then people will be able to visit `/about` and EE will treat it as if they visited section/subsection/category/thisismysite/about and use the appropriate template\_group/template.

---
Tags: url, htaccess, rewrite, domain
---


# Question
Title: Save a Matrix fieldtype configuration to make it fixed and permanent for each entry of a channel
is there any solution to make permanent and repeat in each entry form a matrix fieldtype?

I would to make this set of field (includes row and colums) fixed for each new entry form in CP.

In other words i want to save this matrix configuration of rows, columns and cells and repeat the same for each entry of a particular channel.

Is it possible?

# Answer
If you only need to do this via the control panel you could create a 'default' entry and then use MX Cloner to duplicate it each time you create a new entry. That would start you off with all the Matrix data prepopulated on your duplicated entry.
> 1 votes

---
Tags: matrix, fieldtype
---


# Question
Title: Embed variables in the Query Module for expressionengine
Having an issue with the following sql within the query module.

```
SELECT
    exp_channel_titles.entry_id,
    exp_channel_titles.title,
    exp_channel_titles.url_title,
    exp_channel_titles.status,
    exp_channel_titles.channel_id,
    exp_channel_data.field_id_66,
    exp_channel_data.field_id_50
FROM
    exp_channel_titles

INNER JOIN exp_channel_data ON exp_channel_data.entry_id = exp_channel_titles.entry_id

WHERE
    exp_channel_data.field_id_50 = '{embed:member_group}'
OR
    exp_channel_titles.entry_id IN ({embed:additional_projects})
AND
    exp_channel_titles.status = 'open'
AND
    exp_channel_titles.channel_id = '14'

```

This issue I'm having is if the embed:additional\_projects variable has no value (or contains no additional project IDs) it throws an error.

The real test for access to an entry comes with the member group I would just like to add additional entries on a per ID basis if need be. Thanks in advance for any insight or help.

# Answer
> 2 votes
This sounds like a parse order issue. It's the sort of thing you could turn into a custom plugin really easily though, and it would avoid creating any SQL injection security issues at the same time.

Create a new file `third_party/my_plugin/pi.my_plugin.php`

```
<?php class My_plugin
{
    public function __construct()
    {
        $this->EE = get_instance();
        $this->EE->db->select('
                exp_channel_titles.entry_id,
                exp_channel_titles.title,
                exp_channel_titles.url_title,
                exp_channel_titles.status,
                exp_channel_titles.channel_id,
                exp_channel_data.field_id_66,
                exp_channel_data.field_id_50')
            ->join('exp_channel_data', 'exp_channel_data.entry_id = exp_channel_titles.entry_id')
            ->where('exp_channel_data.field_id_50', $this->EE->TMPL->fetch_param('member_group'))
            ->or_where_in('exp_channel_titles.entry_id', $this->EE->TMPL->fetch_param('additional_projects'))
            ->where('exp_channel_titles.status', 'open')
            ->where('exp_channel_titles.channel_id', '14');
        $result = $this->EE->db->result_array();

        $this->return_data = $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $result);
    }
}

```

Usage:

```
{exp:my_plugin member_group="{embed:member_group}" additional_projects="{embed:additional_projects}"}
    {title}
{/exp:my_plugin}

```

# Answer
> 0 votes
Can you try by passing parse="inward" parameter with query tag:

like:

```
{exp:query sql="SELECT....." parse="inward"}

---------------

{/exp:query}

```

---
Tags: embeds, query
---


# Question
Title: CartThrob Notifications - Multiple To Emails
I recently launched a EE site using CartThrob. I need to add multiple email addresses to a notification, the 'Email To' field. Here is a screenshot of the settings available (http://cl.ly/image/2Y2I1s1w441V). The 'Email To' field doesn't mention if you can add multiple emails. I aslo searched the CartThrob documentation but couldn't find anything either. I am guessing you might be able to separate emails using a comma.

Can you add multiple emails to the 'Email To' notification field?

# Answer
If you can't use a comma separated string, you could probably achieve the same thing by duplicating the notification and just using a different email address for each one. Because you can create as many different notifications as you like and there's nothing to say that you can't have more than notification for the same event.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Options for Member Restriction of data (eg entries)
I have a few member groups and I've setup matching Channels to manage restrictions for those different groups.

I actually know the answer to this question for a base install of EE. The only restriction option available on a Member Group basis is Channel.

Are there any techniques for improving on this? Or maybe 3rd party Add-ons I'm not aware of.

Eg. 10 member groups all with restricted access just to entries they can edit/publish (ie named Channels). I now need to setup a News channel. All members can publish a news story that also needs to be 'tagged' with their business area (one of 10). An obvious option for this would be 1 Channel called News with 10 Categories.

The issues is I don't want any member from member group 5 being able to edit or publish to member group 6. There isn't an option to restrict member groups by category.

The only option I can see at the moment is duplicating the News Channel 10 times! Applying Channel Assignment and including 10 channel names in my entries tag. Not very elegant.

Any ideas?

# Answer
> 1 votes
You may not be able to restrict member groups to categories in the control panel, but you could certainly do it in your templates if they're adding/editing content on the front end via Safecracker.

And just did a quick search on Devotee, and even though the intro for Entry Access says it's for use on the front end, if you read further down, it says:

> The restrictions also apply to editing entry from CP.
>
> Default permissions (for a new entry) can be set in extension settings.

---
Tags: members
---


title: Client defined categories

text:
# Question
Title: Client defined categories
I'm building an event schedule and I'm trying to conceptually figure out how to relate speaker information (name, title, bio) to times lots that the client will define.

Example:

**9-10am Session I** \- Link to Speaker 1 \- Link to Speaker 2 \- Link to Speaker 3

I've done this type of relation with other channels simply through using categories, but in this case I do not know what the time slots will be to set up the categories and template code in advance.

Is the solution as simple as giving the client access to the category group and have them add custom categories that correspond with the time slot?

Sorry if my questions are very basic. This is my first EE site.

Thanks.

# Answer
If you don't know the timeslots then it makes any solution a bit trickier. You could do it via categories by setting up a category group and then opening up access to your clients to add their timeslot as a category and tick that. It's probably not the cleanest solution however.

You may find Low Events to be useful in this situation which provides a specialised fieldtype for the purpose and makes it easier to retrieve information in your templates later on as needed.

This type of scenario is also more of a relationship where you would relate ***Speakers*** to an ***Event*** and allocate a timeslot. EE 2.6 (released earlier this week) now provides a big improvement to native relationship handling which, again could be useful addition in this scenario. If used in combination with Matrix then you could allow the users to log in and add themselves to a single Event entry with speakers, timeslots and topics in a grid display.

It all depends on your particular use case. But that should provide a good starting point.
> 0 votes

# Answer
Sounds to me like you'd want separate channels for events and speakers and then use EE's native relationship field or Playa to relate speakers to events.
> 0 votes

---
Tags: categories
---


# Question
Title: Low search for using grouped category dropdown
Just looking for a pointer in sorting out a search form.

I am implementing a property search form.

I have a search field and a couple of range filters, and a grouped category drop down.

See here...

```
{exp:low_search:form collection="cottages" class="walk-search-form" search_mode="all" query="{segment_3}" result_page="cottages/results"}

                    <label>Search for a cottage:</label>

                    <input type="text" name="keywords" id="keywords" class="span5" />

                    <label>Choose a county:</label>

                    <select name="search:cottage_county">
                      <option value="">Filter by Category</option>
                      {exp:channel:categories cache="yes" refresh="60" channel="cottages" disable="category_fields" style="linear"}
                      {if parent_id == '0'}{if count != '1'}</optgroup>{/if}<optgroup label="{category_name}">{/if}
                      {if parent_id != '0'}<option value="{category_id}">{category_name}</option>{/if}
                      {/exp:channel:categories}
                     </select>

                    <label>Sleeps a Max of:</label>

                    <select name="range:cottages_sleeps_max" class="span2">
                      <option value="">All</option>
                      <option value="1;">1 or more</option>
                      <option value="2;">2 or more</option>
                      <option value="3;">3 or more</option>
                      <option value="4;">4 or more</option>
                      <option value="5;">5 or more</option>
                      <option value="6;">6 or more</option>
                      <option value="7;">7 or more</option>
                      <option value="8;">8 or more</option>
                    </select>

                    <label>No of Beds:</label>

                    <select name="range:cottages_beds" class="span2">
                      <option value="">All</option>
                      <option value="1;">1 or more</option>
                      <option value="2;">2 or more</option>
                      <option value="3;">3 or more</option>
                      <option value="4;">4 or more</option>
                      <option value="5;">5 or more</option>
                      <option value="6;">6 or more</option>
                      <option value="7;">7 or more</option>
                      <option value="8;">8 or more</option>
                    </select>

                    <button class="btn btn-large btn-block btn-blue" type="submit">Search</button>

                {/exp:low_search:form}

```

So far the search field and the range dropdowns both work.

The category dropdown displays correctly, i.e.

```
Parent Cat
-child 1
-child 2
Parent Cat 2
-child 1

```

But when I perform a search on it, it returns every entry.

The other thing is that I want the category, and range values to remain selected once the search has been performed.

Low helped me before in a similar search form, but i've tried everything that was suggested there, but as this is a slightly different scenario, they don't seem to be working :(

**UPDATE**

OK I seem to have the category search working.

Changed `<select name="search:cottage_county">` to `<select name="category:cottage_county">`

This returns the right results, but is there a way for me to display the name of the category that they selected in the results page?

# Answer
> 0 votes
OK, Low has provided an answer to my question, but'll explain how I have just managed to solve this. My way is probably not the most optimised or efficient way, but it's working!

Firstly, to get the category name. I used Mark Croxton's Cat2 plugin.

`exp:cat2:name category_id="{low_search_category:cottage_county}"}` was all I needed to change the `id` to the `name`. I think this is essentially the same principal as using the `channel:categories` tag that Low has suggested.

My other issue was the "range" search dropdowns.

I managed to get this to keep the values once a search had been performed by using this in the form:

```
<select name="range:cottages_sleeps_max" class="span2">
    <option value="">All</option>
    <option value="1;" {if "1;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>1 or more</option>
    <option value="2;" {if "2;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>2 or more</option>
    <option value="3;" {if "3;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>3 or more</option>
    <option value="4;" {if "4;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>4 or more</option>
    <option value="5;" {if "5;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>5 or more</option>
    <option value="6;" {if "6;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>6 or more</option>
    <option value="7;" {if "7;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>7 or more</option>
    <option value="8;" {if "8;" == "{low_search_range:cottages_sleeps_max}"} selected="selected"{/if}>8 or more</option>
</select>

```

and then this in the results:

```
{if low_search_range:cottages_sleeps_max}Sleeps
  {if low_search_range:cottages_sleeps_max == "1;"}<strong>1</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "2;"}<strong>2</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "3;"}<strong>3</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "4;"}<strong>4</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "5;"}<strong>5</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "6;"}<strong>6</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "7;"}<strong>7</strong> or more.{/if}
  {if low_search_range:cottages_sleeps_max == "8;"}<strong>8</strong> or more.{/if}
{/if}

```

Again, I'm not entirely sure that this is the way it *should* be done. But it's working solidly.

# Answer
> 1 votes
Yeah, the syntax for the grouped category search filter is `category:group_name`, *not* `search:group_name`. The latter is the native search:-parameter.

And in this case, you don't even need to use the grouped category filter, as you only have a single group. The grouped category filter allows you to combine `AND` and `OR` queries, which requires at least 2 groups. Therefore, you could just use `name="category"`, the native category parameter.

To show the category name, you'll need to use the `channel:categories` tag. The `{low_search_category}` variable will contain a pipe-separated list of selected category IDs, so use the tag to get the corresponding names. Something like this:

```
{exp:channel:categories show="{low_search_category}"}

```

Be sure to use that inside either the Results tag, the Form tag or the Filters tag.

# Answer
> 0 votes
If the category shows up in the URL then you can easily pull it out with Low Seg2Cat:

```
{segment_n_category_name}

```

---
Tags: categories, search, low-search
---


title: EE Stash not passing to new page

text:
# Question
Title: EE Stash not passing to new page
I’ve seen an example almost identical to what I’m trying to attempt here: How to get attempted url before access restriction? However, my templates don’t see to want to cooperate: Template 1:

```
    {if logged_in}
     {embed="myfig/upload-view"}
    {if:else}
     {exp:stash:set name="login_form_return" scope="user" save="yes"}{segment_2}    {/exp:stash:set}
    {redirect="/myfig/"}
    {/if}
```

Template 2:

```
Stash: {exp:stash:get name="login_form_return"}

{if '{exp:stash:get name="login_form_return"}'}
     Proof Manager
     {if:else}
     Something else
     {/if}

 {exp:zoo_visitor:login_form
 error_handling="inline"
  }

 {if '{exp:stash:get name="login_form_return"}' =="myfig/proofmanager"}
 <input type="hidden" name="RET" value='myfig/proofmanager' />
 {if:else}
 <input type="hidden" name="RET" value="/myfig/dashboard/" />

 {/if}

```

Nothing returns on my GET attempt. What am I doing wrong?

# Answer
This will most likely be to do with parse order. EE templates get processed in layers rather than top to bottom and you're using a complex conditional. To move it up the parse order try this:

```
{if logged_in}
    {embed="myfig/upload-view"}
{/if}
{if logged_out}
    {exp:stash:set name="login_form_return" scope="user" save="yes"}{segment_2}    {/exp:stash:set}
    {redirect="/myfig/"}
{/if}

```

This converts it to a simple conditional and may very well solve the issue.
> 2 votes

# Answer
The redirects were killing the session. I had to try a different method of embedding a login form in the template I was in instead of redirecting
> 0 votes

---
Tags: stash, zoo-visitor
---


# Question
Title: Upgrade from EE1 to EE2 is causing some issues with Matrix
> Error Number: 1054
>
> Unknown column 'is\_draft' in 'where clause'
>
> SELECT row\_id, col\_id\_9 FROM exp\_matrix\_data WHERE field\_id = 20 AND entry\_id = 54 AND is\_draft = 0 ORDER BY row\_order ASC LIMIT 100
>
> Filename: third\_party/matrix/ft.matrix.php
>
> Line Number: 2808

This is the error I am receiving. I made a mistake when moving over fields where I was using the nGen File Field, so I don't know if that is adding to the issue.

What can I do to fix this?

# Answer
> 1 votes
Instructions for making that error go away are on the old P&T GetSatisfaction site: https://getsatisfaction.com/pixelandtonic/topics/matrix\_2\_5\_upgrade\_error

# Answer
> 0 votes
It might be related but had the exact issue yesterday going from 2.3 to 2.5. I updated the modules first and the error was because the latest matrix requires 2.4 minimum, updated EE to 2.5.5 and problem went away.

---
Tags: matrix
---


title: Arithmetic with forms

text:
# Question
Title: Arithmetic with forms
I have a form that will help a user build up a quote for fees to move house. The first page of the form will ask the user to select their nearest location from a drop down list, they will then enter the value of the house they wish to buy into a text field.

What I need to happen on the next page is to display the selected location from the drop down list and also the value they entered for the house, but also to display an estimated fee for purchasing the house.

The Fee is calculated by a series of ranges for each location, for example;

```
Location A
House Price | Fee
Up to 80000 | 100
80000 - 100000 | 200
Over 100000 | 300

Location B
House Price | Fee
Up to 80000 | 150
80000 - 100000 | 250
Over 100000 | 350

```

I have looked at various Form modules, but none of them do any kind of calculations. So I was wondering if anyone has done anything like this before with forms and calculations?

# Answer
> 1 votes
If you look at some forms modules (like FreeForm, Safecraker), you can have "entry\_id" within the "return" parameter value and this entry id will be a segment at the returm page. Now you can use SQL via query module to get the posted / saved values for the further calculations.

Let's take an example with FreeForm:

In the FreeForm form tag you can have return parameter as `return="template_group/template_name/%%entry_id%%"`

and you can fetch the saved values with query module in the template "template\_group/template\_name" like

```
{exp:query sql="SELECT form_field_1 AS location, form_field_2 AS house_price, form_field_3 AS fee FROM exp_freeform_form_entries_1 WHERE entry_id='{segment_3}'"}

Calculation : {house_price} * {house_price} * {fee}
/***
There are some good add-on for mathmatical calculation. Although, you can do mathmatical calculation within SQL.
***/
{/exp:query}

```

**Note**: You need to have form\_field\_x associated with correct field id. Above example SQL will work with FreeForm v4.0+. For lowser version you can write SQL like:

```
{exp:query sql="SELECT location, house_price, fee FROM exp_freeform_entries WHERE entry_id='{segment_3}'"}
Calculation : {house_price} * {house_price} * {fee}
/***
There are some good add-on for mathmatical calculation. Although, you can do mathmatical calculation within SQL.
***/
{/exp:query}

```

In the same way, if you are using Safecraker, you can do the same without SQL query and just by writing channel entry tag, passing the parameter entry\_id="{segment\_3}"

Hope, it would help you.

# Answer
> 0 votes
I would assume the best way to do this would be JavaScript. I have built something similar in the past for various sites that needed industry specific calculators. Almost always you want to handle this with JavaScript, so this would be better covered outside of most EE add-ons.

I would just use jQuery to make life easy. If you needed to save the results, just use Safecracker and save the data to a channel after the JS calculates your totals. This method would work with any of the form add-ons though.

As far the JS syntax and logic, well that is outside the scope of my answer.

---
Tags: forms, math
---


# Question
Title: Replacing category image field with a file browser
I'm writing an accessory to replace the category image field with a file browser that enables the user to navigate through folders to select their image (because the native category image field is restricted to a single upload directory).

Everything is nearly OK on the front end except that I'm getting

> Severity: Warning
> Message: Illegal string offset 'value'
> Filename: cp/admin\_content.php
> Line Number: 2223

when submitting the form and looking in the database, the value is *d*.

When using the native category image field, after choosing an existing image from the file manager, the updated HTML looks like:

```
<input type="hidden" name="cat_image_hidden" value="file_name.jpg">
<input type="hidden" name="cat_image_hidden_dir" value="1">

```

and that's what the HTML looks like too after I update using my method so I don't understand what's going on.

The code for my accessory looks like:

```
$this->EE->cp->add_to_head('
    <script src="/themes/third_party/category_image_file_browser/js/jquery.easing.min.js"></script>
    <script src="/themes/third_party/category_image_file_browser/js/jqueryFileTree.js"></script>
    <link rel="stylesheet" href="/themes/third_party/category_image_file_browser/css/jqueryFileTree.css">

    <script>
        $(document).ready( function() {

            function copy_file_path(file) {
                var newpath = file.replace("../images/", "");
                $("[name=cat_image_hidden]").val(newpath);
            }

            $("[name=cat_image_hidden_dir]").val("1");
            $(".category_field .no_file select,.category_field .modifiers.js_show p,.category_field .file_set.js_hide .filename,.category_field .file_set.js_hide .sub_filename").hide();
            $(".category_field .file_set.js_hide").show();
            $(".category_field .modifiers.js_show").fileTree({ root: "../images/", script: "/themes/third_party/category_image_file_browser/connectors/jqueryFileTree.php" }, function(file) {
                copy_file_path(file);
            });
        });
    </script>
');

```

I've looked through the HTML and don't see any other form inputs I should be updating, but I've obviously missed something.

Anyone know what that is?

For reference, I'm using http://www.abeautifulsite.net/blog/2008/03/jquery-file-tree/ for the file browser. This part, selecting the value, all works fine; it's only saving to EE that I'm having trouble with.

# Answer
> 1 votes
This error message appears to be something added with PHP 5.4, to indicate when array values aren't filled in.

It may be that you already understand that, from what you've said, but if not, looking through comments and answers here may illuminate and offer tips:

https://stackoverflow.com/questions/9869150/illegal-string-offset-warning-php

Now, how to find out what's missing? The best way to do it may be on your browser, rather than in PHP, especially as you've manipulated with JQuery.

I'm using Firebug on Firefox, and I can see what fields there are by inspecting the appropriate area of the screen. Then I can see the value of each by clicking on that tag and using the DOM listing on the right to discover the value in it.

I think that should show you what's empty in what becomes the returned fields array in EE, and let you solve the problem.

Be sure to write your answer and accept when you do find it, so that this question clears on EESE. As I think it will be you who actually locates the fault.

edit: whoops, I intended this to be a comment, rather than answer. But see if it gets you there anyway. CNS

---
Tags: categories, category-image-field
---


# Question
Title: Show the category image belonging to specific post
So on the Happy Monday website (http://www.happymondaypodcast.com) we have different sponsors for each show, these sponsors are set up as categories and assigned to the "Episodes" channel. I want to be able to select the sponsor for each show and have the category image (mailchimp, typekit etc.) show up for each episode.

The problem I'm having is that it's showing all sponsors, regardless of what has been selected in the individual episode posts.

The code I'm using is:

```
 {exp:channel:entries channel="podcast_episodes" category="1" limit="1" dynamic="no"}
<div class="hero_show" style="background: url('{guest_picture}') no-repeat right top #ffffff;">
            <div class="show_info">

                <h3><a href="{url_title_path='episodes'}">{episode_number} {title}</a></h3>
                <span class="date">{entry_date format="%l %d%S %F %Y"}</span>
                        <!--<p>{podcast_description}</p>-->

                {podcast_player_link}

    <div class="sponsors_small">
        <p>Made possible by:</p>
        {exp:channel:categories channel="podcast_episodes" category_group="2" style="linear" show_empty="no"}

               <img class="category_image" src="{category_image}" alt="{category_name}" title="{category_name}"  />
            {/exp:channel:categories}

        </div>

            </div>

{/exp:channel:entries}

```

Any help would be so much appreciated. Completely stuck.

# Answer
> 3 votes
{exp:channel:categories} is used to output a list of categories belonging to a category group or assigned to a channel.

What you want here is a list of categories assigned to an entry so you should use the category variable pair

```
{categories show_group="2"}{category_image}{/categories}

```

That should get you what you need.

**Alternative setup**

As always with EE, there are multiple ways to skin a cat. Instead of using categories, you could also consider using a sponsors channel and then use a relationship between your episodes and the sponsors.

The advantage of that approach is that you get to use all the custom fields you want to define your sponsors data structure (multiple thumbnails, name, type of sponsors, etc.).

PS: Happy Monday makes my Mondays brighter, keep it up.

# Answer
> 2 votes
Just a few small tweaks needed. Firstly you're including `dynamic="no"` in your Channel Entries tag. Normally EE will grab the URL title to determine which entry to display but by including that tag you're telling it not to.

With regards to the categories you can remove the `{exp:channel:categories}` tag pair and replace with the {categories} tag pair:

```
{categories show_group="2"}
    <img class="category_image" src="{category_image}" alt="{category_name}" title="{category_name}"  />
{/categories}

```

So now EE is dynamically grabbing the entry and then looping through that individual entry's categories to show the desired information for each one. In full it should look something like this:

```
{exp:channel:entries channel="podcast_episodes" limit="1"}
    <div class="hero_show" style="background: url('{guest_picture}') no-repeat right top #ffffff;">
        <div class="show_info">
            <h3><a href="{url_title_path='episodes'}">{episode_number} {title}</a></h3>
            <span class="date">{entry_date format="%l %d%S %F %Y"}</span>
            <!--<p>{podcast_description}</p>-->

            {podcast_player_link}

            <div class="sponsors_small">
                <p>Made possible by:</p>

                {categories show_group="2"}
                    <img class="category_image" src="{category_image}" alt="{category_name}" title="{category_name}"  />
                {/categories}
            </div>
    </div>
{/exp:channel:entries}

```

# Answer
> 0 votes
Have you tried the categories tag pair parameters something like this

`{categories show_group="1" limit="1"}{category_image}{/categories}`

---
Tags: categories, category-image-field
---


# Question
Title: Limit Safecracker access to specific entries, using member groups and categories
I'm wondering about best practice, and if I'm setting myself up for trouble.

**The goal**: Limit an editor's Safecracker access to specific entries within a channel, based on the member group of the editor.

**The setup**: I'm using Zoo Visitor for members as channel entries. Thinking of using categories to limit Safecracker access within a channel.

**An example**: my\_member\_channel has an entry named Dan, who is in my\_editors member group. Dan needs to be able to edit other users in the my\_member\_channel that have the category "Editor Category" selected, but no others.

**This seems to work:**

```
    {exp:channel:entries channel="my_member_channel" limit="1"}

    {categories}

        {if category_id == 1 && (member_group == '6' || member_group == '8')}
            {!--
                If the category "Editor Category" (1) is selected, and the logged in user is in my_standard_admin (6) or my_editors (8) member group.
                --}

            {exp:safecracker
                channel="my_member_channel"
                entry_id="{segment_3}"
            }

                Various fields in the channel to be edited here,
                including a Matrix field with a Playa column:
                {field:my_matrix_field}

                submit button
            {/exp:safecracker}

        {/if}

    {/categories}

{/exp:channel:entries}

```

I tested this lightly, but it seems to work fine. So if I continue down this route I'll create "pseudo member categories" to be used in various channels and then conditionally check before showing the Safecracker form.

**Am I missing a much more stable approach?** I would prefer doing this all using the CP, but can't seem to work out a way to dole out the permissions in a custom enough way, therefore Safecracker.

# Answer
i wouldn't wrap safecracker inside a channel:entries tag. Fields like title, url\_title etc. might collide. You can use an embed with safecracker (pass thru data) or use stash to capture info from the other channel first, and stash:get inside safecracker to show/hide information.

If there are multiple categories assigned, you might also want to limit the output of the {categories} tag with show="" and limit="" parameters:
http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#categories-tag-pair-parameters
> 1 votes

---
Tags: safecracker, zoo-visitor
---


# Question
Title: How to show current search when filtering using dynamic parameters
I'm looking to create a filtering system for entries. I need to be able to filter by multiple criteria.

I've started to use the dynamic parameters feature, using the 'search' parameter to filter using custom fields.

**My question is this:** How can I show what current search terms are being used? As the URL doesn't change it doesn't appear we can use that, but I need to be able to show what filters are currently being applied.

Any ideas on this will be gratefully received, or any alternative methods or add-ons that will make this kind of filtering of entries easy.

Thanks in advance,

Tom

# Answer
> 1 votes
I do this using great addon from Rob Sanchez http://devot-ee.com/add-ons/dynamo (going to use default EE search, but dynamic parameters are not passed when using pagination).

not sure if you are ok with submitting the form with your inputs, but you can show (even select) your filter criteria..

Let us know

---
Tags: search, dynamic, filter, parameters
---


title: EE and dedicated mobile sites

text:
# Question
Title: EE and dedicated mobile sites
We're running EE2, going to have a responsive desktop site...but rather than going with a "mobile first" design, which is kind of bland, we'd like to have both a responsive (for desktop/laptop/tablet, with a few extra tools and some extra "decoration") and a dedicated mobile (for mobile, and for tablet users who prefer something leaner.) But I just know that one of the requirements is going to be, "preserve the SEO of the URL structure."

Has anyone done this? Is it possible to have a dedicated mobile site and keep the same, or nearly the same, URL/template group structure (for SEO purposes)? I've found the tutorials that tell people how to set up dedicated mobile sites on their EE, but couldn't find anything definitive about using such a setup with multiple template groups.

EDIT: we will eventually be replicating this solution across at least four, likely five sites - so keeping the cost low is a factor here. (And when we redesign a site, we start with a clean install/clean database, so putting multiple sites on an MSM isn't necessarily the best option either.)

EDIT the SECOND: we will be creating a subdomain for this mobile-only site. This may be important in how people answer - apologies, I left that detail out.

# Answer
> 2 votes
Setting aside the debate of responsive vs dedicated mobile version (agreeing with Ian here), there was a good article back in the days on Erskine Design about building a separate version of your site without using MSM. That approach uses global variables to serve different templates to mobile users

You could combine that approach with the RESS-ee plugin by Tyssen.

# Answer
> 1 votes
If you're creating a sub-domain for a mobile only site in addition to the main install then I can't see any other way than to buy MSM as they will be two different sites (refer to the EE licencing).

However I'm not sure why you say a responsive website needs to be bland? There are plenty of responsive websites which work on mobile which are anything but bland. The design is adapted to the constraints of the device and on a screen display the size of a mobile phone screen this means that you focus the content a little more and prioritise information. You then add to this as the screen space increases. If you built a mobile only website I don't see what difference they'll be to the screen size limitations so you'd still have to prioritise content and consider usability on a smaller screen.

Personally I'd always go with a single responsive website which cuts down on separate installs, multiple code bases to manage and maintain and generally just more work in keeping the two in sync throughout their lifetime.

# Answer
> 1 votes
I'm currently in a situation similar to yours. Most of my needs will be accomplished with just CSS media queries, but I found these articles of interest, while I was researching:

http://www.netmagazine.com/tutorials/going-mobile-expressionengine http://www.johnfaulds.com.au/journal/responsive-layouts-with-expressionengine/

# Answer
> 1 votes
Not specifically answering the question, this is how I sometimes approach mobile development...

Most of the site would just be regular templates with responsive design.
For pages where a completely different mobile experience would be beneficial, ie. the checkout process, I would detect for mobile then serve a separate template.

```
default_site/
| checkout.group/
| | index.html
| | _regular.html
| | _mobile.html

```

So index.html would look *something* like:

```
{if not_mobile}
  {embed="checkout/_regular"}
{/if}
{if mobile}
  {embed="checkout/_mobile"}
{/if}

```

The conditionals come from either MX Mobile Device Detect or by making the mobile variables available in my config bootstrap. (I use Focus Lab's Master Config Bootstrap)

```
$useragent = $_SERVER['HTTP_USER_AGENT'];
if (preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i',substr($useragent,0,4))) {
  $env_config['mobile'] = true;
} else {
  $env_config['mobile'] = false;
}

$master_global = array(
  'mobile' => $env_config['mobile'],
  'not_mobile' => $env_config['mobile'] ? false : true
);

```

# Answer
> 0 votes
To do this I would use MSM and have a seperate "mobile" site set up. Using this separate site you now set up your mobile templates with the exact same name as the ones in your main site, but with the mobile style that you need. Call your channel entries with the site="default\_site" parameter and you'll now have a mobile only site that has the exact same url structure and pulls content from the main site.

You'll then need some sort of javascript to redirect your mobile visitors to the mobile version of your site. I'd probably set up a subdomain m.domain.com

Hope this helps.

---
Tags: ee2, multiple-sites
---


# Question
Title: Custom labels in safecracker error messages
I'm currently setting up a multilanguage website that enables members to update their own information, news, events, etc. For adding and updating this personalized content I'm using safecracker and it's working fine. One thing I cannot get around is rather cosmetic but important for user experience: validation error messages.

I'm using different language packs to be able to view the inline error messages in the right language of the user. However the problem is that the is that the fieldname in the error message is the name of the field in EE, in my case it has been defined in English. The end result is that it displays the error half in English (the fieldname) and half in the userlanguage (e.g. dutch or french), like this

"Het veld Company Name is een verplicht veld"

Of course this does not make sense to an enduser... My question: is there a way to pass a variable to the {error:field\_name} that can be used a field name in the error message e.g. `{error:field_name label="Bedrijfsnaam"}` (Bedrijfsnaam is Company Name in dutch fyi) so the error message then is shown completely in the correct language

"Het veld Bedrijfsnaam is een verplicht veld"

rg, Tim

# Answer
> 1 votes
The method above works, but to avoid annoyances with multiple validation rules, I came up with this work around.

Since I'm using inline errors and I am displaying the error just below the field where it occured, I've manually edited the languages file like in /system/expressionengine/language/dutch and I took out all the '%s' for the error messages where I don't need it. By doing this the name of the field is not shown in the errormessages

# Answer
> 0 votes
It all depends on how you've setup your multi-lingual website but if you're following this type of method then you just need to throw in a conditional check for the language within your error checking, like this:

```
{if error:field_name}

    Default language error message

    {if language="en"}
        English error message
    {/if}

    ...

{/if}

```

---
Tags: safecracker, multi-language
---


# Question
Title: how to make safecracker login form open in a new window/tab
I currently have a safecracker login form which enables specific users to login and download files. \[click here\]\[1\] I have noticed when a user logs in they are redirected to the following link \[click here\]\[2\], however the link loads in the same window. Is there a way to do this where once the user has logged in an a new window/tab is created with the download credentials? Below is a snippet of my `return=` code.

```
{exp:member:login_form return="press/promo/{segment_3}"}

```

# Answer
> 1 votes
I would suggest you to have easy approach by using "jQuery Form Plugin" (http://malsup.com/jquery/form/). To get some better ideas see the examples. For the Ajax submit you can use the code like:

```
$(document).ready(function() {
var options = {
beforeSubmit : function(){},
success : function(data, status, oo){
window.open ('[URL]', '[Window Title]');
}
};
$('#FORM_ID').ajaxForm(options);
});

```

See within the success function, window.open will open the given URL in new window. For more about window.open take a reference from http://www.javascript-coder.com/window-popup/javascript-window-open.phtml

Hope, it would help you.

---
Tags: templates, safecracker, members
---


# Question
Title: Can I Modify Custom Field Variables Before Output?
Here's the situation:

I have a custom field named {article} that contains and outputs formatted articles. I would like to be able to **modify** that {article} variable before it outputs in the template. To be specific, I would like to insert an Adsense ad after the first paragraph of each article.

Is this possible in any way shape or form?

Any feedback and/or help is appreciated...

# Answer
> 2 votes
Hop Studios Hop Inject was created primarily for that purpose. It can be used for other times when you need to inject things within content. I haven't used it, our clients don't run ads. But have heard good things about, including it's ease of use.

For example, with Low Replace, you'd have to insert code/text that would be replaced.

# Answer
> 2 votes
One way you could do this is to use Low Replace, using a regular expression to insert the ad after the first closing `</p>` tag, or a comment added to the markup `<!-- ad-here -->`. You can do this right from the template without any need to get into PHP, assuming there's a consistent way to identify the insertion point.

Edit: You also have the option of enabling PHP for the template (probably on output) and doing the same thing without using an add-on.

# Answer
> 1 votes
My answer was terrible! But I'm not going to delete it. Might help someone inserting without scripts.

---

You can use jQuery with \[**.insertBefore()**\] **.insertAfter()**:

```
<div class="article">
    {article}
</div>

$('AD CODE HERE').insertAfter('.article p:first-child');

```

Change single quotes to double quotes in your AD CODE or change single quotes in my JS example to double quotes and have all your AD CODE use single quotes.

# Answer
> 1 votes
For future folks looking for the same thing. String Divide does this exact thing easily and it's free.

---
Tags: custom-fields
---


# Question
Title: Not all entries are shown via markers on Google Maps for EE
I have a problem with displaying all markers on a map. My channel has 129 entries for dealers that need to be shown on a map. For some reason only 95 are displayed via a marker on the map. The template setup is relatively easy

```
{exp:channel:entries channel="dealers" dynamic="no" disable="categories|member_data|pagination" limit="999"}

// all sorts of data about the dealer like name, phone, etc in a list

// the markers
{exp:gmap:marker
        id="map"
        infobox="true"
        extend_bounds="false"
        icon="/themes/third_party/gmap/icons/pin-location.png"
        latitude="{dealers_latitude}"
        longitude="{dealers_longitude}"
        zoom="8"
        clustering="true"
        show_one_window="true"
        limit="1"
        style="width: '350px'"
        offsetY="-45" // Offset the X position of the window
        offsetX="15" // Offset the Y position of the window
        closeBoxMargin="5px" // Sets the box margin (could also be done in stylesheet)
        class="ui-infobox-dark" // Uses the dark theme made available by Google Maps for ExpressionEngine v3
        closeBoxURL="/themes/third_party/gmap/css/images/white-close-button.png" //Uses an alternative close button
        open_windows="false"
        //geocode="true"
        }

{/exp:gmap:marker}
{/exp:channel:entries}

```

It appears that -as expected- the javascript is not generated for the entries that not shown. It is not random, so the problem is consistent. But I really cannot see why those entries would be different than any others..

I’m running EE 2.5.5 and Google Maps 3.2.3

rg, Tim

# Answer
> 1 votes
Got response from the developer. Thought I post it here too for others to use it. Setting

```
geocode="false"

```

does the trick

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


# Question
Title: Paypal error - You do not have permissions to make this API call
I'm getting the below error when trying to make a payment in store:

You do not have permissions to make this API call I've checked and the paypal express settings are all correct and it's pointing to the live server and not testing - do you know why this could be?

Thanks Guy

# Answer
> 1 votes
Is your PayPal email address confirmed? See this article at Yahoo!, also make sure you've switched everything from Sandbox to your actual account. This is more a PayPal error than anything to do with ExpressionEngine, but those are starting points.

---
Tags: expresso-store
---


# Question
Title: Site doesn't work with WWW at the start of the address
We're using EE and I'm also using the Focus Lab Multi Environment Config file on one of our sites and for some reason our site won't work with WWW at the start of the address.

I have confirmed with the hosting provider that everything is correct from their end, but am confused as to where to move from here.

Is there something in the config file that should be modified to make this work again?

Very new to the Focus Lab Config file.

# Answer
> 3 votes
In your Focus Lab Config `config.env.php` file, you might need to make sure that both www and non www are specified in the `switch` statement.

```
switch ($_SERVER['HTTP_HOST']) {
  case 'website.com' :
  case 'www.website.com' :
    define('ENV', 'prod');
    define('ENV_FULL', 'Production');
    define('ENV_DEBUG', FALSE);
  break;

  ...
}

```

But saying that, you should really only be using one or the other. Being able to access the site using www and non-www will lead to duplicate content on Google. Not good.

Your htaccess needs to have something like this to force the removal of www.

```
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteCond %{HTTP_HOST} ^www\.website\.com$ [NC]
  RewriteRule ^(.*)$ http://website.com/$1 [R=301,L]
</IfModule>

```

There are many different ways to do it and you can find plenty of resources on how to do it.
Here's one on how to force www.

---
Tags: ee2
---


# Question
Title: CartThrob: display content if certain product is in package
I'm using CartThrob for e-commerce. I need to display a block of content only if the package displayed contains a product with a certain entry\_id. I was assuming I could just wrap the block of content in a conditional that checks the included products for an entry\_id? The channel entry\_id of the product I need to check for is 23.

If possible, I could also use a tip on how to enable shipping only for packages that contain this product with this entry\_id.

Here is my main template:

```
{exp:channel:entries channel="rides" limit="1" dynamic="no" url_title="{segment_3}"}
            <main role="main" class="inner-page view">
        <p class="read-more"><a href="/pro-rides" class="blue">« Back to Pro Rides</a></p>
                    <article>
            <h2>{title}</h2>
            <img src="{ride_img}" alt="{title}, ${ride_price}" />
            <p class="lead">Price: ${ride_price}</p>
            {if ride_body}
            <p>{ride_body}</p>
            {if:else}
            <p>{ride_excerpt}</p>
            {/if}
        </article>
        <section>
            {embed="views/.packages"}
        </section>
{/exp:channel:entries}

```

Here is the embedded packages template:

```
{exp:channel:entries channel="store_packages" dynamic="no"}
{if related_ride == "{segment_3}"}
    <ul>
            <li>{title}, {entry_id}: {packages_price} </li>
            {!-- check for product entry_id inclusion --}
            <li><!-- content displayed conditionally --></li>
            {!-- end conditional --}
            <li><p class="read-more"><a href="{entry_id_path=checkout/cart}" class="blue">Purchase Ride now »</a></p></li>
    </ul>
{/if}
{/exp:channel:entries}

```

# Answer
> 0 votes
I ended up finally figuring out how to access the custom cartThrob Package fields (I couldn't find any documentation in the cartThrob docs for this) and used the following:

```
{exp:channel:entries channel="store_packages" dynamic="no"}
{if related_ride == "{segment_3}"}
    <ul>
            <li>{title}, {entry_id}: {packages_price} </li>
            {packages}{if "{sub:entry_id}" == "23"}Bring your own Bike{if:elseif "{sub:entry_id}" == "24"}Rent our Bike{/if}{/packages}
            <li><p class="read-more"><a href="{entry_id_path=checkout/cart}" class="blue">Purchase Ride now »</a></p></li>
    </ul>
{/if}
{/exp:channel:entries}

```

Now off to figure out how to add shipping only to packages that contain this product entry\_id!

---
Tags: cartthrob, conditionals, ecommerce
---


# Question
Title: Stash List & Matrix Rows Returning Empty
Firstly let me say I'm probably making a really simple mistake, this is my first time using Stash so I'm trying to get my head around it. I've spent the last 45 minutes searching through Google and on here and can't find a solution.

The problem I'm having is I'm setting a stash\_list which has Matrix tags inside of it, but when I'm using get\_list I am getting the correct amount of rows returned, but they are empty.

Here is what my model view looks like: {!-- load stash view --} {stash:embed:layouts:standard}

```
{!-- create standard page model --}
{exp:channel:entries channel="standard_page" limit="1"}

    {!-- content (general) --}
    {exp:stash:set}
        {stash:title}{title}{/stash:title}
        {stash:introduction}{standard_introduction}{/stash:introduction}
        {stash:content}{standard_content}{/stash:content}

        {!-- helpers --}
        {stash:entry_id}{entry_id}{/stash:entry_id}
    {/exp:stash:set}

    {!-- content (lists) --}
    {exp:stash:set_list name="content_sections" parse_tags="yes"}
        {mx_standard_sections}
            {stash:section_title}{heading}{/stash:section_title}
            {stash:section_content}{content}{/stash:section_content}
        {/mx_standard_sections}
    {/exp:stash:set_list}

{/exp:channel:entries}

```

And here is what my view looks like:

```
<h1>{exp:stash:title}</h1>
<h2>{exp:stash:introduction}</h2>
<div class="content">
    {exp:stash:content}
</div> <!-- close content -->

<ul>
    {exp:stash:get_list name="content_sections"}
        <li>
            <h1>{exp:stash:section_title}</h1>
            {exp:stash:section_content}
        </li>
    {/exp:stash:get_list}
</ul>

```

My normal Stash fields work, however my get\_list returns this:

```
<ul>
        <li>
            <h1></h1>

        </li>

        <li>
            <h1></h1>

        </li>
</ul>

```

So I'm not quite what's going on. Stash clearly knows there is two Matrix rows with data inside them, however it won't return the data at all. Thanks in advance for any help I get, and I apologise if it's a stupid mistake!

Thanks, Ben

# Answer
> 0 votes
When retrieving your list you're already in the context of that list so just change your called variable tags to the following:

```
<ul>
    {exp:stash:get_list name="content_sections"}
        <li>
            <h1>{section_title}</h1>
            {section_content}
        </li>
    {/exp:stash:get_list}
</ul>

```

You don't need the `exp:stash` prefix.

---
Tags: matrix, stash, parse-order
---


title: Output segment_x via template HTML

text:
# Question
Title: Output segment_x via template HTML
Using EE 2.5.5, I wish to output a segment\_x (segment\_2, which aligns with our department names) so that I may class by department; i.e.,

```
<article class="main {segment_2}">
    <more html goes here>

```

would become

```
<article class="main lead-pipes">
    <more html goes here>

```

However, I can not add {segment\_2} to HTML portions of the template, nothing outputs.

How to do so?

# Answer
> 0 votes
It should be as simple as `{segment_2}` with nothing else you need to do. Have you checked what is being output in the browser dev tools?

---
Tags: templates, segments
---


# Question
Title: Find consecutive empty cells in Matrix field
I'm trying to build a seat reservation system for a small cultural venue. I will be using a matrix field mimicing all the seats (rows for seat rows, colums for seat numbers). If someone makes a reservation for 3 seats, I would like to go through the Matrix field (in the template, not in de CP) and find 3 consecutive empty fields. Would this be possible purely with EE code? Or should I dive into php, and if so, what would be the best solutions for this?

# Answer
This definitely sounds like something that will involve some PHP along with some SQL queries to loop through the result set. The cleanest way would be to place it in an extension which gets called at the time of making a reservation. I'm not sure if you're using an ecommerce addon or not so can't provide a specific hook but each cart will no doubt have a hook which you can use to latch on to at that point in the process to execute your extension and make the query.
> 0 votes

---
Tags: matrix
---


title: creating a slider using a matrix field

text:
# Question
Title: creating a slider using a matrix field
When creating a slider on my home page i had set the slider up as a channel, this allowed me to edit the channel and create a limit on how many slides where published. I was using the method of content -\> publish -\> slider to create a new slider. I would like to create a slider using a matrix field. I have create a variable group that allows me to edit the homepage and one of those variables is a matrix field, this is what i would LIKE to use to function my slider. How do i call the slider into my code correctly via a matrix field. Really my question is how does EE know im calling my matrix data?

# Answer
> 0 votes
When you are saying

> I created a variable group

I suppose that you are using Low Variables. That's generally the approach I take. Using Low variables, you just have to display the variable in your template using a tag pair and then use the normal matrix tags.

**Sample code:**

Low variable is called {lv\_homeslider}

Matrix columns are called {matrix\_slide\_img}, {matrix\_slide\_url}, {matrix\_slide\_text}

```
{exp:low_variables:pair var="lv_homeslider"}
    {matrix_slide_img}
    {matrix_slide_url}
    {matrix_slide_text}
{/exp:low_variables:pair}

```

Hope that helps

EDIT: using low variables to the fullest

---
Tags: matrix
---


# Question
Title: Everytime I save a low variable, it returns the home page
Everytime I click save on low variables page I end up on this url (below) but the homepage of my website is shown and the low variables are not saved.

http://locantro.com/admin.php?S=0&D=cp&C=addons\_modules&M=show\_module\_cp&module=low\_variables&method=save

# Answer
> 2 votes
Looks like a `mod_security` thing. Hard to trace and figure out exactly what triggers it. Check this thread on GetSat and ask your host to disable or add an exception.

---
Tags: low-variables
---


title: Channel Videos with https?

text:
# Question
Title: Channel Videos with https?
Has anyone used the Channel Videos add-on with https? I have tried rewriting all of the URLs in the add-on with https and also tried rewriting the URLs to just //, without a protocol. Both of those methods still produce insecure content on the site. I would appreciate any feedback the community has to offer. I love this add-on, and I really want to use it on this site.

# Answer
> 0 votes
As it turns out, Channel Videos has https built in.

# Answer
> 0 votes
How about wrapping your Channel Video tags with Find and Replace to swap out the protocol:

```
{exp:replace_plus find='http:' replace='https:'}

    {exp:channel_videos:videos}
        <!-- Template Code -->
    {/exp:channel_videos:videos}

{/exp:replace_plus}

```

As I've not used Channel Videos before and can't see what is actually being output in the template files you may need to tweak it a bit.

# Answer
> 0 votes
Taking YouTube as an example, how about adding this to your .htaccess file:

```
RewriteEngine on
RewriteBase /
RewriteRule ^youtube/(.*)$ http://www.youtube.com/$1 [L]

```

And then prefixing the video link with your domain over HTTPS:

```
<embed src="https://www.yourdomain.com/youtube/v/embed_code" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed>

```

The key is adding `https://www.yourdomain.com/youtube/` to the source URI. Apache will then see this and rewrite them to the regular YouTube URI which may result in removing the security warnings.

Again, having not used Channel Videos specifically I'm not sure how you add the source URI but if you have control of this then give that a go.

---
Tags: channel-videos
---


title: Clearing Stash in Loops

text:
# Question
Title: Clearing Stash in Loops
I'm having an issue with stash holding onto some content when looping through records.

I have a BrilliantRetail catalog listing page which loops through all the entries in a category. Within this tag, I'm using the related\_products tag to pull out the related products and then store them in two different places within that loop so that I don't have to call and execute the related\_products tag twice.

However, on products which don't have related entries it appears to be just repeating the stored content.

```
{exp:stash:set parse_tags="yes" parse_conditionals="yes" name="br_bulk"}
                        {exp:brilliant_retail:product_related product_id="{product_id}"}
                            {related_products}
                                {if "{related_type_id}"=="2"}
                                    <a href="{exp:brilliant_retail:path src='product/{related_url}'}" title="click here to view {related_title}">{exp:snippet total="40"}{related_title}{/exp:snippet}</a><br />
                                    </li>
                                 {/if}
                            {/related_products}
                        {/exp:brilliant_retail:product_related}
                {/exp:stash:set}

```

and then further down the page, I have two pieces of code which are:

```
 {if "{exp:stash:not_empty name='br_bulk'}"}
                                   <div class="bulk">
                                    <strong>Bulk Order Options Available</strong>
                                    <br /><br />
                                   {exp:stash:br_bulk}
                                   </div>
{/if}

```

followed by a final

```
{exp:stash:destroy name='br_bulk'}

```

Just before I close the {exp:brilliant\_retail:catalog} tag.

However, it looks like this 'destroy' function isn't working as expected (or I've misunderstood its function).

# Answer
> 3 votes
Given that the Stash set is inside a loop, the resulting output would repeat your code above multiple times. Thus you would have multiple instance of `{exp:stash:not_empty name='br_bulk'}` and `{exp:stash:br_bulk}` in your template. The first instance of each of these will be parsed by EE, but subsequent instances will be replaced with a marker that will later on be replaced with the cached value of the first instance. In other words, EE will cache the tag because it assumes the output will be identical.

To avoid this add the word `random` to your tags:

```
{if "{exp:stash:not_empty name='br_bulk' random}"}
...
{/if}

{exp:stash:br_bulk random}

```

Or, use context to make them unique, perhaps using the `{entry_id}` of the current iteration:

```
{exp:stash:set parse_tags="yes" parse_conditionals="yes" name="br_bulk" context="{entry_id}"}
   {exp:brilliant_retail:product_related product_id="{product_id}"}
      {related_products}
      {if "{related_type_id}"=="2"}
      <a href="{exp:brilliant_retail:path src='product/{related_url}'}" title="click here to view {related_title}">{exp:snippet total="40"}{related_title}{/exp:snippet}</a><br />
      {/if}
      {/related_products}
   {/exp:brilliant_retail:product_related}
{/exp:stash:set}

{if "{exp:stash:not_empty name='br_bulk' context='{entry_id}'}"}
   <div class="bulk">
      <strong>Bulk Order Options Available</strong>
      <br /><br />
      {exp:stash:get name="br_bulk" context="{entry_id}"}
    </div>
{/if}

```

---
Tags: stash, cache, brilliantretail, dry
---


title: EE 2.6.0 not parsing {page_url}

text:
# Question
Title: EE 2.6.0 not parsing {page_url}
Is anyone else find that {page\_url}, whether using Pages or Structure, is not being parsed at all?

# Answer
> 4 votes
I found that the new Parser logic doesn't account for page\_url in their $this-\>\_urls block. Adding the following after line 423 of Simple\_variable.php is the fix:

```
elseif ($key == "page_url")
{
    $tagdata = str_replace(LD.$key.RD, $data['page_url'], $tagdata);
}

```

---
Tags: structure, pages
---


title: Orderby Not Working

text:
# Question
Title: Orderby Not Working
I have a channel field named {board\_sort\_order} and I limited the entry to Integer. I am trying to use that field to order the dynamic listing on the template. I have tried everything and search ALL of Google (almost, anyway) and cannot get the sort order to take effect.

Here is my template tag:

```
{exp:channel:entries channel="leaders" disable="pagination" search:is_board="Yes" orderby=(int){board_sort_order} sort="asc"}

```

I have tried it with and without the implicit PHP cast of (int).

Also if I leave out "sort="asc." I just get the records in the reverse order of how they were input.

ANY help is GREATLY appreciated.

# Answer
It looks you have a syntax error in your tag. Try this:

`{exp:channel:entries channel="leaders" disable="pagination" search:is_board="Yes" orderby="board_sort_order" sort="asc"}`
> 1 votes

---
Tags: templates
---


title: MX Notify Control unsubscribe link

text:
# Question
Title: MX Notify Control unsubscribe link
Anyone out there use MX Notify Control? I am using the extension to send an email to a mailing list for a new channel entry.

It uses a standard template as the email, problem is I need to include an unsubscribe link in the template. Since it is not using a mailing list template I have no way to include a mailing list unsubscribe link.

Anyone know how you can create an unsubscribe link OUTSIDE of a mailing list template?

# Answer
> 1 votes
There is no tag for {unsubscribe\_url} or {unsubscribe\_link}.

As you are using the MX Notify Control extension and creating your own email notify template.

Within this template, you can try following SQL with query module to create unsubscribe link for an email:

```
{exp:query sql="SELECT exp_actions.action_id, exp_mailing_list.authcode FROM exp_mailing_list, exp_actions WHERE email='{mbr_email}' AND class='Mailinglist' AND method='unsubscribe'"}
<a href="{site_url}index.php?ACT={action_id}&id={authcode}">Unsubscribe</a>
{/exp:query}

```

You might need to update the {email\_address} in WHERE condition.

I hope, it would help you.

---
Tags: notification, mailing, mailinglist
---


title: pagination_marker

text:
# Question
Title: pagination_marker
When viewing a single entry in the category I am using pagination to view the second entry http://domain.ca/index.php/showroom/category/CATEGORY\_NAME

Next goes to http://domain.ca/index.php/showroom/category/CATEGORY\_NAME/P1 and so on.

But If I view the same page with an entry url: http://domain.ca/index.php/showroom/url\_title My pagination switches to: {pagination\_marker}

I have pagination="inline"

How do I get pagination to work both on a /P1 page as well as a url\_title page?

I want to be able to display a single entry at a time with a link to go to next / previous. using a single template if I am viewing a category or a single url\_title entry

# Answer
> 1 votes
I ended up just using http://devot-ee.com/add-ons/next-previous-links-anywhere seemed to work just great for me in this case

---
Tags: pagination
---


# Question
Title: How can I compare the categories assigned to 2 different entries?
I'm trying to compare two entries from two different channels and see if they share a common category. Each entry can be assigned to a number of categories. Both channels use the same category group.

I want to display some information if the same category is assigned to both entries. That's the easy bit :)

How would I do this? I'll admit my brain's a bit fried this afternoon so I may well be missing the obvious solution.

# Answer
> 3 votes
exp:query would be a fairly painless way to check how many categories (if any) the two entries share. The count(\*) could be changed to cp1.cat\_id if you'd rather retrieve the category id from the query.

```
{exp:query sql="SELECT count(*) AS count FROM (SELECT cat_id FROM exp_category_posts WHERE entry_id = {first_entry_id}) cp1 INNER JOIN (SELECT cat_id FROM exp_category_posts WHERE entry_id = {first_entry_id}) cp2 ON cp1.cat_id = cp2.cat_id"}
  {count}
{/exp:query}

```

# Answer
> 0 votes
It's definitely easier said than done to accomplish this. I ended up using a few different things here:

--GW Code Categories: http://gwcode.com/add-ons/gwcode-categories/documentation

This allowed me to pass the Category ID through to my listing template

--For my build some entries could have had more than one category, so I used Solspace's Primary Category (http://www.solspace.com/software/detail/primary\_category/) to allow me to know which category was the main one which allowed me to pass variables down to other templates.

## #

I'd be happy to assist you further as I'm one of the many EEers that get frustrated with the lack of Categories being part of the Publish section of EE. Thank heavens there are addons that allow us to expand on EE's limiting Category functionality.

---
Tags: categories, entries, comparison
---


title: Wygwam not stripping markup

text:
# Question
Title: Wygwam not stripping markup
Since Wygwam 2.3.1 it's supposed to have "Set the forcePasteAsPlainText CKEditor config setting to 'Yes' by default" (pasted from release notes). But I'm still getting a lot of junk code (inline styles, Word markup, the whole shebang).

Is this happening for other people as well? I've even tried adding it manually as a config setting, but that didn't make any difference.

Any help would be greatly appreciated, as this is making my client's life miserable.

# Answer
> 1 votes
Wygwam sucks at removing formatting. I have exhausted all resources in trying to find an adequate solution. Luckily I have found 2 simple plugins that will take care of this for you, depending on what you're trying to do.

**Two Scenarious**

1. You're using WYGWAM to show an H1 and want to keep the Spell Checker in place but want to lose the `<p>` tag it outputs. Use PtoBR: http://devot-ee.com/add-ons/paragraph-to-br
2. You're using WYGWAM to output a "summary" on a blog listing and want everything remove but a few things, then I'd use Super Geekery Tag Stripper: http://devot-ee.com/add-ons/supergeekery-tag-stripper

Both are quite useful depending on your needs. There are other strippers out there like Hacksaw, but those are two that I absolutely recommend.

**One last thing you can do:**

Use the "paste from word" functionality button? I use that ALL the time and saves a lot of headaches. Works with getting rid of embedded styles in just about anything too, not just Microsoft Word related issues.

---
Tags: wygwam, strip-html, markup
---


title: Custom channel content based on user

text:
# Question
Title: Custom channel content based on user
I am looking for a little guidance with a new ExpressionEngine project. I have a channel called adventures that contains a group of channel fields. I also have members that can signup and login to the website and eventually purchase these adventures (Which will be done with a plugin). I am looking for a way to allow a user to customize some of the channel fields inside an adventure and then display it only to that user. Each user would be able to create and customize their own adventure based on the generic version I have created.

The user to be able to customize these within a website form interface.

Any guidance would be helpful and if I need to explore PHP over ExpressionEngine code to execute user specific channel field content.

Thanks

# Answer
You can use Safecracker to allow a member to create / update / delete entries from your channels on the front end of your site. Guide is here, and a few examples here. I don't know how much interaction you would need between the plugin you mentioned and safecracker, but I would do some really basic tests to get the feel of it.
> 0 votes

---
Tags: members, channel
---


title: Expresso Store: pseudo-subscriptions

text:
# Question
Title: Expresso Store: pseudo-subscriptions
With Exp-resso Store, can I update a custom member field on checkout?

I'm working on an site for an academic society and I'm hoping to use Store and Freemember to manage membership dues. Suppose I set up a custom member field called Paid Through Date (YYYY-MM-DD). Assuming I require customer registration, can I sell a "2 year subscription" product and have that Paid Through Date get calculated and updated? Would I just do the date calculations in PHP and put submit a hidden input form input on checkout? Is `<input type="hidden">` even secure for POSTed data? If not, is there another way to track this "Paid Through" info for each member?

Adrian implies here that custom member fields (not just the mapped name/email/address info) *can* be updated at checkout when a product is purchased.

# Answer
You can add as many custom fields you want to per item you sell or you can add upto 9 custom order fields per order which can then in turn be mapped to custom member fields. There is nothing in Store that would allow you to use tho result of the custom field to prevent user access to subscription items before/after the date that you created.

Yes you would need to either use PHP or a plugin to get the current date and calculate the date in the future.
> 0 votes

---
Tags: expresso-store, members, freemember
---


# Question
Title: MySQL: Update Rows Based on Specific Set of Entry IDs
I have a random group of about 40 entries in the same channel where I need to copy the `url_title` from `exp_channel_titles` over to the `uri` column in `exp_structure_listings`. If I wanted to copy the urls for all entries there'd be no problem, but I need to copy only the urls from this specific group of entry IDs. I tried:

```
UPDATE
    exp_structure_listings s, exp_channel_titles t
SET
    s.uri = t.url_title
WHERE
   s.entry_id = t.entry_id
AND
   t.channel_id = '17'
AND (
      t.entry_id = '2128'
   OR t.entry_id = '2142'
   OR t.entry_id = '2171'
)

```

But, not surprisingly, that didn't work. I feel like I should be using a join in here somewhere but I'm not really sure what the syntax should look like.

# Answer
You'd want to use the IN() function, so something like:

```
UPDATE
    exp_structure_listings s
INNER JOIN
    exp_channel_titles t
ON
    s.entry_id = t.entry_id
SET
    s.uri = t.url_title
WHERE
    t.channel_id = '17'
AND
    t.entry_id
IN (
    2128,
    2142,
    2171
)

```

I'm not certain if that statement would work exactly for you, since it seemed as if you had a JOIN in the WHERE clause, without specifying a join. But that should provide enough to fiddle with.

`IN()` is best used when you have a known list of items. It's performance in subqueries can be slow, but it's very speedy with a known list. So you could do batches of 10 or the whole 40, if you liked.
> 1 votes

---
Tags: structure, mysql
---


# Question
Title: How to count Matrix rows that are not empty?
This seems like it should be a piece of cake, but I'm at a loss.

I have a Matrix field called {the\_matrix} which contains two columns {comment} and {image}. And I'm attempting to output the number of images like so: **Total Images: 4**

The {total\_rows} tag is not sufficient on its own because oftentimes there may be a {comment} and no {image}. So essentially, I need to output the number of rows in which the {image} cell is not empty.

I have tried several different things (including the snippets below) to output the number of rows that contain an {image}, but have had no luck.

```
{the_matrix}
    Total Images: {image}{total_rows}{/image}
{/the_matrix}

{the_matrix}
    Total Images: {image}{field_row_count}{/image}
{/the_matrix}

{the_matrix}
    Total Images: {image:total_rows}
{/the_matrix}

```

Am I missing something obvious or am I just out of luck?

Thank you.

# Answer
Just attach a filter on the image column to check it isn't empty:

```
Total Images: {the_matrix:total_rows search:image="not IS_EMPTY"}

```
> 4 votes

# Answer
You can try by using the Increment (http://devot-ee.com/add-ons/increment) plugin like:

```
{the_matrix}
{if image}
{exp:pvl_increment id="image_count" random}
{/if}
{/the_matrix}

```

and find the total number of images:

```
{if {exp:pvl_increment id="image_count" increment="no" random} > 10}
[output]
{/if}

```

I hope, it would help you.
> 0 votes

---
Tags: templates, matrix, pixelandtonic
---


# Question
Title: CartThrob - Changing Order - Re-process?
I am pretty sure I know the answer to my question but wanted a second opinion.

A client asked 'If we change/add to an order already entered, will these changes be re-process through the payment gateway'. I am 99% sure no, but I thought I should check.

# Answer
No, orders need to be *submitted* to the payment gateway and changing an order in the back-end wont make the submission.

Cartthrob will allow you to do this as orders are just stored as a regular channel entry but be very careful because you don't want your orders getting out of sync with the actual payments that were made.
> 1 votes

---
Tags: cartthrob
---


# Question
Title: Search matrix rows with OR instead of AND
I've setup some time ago a search field for matrix like so

```
{matrix_field search:matrix_col_01="value"} {Title}... {/if}

```

But now i need to add an extra value from a checkbox

```
{matrix_field search:matrix_col_01="value_from_checkbox" search:matrix_col_02="value_from_checkbox"}
     {Title}...
{/if}

```

The problem now is i don't see any values unless checkboxes from matrix\_col\_01 AND matrix\_col\_02 are checked.

Is it possible to to have value\_one AND/OR value\_two ?

The reason why i need this is to return certain rows only that contain value\_01 or value\_02 , i don't want to show all rows in one time. Thanks!

# Answer
You'd need to break it out into a regular conditional statement where the two search results are compared with the OR operator:

```
{if '{matrixfield search:matrix_col_01="value_from_checkbox"}' || '{matrixfield search:matrix_col_02="value_from_checkbox"}'}
    {title}
{/if}

```
> 1 votes

---
Tags: matrix, search, dynamic
---


title: Assets date issue

text:
# Question
Title: Assets date issue
I'm using EE 2.5.5 and Assets 2.1.2 When I upload a file (PDF) to replace an older version I am getting the following error message:

```
Could not upload the file - server returned an unexpected response.
Please check the server settings.

```

The file then does actually upload but the date and time do not change to show the change. I have tried updating the index but the date does not change.

# Answer
> 1 votes
can you check the developer console of the browser and see what the server is returning for the last Ajax request?

---
Tags: assets
---


# Question
Title: Free Member Inline Errors not working for freemember:update_profile
I am using EE 2.5.2 and Free Member 2.2.1

I am using the example code and error\_handling isn't working for me.

What am I missing?

# Answer
You don't make any mention of how you're using FreeMember or how it isn't working for you so I'll take it on the basis that it's for a standard registration form where errors are not showing for required fields.

In this case you need to specify both the error handling and required parameters in the FreeMember tag like this along with any specific rules for each field like this:

```
{exp:freemember:register
    require="first_name|last_name"
    rules:first_name="required|min_length[5]"
    error_handling="inline"
}

    fields here...

{/exp:freemember:register}

```

Include all the fields you wish to be mandatory in the `require` parameter separated by a pipe character. In this case I'm specifying inline error handling (errors to appear in line with the form fields).

Then upon submission if those requirements and rules aren't met by the field values then the errors will be triggered.
> 1 votes

---
Tags: freemember, expresso
---


# Question
Title: 2-layer children - I can't wrap my head around this! ;-)
So I have three channels. One is called **Event Categories**, one is called **Events**, and one is called **Standard Pages**.

For other reasons I don't want to get into here, I have decided not to use the native EE "Category" functionality to accomplish this.

What I need to have happen is this. **Events** are related to **Event Categories** and then **Event Categories** are related to **Standard Pages**. So if I associate an **Event Category** with a **Standard Pages** entry, it needs to list all of the specific **Events** associated with the **Event Categories** associated with that **Standard Page** entry. These **Events** should be listed under a title h3 element for each **Event Category** listed. If an **Event Category** is related to the **Standard Page**, but has no active **Events** associated with it, it should not be shown.

I am sure this is a very easy thing to accomplish, but relationships always mess with my head and I cannot, for the life of me, figure out the template code to accomplish this.

Thanks for your help!

# Answer
> 1 votes
**By golly, I've got it!**

Thanks to everyone for your help! Like I said, relationships are crazy-hard to wrap your head around and I couldn't have figured it out without your help. The answer turned out to be **Co-Parents**.

Here is the final answer to my question...

```
{standard_page_events var_prefix="cat"}
    <h4>{cat:title}</h4>
    {exp:playa:coparents var_prefix="event" channel="events" child_id="{cat:entry_id}"}
        {event:title}<br>
    {/exp:playa:coparents}
{/standard_page_events}

```

This article really pushed me in the right direction.

http://pixelandtonic.com/blog/playa-coparents

# Answer
> 1 votes
Assuming both the **Standard Pages** and **Events** channels have a Playa field with entries from the **Event Categories** channel, the following should work:

```
{exp:channel:entries channel="pages"}
  {exp:playa:children var_prefix="cat"}
    {cat:exp:playa:parents field="event_category" var_prefix="event"}
      {if '{event:count}' == 1}
        <h3>{cat:title}</h3>
        <ul>
      {/if}
          <li>{event:title}</li>
      {if '{event:count}' == '{event:total_results}'}
        </ul>
      {/if}
    {/cat:exp:playa:parents}
  {/exp:playa:children}
{/exp:channel:entries}

```

It's confusing for me too, but the Playa terminology page helps me understand what's what.

Standard Page = Parent *(The entry that has the Playa field.)*
Event Category = Child *(The entry that you selected in the Playa field.)*

Event = Parent *(The entry that has the Playa field.)*
Event Category = Child *(The entry that you selected in the Playa field.)*

# Answer
> 0 votes
The tricky part here is organizing Events by Event Categories. I can think of two ways to do it:

* Loop through all possible Event Categories, and for each one, check to see if there are any events for the current category that were selected by the current page.
* Just loop through all the events, and use a little PHP on the template to index them by their Event Categories, and then output them in a separate loop.

Neither option is great, but I’m leaning toward the second one because it should be a bit more efficient.

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

    {!-- Get all of the events grouped by their categories --}
    <?php
        $events_by_cat = array();
    ?>
    {exp:playa:children channel="events" var_prefix="event"}
        <?php
            $cat_ids = array({event:exp:playa:child_ids channel="event_categories" delimiter=", "});
            $event = <<<EOD
                <h4>{event:title}</h4>
                <p>{event:event_description}</p>
                ...
EOD;
            foreach ($cat_ids as $cat_id)
            {
                $events_by_cat[$cat_id][] = $event;
            }
        ?>
    {/exp:playa:children}

    {!-- Loop through all categories, fetch their titles and list their events --}
    <?php foreach ($events_by_cat as $cat_id => $events): ?>

        <?php $cat = get_instance()->db->select('title')->where('entry_id', $cat_id)->get('channel_titles')->result(); ?>
        <h3><?php echo $cat[0]->title ?></h3>

        <?php foreach ($events as $event): ?>
            <?php echo $event ?>
        <?php endforeach ?>

    <?php endforeach ?>

{/exp:channel:entries}

```

---
Tags: playa, pixelandtonic
---


# Question
Title: Sessions getting killed by IE9 (user-agent mismatch?)
I have a customer who is losing their session. They are on Windows 7 and using Internet Explorer 9. I think I've widdled it down the user agent changing when compatibility mode or chrome frame kicks in, but I wanted to see if anyone else had an opinion.

If it does in fact have to do with a user-agent mismatch, is there a way, and would it even be acceptable to disable user-agent matching on sessions?

Thanks for your help!

# Answer
I was able to fix this by removing "chrome=1" from the http-equiv meta tag. What I think was happening was for whatever reason, the homepage would load initially with just the "IE=Edge" property and then when they logged in, Chrome Frame would kick in, changing the user-agent and breaking the session. No clue if/why that is even possible, but it's a theory! :-)
> 0 votes

# Answer
This is a bit of a vague question but it appears that IE does send different UA strings when compatibility mode is enabled and EE (or rather CodeIgniter) does invalidate sessions by default if the user agent changes.

I've never tried this but by the look of it you can change this behaviour by editing this setting in system/expressionengine/config/session.php:

```
$config['sess_match_useragent'] = TRUE;

```

As for whether you *should* change this, it seems unlikely that people are switching compatibility view on and off mid-session with any frequency, but if it's something that is regularly impacting an important user then maybe there is an argument for changing it, particularly if you've already done quite a bit of debugging and there's no simple way of stopping their UA from changing all the time. It does seem like a bit of an odd problem to have though - solving that would probably be preferential.
> 5 votes

# Answer
In additional to Dom Stubbs suggestion if you change to using Cookies only does that help?

go to: Admin \> Security & Privacy \> Security & Session Preferences and then change the User Session Type.
> 2 votes

---
Tags: sessions
---


# Question
Title: Where does the var_prefix come from in Playa?
I tried commenting on this thread, but it's closed. I am having a similar issue - the deprecated `{parent:field}` is working, but I'm sure won't forever. I'd like to switch to using the `var_prefix`, but I can't find where that is set.

I tried using the channel name `{channel:field}` \- just not sure what `var_prefix` is in reference to.

```
{exp:channel:entries channel="products"}
    {accessories url_title="{segment_4}" limit="1"}
        {parent:title} product title
    {/accessories}
{/exp:channel:entries}

```

The accessory is a child and accessories is the field name in the products field group.

# Answer
The var\_prefix tag is a parameter available to any of the Playa module tags. It tells Playa to only parse variables that have a certain prefix. This is handy when you’re dealing with variable name conflicts, such as if you’re pulling in an entry with its own Playa tag:

```
{exp:playa:children channel="news" var_prefix="news"}
    {news:exp:playa:children channel="editors" var_prefix="editor"}
        {news:title} - {editor:title}
    {/news:exp:playa:children}
{/exp:playa:children}

```
> 1 votes

# Answer
Come to find out, I didn't actually need the opening channel entries loop, I was able to do it with all Playa tags.

```
{exp:playa:children url_title="{segment_4}" limit="1" var_prefix="accessories"}
    {exp:playa:parents channel="products" url_title="{segment_3}" var_prefix="products"}

        {products:title} - {accessories:accessory_description}

    {/exp:playa:parents}
{/exp:playa:children}

```

Thanks @Ian.
> 0 votes

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


# Question
Title: Wygwam editor field suddenly stops working
Our Wygwam editor suddenly stopped working today at a particular time. It had been used all day up to that point without any problems. Our hosting company says no changes were made to server permissions.

When I load the control panel editor page the web page loading is cancelled due to this file...

```
https://mysite.com/ee_admin.php?D=cp&C=content_files_modal

```

When wygwam has problems it seems to be usually related to an incorrect file path or something similar. I've tried upgrading Wygwam to version 2.7 and reinstalling the DevDemon Channel Images wygwam plugin. When I set a field to NOT defer loading of Wygwam we just get a blank grey area on the Editor page.

This is happening in all web browsers that we've tried.

# Answer
This turned out to be a stray line return character that was somehow added to a Title field in Exp Eng. The line return was breaking the Wygwam javascript that sets up the editor items. Editing the title of the offending channel entry to remove the line return solved the problem.

The way I finally noticed it? In firefox I copied the line in the web page where the error occurred and pasted that into a text editor. Since everything should have been on a single line of code the second line showed up where the offending title was.
> 1 votes

---
Tags: wygwam, channel-images
---