title: Problem Pulling Field Info Into Page

text:
# Question
Title: Problem Pulling Field Info Into Page
I'm having issues posting fields from individual entries to my sites pages. For example, I'm trying to post a form that changes based on the specific type of page that it's on (my Marketing Automation tool requires different information for each form in the header so that it knows which form is which and how to process it).

What I've done is create a field for my posts that places the correct forms information in the header. This is the code that is in the header.

```
{exp:channel:entries channel="blog" dynamic="no" disable="categories|member_data|pagination" limit="1"}
    {if segment_1 == 'blog'}

        {post_specific_info}

    {/if}

{/exp:channel:entries}

```

Now, what's happening is, it is only pulling the field information from the latest post. I tried removing the limit="1" but then it pulls in the field from every post. Can anyone help point me in the right direction?

# Answer
Ok, so what I was missing was that dynamic should have been set to "yes". Once I did that, each post began pulling from it's own data rather than the last post.
> 0 votes

---
Tags: forms, fields, channel-fields
---


title: Admin files, downloadable in front end

text:
# Question
Title: Admin files, downloadable in front end
I am busy with a site which should allow authenticated users to upload and download files, however am having issues.

Firstly i created custom channel fields, which allow file uploads. the image file upload works, the audio upload field also works but when i try upload a video it gives an error the video file 1.1MB.

Am i missing a step?

# Answer
Please check what is your max upload limit (post\_max\_size) in the php.ini file. Changes this to a larger amount will allow for bigger file upload. Also check memory\_limit (Maximum amount of memory a script may consume).
> 1 votes

---
Tags: channel-entries
---


title: My site showing a blank homepage?

text:
# Question
Title: My site showing a blank homepage?
When I go to my homepage of my site (which is a sub domain for testing: example.testcre8.co.uk) it gives me a blank white page instead of displaying my homepage.

Is there something I am missing?

Thank you

# Answer
Sounds like you need to edit your preferences. My guess is this one:

Control Panel \> Admin \> General Configuration:

> Is the system on? (o) Yes () No
> 0 votes

# Answer
Have you checked the Member Group Settings: Site Access (Can view site when it is online), ensure this is tick to Yes. In index.php change debug setting to 1 and see what error gets thrown on the screen.
> 0 votes

---
Tags: blank-screen
---


# Question
Title: Facebook iFrame App "This form has expired. Please refresh and try again."
I have this simple Facebook iframe App

The secure URL that is called is: https://www.das-boot.com/facebook

But in facebook nothing is shown - only the following Expression Engine Error is thrown: "This form has expired. Please refresh and try again."

BUT there isn't any form or any other ee-tags within the called ee-template only plain html code!?

Anyone any idea? Going crazy with this...

# Answer
> 1 votes
For forms add a `<input type="hidden" name="csrf_token" value="{csrf_token}">` or disable it in config.php

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

```

---
Tags: templates, facebook
---


# Question
Title: Keep getting a "Fatal error" when trying to upload an image
When I go to upload a new image from my computer I get the following error message:

```
Fatal error: Call to undefined function EllisLab\ExpressionEngine\Library\Mime\finfo_open() in /home/cre8sub/public_html/westleigh/system/EllisLab/ExpressionEngine/Library/Mime/MimeType.php on line 117

```

Is there something I need to change in the MimeType.php file? or is there another problem? or is it because I am on the free version?

Thank you

# Answer
have you enable the extension = fileinfo.so in your php.ini settings. Secondly the image type might not be listed in the system/expressionengine/config/mimes.php. Refer to https://ellislab.com/blog/entry/fileinfo-in-2-10-0 for further explanations
> 1 votes

---
Tags: error
---


# Question
Title: Advise host Sweden for EE build with MSM
I need advise choosing a good reliable hoster for a new EE build with MSM and a mix of 6 .SE and .ORG domains. Preferrably in Sweden because the organisations I work with want a local host. Thanks a lot for advise.

# Answer
Not a good answer for site owners in Sweden I am afraid, because we found none. We are now in the process to move to Nexcess (their server in the UK).
> 0 votes

---
Tags: multi-site-manager, hosting
---


# Question
Title: exp:channel:entries not working by any means
I cannot get any queries to work using exp:channel:entries.

```
{exp:channel:entries orderby="date" start_on="2015-07-01 20:00" channel="shipments" limit="10" dynamic="no"}
<p>inloop</p>
{/exp:channel:entries}

```

Here is my query above. I have tried every combination of its option variables and nothing works. I cannot get any query to work for any channels except the one below,

```
{exp:channel:entries}
<p>inloop<p>
{/exp:channel:entries}

```

Which is just pulling out 100 entries.

This is a old site for a client that uses expressionengine only as a backend solution. Its V2.6.1 There are no other templates. I am not using file templates, only database. Is there some setting that restricts channels from being used in templates that I am unaware of?

# Answer
> 1 votes
The channel ended up having custom status types so the defaults were not working. I did not make this website so I did not realize this was the case.

---
Tags: templates
---


title: Using Stash inside of other variables

text:
# Question
Title: Using Stash inside of other variables
I am storing site settings using stash and would like to pull out the email address from stash and use it in the EE encode tag. Does anyone know if this is possible?

I have tried a few different things. Lastly this...

```
{encode="{exp:stash:get name='email'}?subject=Information About a Home" title="Email Us"}

```

It isn't rendering the stash variable inside the encode tag. Instead, I get the following:

```
<span data-eeencemail_tzeaewnqdt="1">
    <a href="mailto:?subject=Information About a Home">Email Us</a>
</span>

```

*** EDIT ***

How I set the stash:

```
{!-- CONTACT EMAIL --}
    {exp:stash:email}{contact_email}{/exp:stash:email}

```

*** SOLUTION ***

I was able to use this by utilizing the parse tags in stash to get around the parsing order on output.

So instead of this:

```
{encode="{exp:stash:get name='email'}?subject=Information About a Home" title="Email Us"}

```

I did this:

```
{exp:stash:parse}
    {encode="{exp:stash:get name='email'}?subject=Information About a Home" title="Email Us"}
{/exp:stash:parse}

```

which worked perfectly.

*** BETTER SOLUTION ***

Even thought the above worked (Which I'm leaving in case someone didn't know about the stash parse tags), @natetronn's solution was much better since it uses the short syntax. Using the short syntax, it becomes this:

```
{encode="{exp:stash:email}?subject=Information About a Home" title="Email Us"}

```

# Answer
I'm not totally sure if it matters but, I see you're setting your var using the Set shortcut syntax. Try getting using the Get shortcut syntax as well i.e. `{exp:stash:email}` That is, try not to mix syntaxes.

I'm curious to know if that makes a difference?
> 0 votes

# Answer
I'll assume your variable was SET previously in the parse order.

Were you doing this by any chance?

```
{!-- test: does this work? --}
{exp:stash:get name='email'}

{encode="{exp:stash:get name='email'}?subject=Information About a Home" title="Email Us"}

```

If so, you'll have come across a parsing 'feature' in EE whereby identical calls to the same tag causes them to be cached. What happens is that after parsing the first instance, EE replaces the subsequent instances of the tag with markers that gets replaced at the end of parsing, after other tags have been parsed. This can have the unfortunate result that markers netsed inside other tags or passed as parameters get marooned (and since this is usually what you want to do with a stash variable, it causes a problem):

```
{!-- test: does this work? --}
me@mydomain.com

{encode="M0100749435475676575675?subject=Information About a Home" title="Email Us"}

```

See this article for a full explanation: http://blog.ericlamb.net/2011/05/expressionengine-and-the-mystery-of-m00o93h7pq09l8x1t49chy01z5j4tt91fgfr/

To stop this happening you can append the word 'random' to the later instances:

```
{!-- test: does this work? --}
{exp:stash:get name='email'}

{encode="{exp:stash:get name='email' random}?subject=Information About a Home" title="Email Us"}

```

See: http://www.emarketsouth.com/add-ons/string-plugin/template-tags/#random-parameter

Alternatively you can access the variable as a **placeholder** variable inside `{exp:stash:parse}`, and use it as many times as you like:

```
{exp:stash:parse}

    {!-- test: does this work? --}
    {stash:email}

    {encode="{stash:email}?subject=Information About a Home" title="Email Us"}
{/exp:stash:parse}

```
> 0 votes

---
Tags: stash, email, ee3, encode
---


title: Category Conditional

text:
# Question
Title: Category Conditional
This works fine but I want to “limit” the number of times the snippet shows up at the top of each entry, I only want it to show up on the top (one time in category “7”, no mater haw many entries.

Any suggestions?

```
{exp:channel:categories channel="event_calendar" style="linear" }
<h2><a href="{path='events/show/'}" />{category_name}</a></h2>
{/exp:channel:categories}

{exp:channel:entries channel="event_calendar" dynamic="no"}

{if category_id == "7"} {snippet-rodeo-intro}{/if}

<h2 class="event-header">{event_name}</h2>
{event_description}

{/exp:channel:entries}

```

# Answer
An alternative answer, doesn't use any additional plugins or anything.

I am assuming you want a category jump list a the top (hence the categories tag pair), then the entries in a decending fashion, grouped by category, with a snippet at the top of each category right?

Assuming this, what I've done is make a category loop, then use an inner entries loop to display the entries just for the outer category. Finally we use the `{absolute_count}` tag to target just the first entry.

```
{exp:channel:categories channel="event_calendar" style="linear" }
  <h2><a href="{path='events/show/'}" />{category_name}</a></h2>
{/exp:channel:categories}

{exp:channel:categories channel="event_calendar" style="linear"}
  {exp:channel:entries channel="event_calendar" dynamic="no" category="{category_id}"}
    {if category_id == "7" && absolute_count == 1}
      {snippet-rodeo-intro}
    {/if}

    <h2 class="event-header">{event_name}</h2>
    {event_description}
  {/exp:channel:entries}

```
> 1 votes

# Answer
Not sure exactly what you are trying to do, but I think you might get away with just adding `cat_limit="1"` to your channel:entries tag. More on this here.

If that doesn't do what you want, the other option is to simply post a flag to a variable when you display the snippet and a test for it being set. There are various EE extensions that allow you to write to variables during execution - this uses CE\_Variables, but there are many others.

```
{if category_id == "7" AND {exp:ce_vars:snippet_flag} != "1"}
 {snippet-rodeo-intro}
 {exp:ce_vars:set snippet_flag="1"}
{/if}
```

HTH
> 0 votes

---
Tags: categories, conditionals
---


title: Members only conditional

text:
# Question
Title: Members only conditional
Is there a better way to write this?

```
{if logged_in_group_id == "1" || logged_in_group_id == "6" || logged_in_group_id == "7" || logged_in_group_id == "11"}
Hello Members...
{/if}

```

It seems very long.

Version 2.9.0

# Answer
> 1 votes
To add to Blatant's comprehensive answer and keeping native without PHP...

```
{if "|1|6|7|11|" *= "|".logged_in_group_id."|"} ... {/if}

```

Advanced Conditionals

# Answer
> 0 votes
Well, you don't say what version of EE you're using, so I'm gonna assume v2, though this solution should work just fine in v3 too.

the quickest method would be PHP's `in_array()` function, which you can use in your template natively, however so that I don't give a PHP answer first here's a plugin that adds in\_array to EE :

https://devot-ee.com/add-ons/in-array

```
{if '{exp:in_array value=“2” array="1|6|7|11"}'}
  Hello Members...
{/if}

```

If you rather add plugins that should get you there, you can shorten your EE tags as well, as `group_id` will be 0 for non logged in members :

```
{if group_id == '1' || group_id == '6' || group_id == '7' || group_id == '11'}
  Hello Members...
{/if}

```

Or if you're not afraid of a bit o PHP and the parse order :

EE v2.X

```
<?php if ( in_array( ee()->session->userdata('group_id') , array ( 1, 6, 7, 11 ) ) ) { ?>
  Hello Members...
<?php } ?>

```

EE v3.X

```
<?php
  global $SESS;
  if ( in_array( $SESS->userdata('group_id') , array ( 1, 6, 7, 11 ) ) ) {
?>
    Hello Members...
<?php } ?>

```

---
Tags: members, conditionals, advanced-conditionals
---


# Question
Title: 500 Server error in BrilliantRetail when adding/editing products
I have a new install of BrilliantRetail 1.8.0 on EE 2.10.1

When I try to add a new product, or edit any of the default products, I get a 500 server error. I don't see anything relating to this in my server error log... (hosted on Nexcess)

I'm not having any issues anywhere else. I have essentially the same configuration, version, addons etc on another site with zero issues.

What could possibly be causing this?

**UPDATE:**

EE error with debug on:

> A Database Error Occurred Error Number: 1146
>
> Table 'bedellgu\_weber\_dev.exp\_rte\_toolsets' doesn't exist
>
> SELECT `exp_members`.`rte_toolset_id` FROM (`exp_members`) JOIN \> `exp_rte_toolsets` ON `exp_members`.`rte_toolset_id` = \> `exp_rte_toolsets`.`toolset_id` WHERE `exp_members`.`member_id` = 1
>
> Filename: modules/rte/models/rte\_toolset\_model.php
>
> Line Number: 101

# Answer
> 1 votes
If its a 500 error there should be something in the log files.

Did you turn up all of EE's debugging options? https://gist.github.com/litzinger/5598641

---
Tags: brilliantretail
---


# Question
Title: when removing index.php slow down the site
I'm using the code from the EE user guide:

```
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/system/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

It's working fine but the time loading pages is affected, with index.php the page loading is very fast \< 1000ms , removing index.php it's slower (8000-10000ms).

The system folder of the site is one step above the root, the problem of slowness could be have a relation with : `RewriteCond %{REQUEST_URI} !/system/.* [NC]` ?? How to set the correct path, one step above the root of `!/system/.`

Thanks,

Stéphane

# Answer
> 1 votes
I tried many .htaccess configurations to remove the index.php, I believed the slow down problem was caused by EE.

This .htaccess config no slow down the load page performance:

```
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5})$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) /index.php/$1 [L]

```

# Answer
> 0 votes
I would remove that rule completely since it's not necessary as your system folder is above the webroot. May want to simplify your rules as you seem to have unnecessary rules. My typical EE `.htaccess` is as simple as this (*ymmv*):

```
RewriteEngine On

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

```

# Answer
> 0 votes
The main problem is probably here

```
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

```

This bit tells Apache to check every request filename against a file that may or may not exist on the filesystem.

You could use something like this which just does some regular expression comparisons, which should be much faster.

```
# Exclude root files
RewriteCond $1 !^(favicon\.ico|favicon\.png|index\.php|path\.php|php\.ini) [NC]
# Exclude EE folders
RewriteCond $1 !^(system|images|themes)/ [NC]
# Exclude 3rd party folders
RewriteCond $1 !^(css|js|content)/ [NC]

```

# Answer
> 0 votes
I had the same problem, and simply adding this line immediately after RewriteEngine On sped it up:

```
RewriteRule ^$ /index.php [L,R=301]

```

---
Tags: system
---


title: EE3 Remove Template Group

text:
# Question
Title: EE3 Remove Template Group
I am trying to clean up my templates after an upgrade from EE2 to EE3. Everything I delete / remove keeps reappearing on next log-in. This includes some entire Template Groups and some individual templates in other groups. How do I remove them form the system permanently?

Thanks for any help -A

# Answer
It sounds like you may have "Save Templates as Files" turned on but the system may not have permissions to delete the files. So when you delete the template, it is cleared out of the database, but since the templates (may not) have the correct file permissions it can’t delete the files. Therefore when you load the control panel again, the templates are recreated.

It’s very permissive, but just to test, you might try setting your template file folder and all contents inside to 777.
> 0 votes

---
Tags: templates, ee3, template-manager
---


# Question
Title: Wygwam: use apostrophes and proper quote marks
Does anyone know if it's possible to get Wygwam to replace inch and foot marks (" and ') with apostrophes and proper, left and right curly quote marks? So **Don't** becomes **Don’t** and **"This"** becomes **“this”**? I think EE does this to titles, but Wygwam doesn't seem to... Thanks!

# Answer
> 1 votes
In your WYGWAM editor configuration setting, you need to add an advanced settings for “entities” and set it to no because WYGWAM encodes straight quotes as `"` which prevents any typography processing from working correctly.

Then use something like Typographee to parse the typography correctly (this is what I do): https://github.com/tjdraper/typographee

(There is an EE 2 branch on the GitHub repo as well so it’s not EE 3 only)

---
Tags: wygwam
---


# Question
Title: Why can't I loop through {data} array after API call?
I'm using the Charge API to get a customer's next invoice date in a template:

```
{exp:charge:api call="Stripe_Invoice::upcoming" param_name="customer" key="{customer_id}"}
{if has_error}
    {error_message}
{if:else}
    {data}
        {if '{next_payment_attempt}' != ''}
            Your plan will renew automatically on:
            {exp:low_nice_date date="{next_payment_attempt}" format="%n/%j/%Y"}.
        {/if}
    {/data}
{/if}
{/exp:charge:api}
```

This calls the `api()` function in the module, and I can clearly see where `{data}` is being set:

```
$data = ee()->charge_stripe->api_call($call_name, $call_val, $call_param_name);

if ($data === false) {
    $ret['has_error'] = true;
    $ret['error_message'] = ee()->charge_stripe->api_error_message;
} else {
    $ret['data'] = $data;
    $ret['has_error'] = false;
    $ret['error_message'] = '';
}
```

If I `var_dump($data['next_payment_attempt'])` there I get a timestamp, as expected. But in the template I get an error about Array to String conversion. I can manually add the line `$ret['next_payment_attempt'] = $data['next_payment_attempt'];` and then use `{next_payment_attempt}` in my template.

Why can't I use `{data}{next_payment_attempt}{/data}` in my template without modifying the PHP directly, when it's clear that `$data['next_payment_attempt']` is a timestamp?

# Answer
> 1 votes
Alas I don't know the add-on, but for a tag pair, it needs to be a numerical indexed array for the return variable, so `$ret['data'] = $data` would need to be `$ret['data'] = array($data)`, so that the variable pair has something to loop through, so the output should be in this structure: `$ret['data'][0]['next_payment_attempt']` \- even if it only contains 1 set of data (1 loop).

---
Tags: charge
---


# Question
Title: Upgrade from 2.7.2 to 2.10.3 - stuck login
I just went through the upgrade process from 2.7.2 to 2.10.3. Now when I try to login, the login page just refreshes. I've tried different browsers and restarting browsers. No error messages, just a page refresh. Anyone else run into this?

# Answer
Assuming cookies and my MSM query above fails you, perhaps review some of the comments on this bug report : https://support.ellislab.com/bugs/detail/19334

It's for older versions but there's a few nuggets that will help you. For instance some people report login issues using Zoo Flexible Admin or Republic Analytics which are both extensions.

Also (from the link), might be worth searching your third\_party directory or your exp\_extensions table for extensions using the `cp_member_login` hook, will help you identify the culprit as you commented that disabling extensions fixed things up nicely...

Also, check our session domain and/or perhaps try juggling the Admin CP session type and check your `$config['cp_url']` value.

Though, as you state it's probably down to an extension using the CP hook that is incompatible or something, just need to locate the offender. Let us know how you fare!
> 0 votes

---
Tags: login, upgrade
---


# Question
Title: Can't get total results for relationship field
I am trying to use count and total\_results to detect the last item but total\_results is not working in a relationship field. I can get the count and verify there are multiple entries but not the total.

```
{exp:channel:entries url_title="the-title"}

{project_images}

    {!-- working --}
    {project_images:count}

    {!-- not working --}
    {project_images:total_results}

{/project_images}

{/exp:channel:entries}

```

produces:

1 2 3 4 5 6 7

# Answer
Hmm, that is wierd, according to this thread (which I'm sure you've seen) that should be working...

What do you get? Blank or the wrong number??

Also can you confirm the version of EE you are using please?
> 0 votes

---
Tags: templates, relationships
---


title: Expression Engine Database Load

text:
# Question
Title: Expression Engine Database Load
We are running a high traffic site in expression engine 2.10.1.This has a page-views of 150k daily.The server is load balanced and is running fine. Recently we have strange issue of some pages being requested concurrently for more than 50-100 times from an an ip in less than a second.This increases the database connections and database load which brings down the site.Is there anyway to prevent this or reduce the db load on such incidents

# Answer
> 0 votes
That could be a DDOs attack , there is a lot of that going around. I had a number of number of small tester attacks which spiked the server load. It was a lead up to a major attack which took down our site at a critical time for 12 hours. We have become Cloudflare customers since then and it has stopped a number of attacks for us over that the last year

# Answer
> 0 votes
Could be an intentional attack or a site scraper without limits which will usually bombard your site following all links it finds without pausing, causing a DOS attack. At a very basic level, you can block the IP in .htaccess, but they'll probably be back on a different IP, or if your site is on the radar, there could be attacks from multiple locations/people. Last time this occurred I simply blocked the IP, a duplicate of the website content soon appeared on a domain based out of China trying to get people to purchase from the site with scraped product data and imagery.

The best solution if your host can't provide the service is to rate limit in Apache (or NginX), to restrict multiple http requests from the same IP to a more normal and acceptable level.

Stack Overflow Answer

Another good walkthrough can be found here, various settings in the code will need to change depending on what you want to limit the requests to. Be careful the code example given is for version 1 of the security module not v2.

---
Tags: database, ee
---


# Question
Title: Shipping rule based on discount code in Store
I am trying to find out if there is any way I can apply a flat shipping (eg. $2 ) per quantity if a specific promocode is applied.

# Answer
> 0 votes
First things you are using a very old version of Store, you would probably be best to upgrade to the latest versions of Store and EE.

There is nothing built into Store that would allow you to set a shipping method based upon a promo code being applied to the order. Having said that and without seeing your current shipping setup and which shipping gateways you are using you could force Store to use the default shipping gateway with a per item shipping rule when the promo code is applied. You would need to have your shipping calculated after the user has entered their shipping details and had the opportunity to apply the promo code. You would then need to use the promo\_code tag in a conditional to set the shipping method to the default gateway if your specific code was used and a different gateway if a different code or no code was used.

This would only work if you are using a gateway that gets live rates such as UPS, USPS, FedEx, or Australian Post.

Your best option would be to create a new shipping extension that uses the shipping hook that would allow you to assign promo codes to either shipping rules or better yet that would allow you to assign shipping rules based upon the promo code. This way you would be able to add new promo codes and rules without having to rework your templates.

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


title: EE2.10.3 Accessories page PHP errors

text:
# Question
Title: EE2.10.3 Accessories page PHP errors
With a new install of EE2.10.3, and no Add-Ons installed, I'm getting two PHP errors:

```
A PHP Error was encountered
Severity: Warning
Message: ucwords() expects parameter 1 to be string, array given
Filename: cp/addons_accessories.php
Line Number: 422

A PHP Error was encountered
Severity: Warning
Message: Illegal offset type
Filename: cp/addons_accessories.php
Line Number: 422

```

The only Accessories listed on this page are EE Info, Learning EE, News and Stats, Quick Tips; the only one installed is EE Info.

I'm guessing that the addons will still work properly, but this is still annoying to see, and I'm not sure why it's happening. I've reinstalled EE to see if it might help, but, nope. I'm not seeing any other errors.

This is local run using XAMPP, if that makes any difference.

Thanks.

# Answer
Looks like Dreamweaver added a random \_notes folder to the system/expressionengine/controllers/cp directory, which caused the problem. Derek at Ellis Labs lead me in the right direction to figure it out!

https://ellislab.com/forums/viewthread/248756/
> 1 votes

---
Tags: php-errors, addons
---


title: Freeform form expired in one browser

text:
# Question
Title: Freeform form expired in one browser
I have a basic Freeform contact form that works in Chrome but not Safari, due to:

> This form has expired. Please refresh and try again.

If I clear the EE cache and try again from Safari, it works fine. If I then try Chrome I get the above error.

I have tried using:

```
input type="hidden" name="XID" value="{XID_HASH}"

```

...But this doesn't work. I have also tried turning off secure forms in the config:

```
$config['secure_forms'] = "n";

```

...And this has no effect either.

There's another form on the site which is very similar, and I have no issues with it.

Any idea what the problem could be?

EE 2.10.1 Freeform 4.2.4, though issue was found in 4.2.3.

# Answer
> 0 votes
I've seen this issue with the native email form, that was caused by the domain name not matching what was set in General settings.

So if your site URL/domain setting is www.example.com (with www) and you access the form page using example.com (no www) that can give the error.

The solution is to ensure the domains match. If necessary add a .htaccess rule to make sire the page redirects to the appropriate version, www or non-www.

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


title: ExpressionEngine 3 Single Entry

text:
# Question
Title: ExpressionEngine 3 Single Entry
I know with EE2 there was a great addon by @Viget Labs called Single Entry that limited entries in channels to a single use. Is there nothing for EE3 that can accomplish this easily? It's amazing to me that this hasn't been absorbed by Ellis Lab yet as a core feature in the channel settings.

# Answer
> 0 votes
I've never had cause to limit a channel by single entry. Instead for those sort of page/content types I tend to use Low Variables where you set up a Group, and add some custom fields to suit the content.

---
Tags: add-on, ee3, addons
---


title: How do I post a youtube video?

text:
# Question
Title: How do I post a youtube video?
I have joined a charity and am responsible for updating their website. I have never used Expression Engine before only Wordpress sites for blogs, and I don't know how to post a youtube video on one of the web pages. Please help! Also if there is an Expression Engine guide I can get my hands on somehow that would be really useful.

Thanks, Michelle

# Answer
> 0 votes
You should be able to insert a video from YouTube using the same syntax you would on any other HTML page. However, if you would rather use a plugin to do such, DevDemon has a great, free add on named \[Channel Videos\]. It may be a touch overkill for this need, but the question doesn't talk of needs much more than just adding a video. As for the docs, you can find them all on the EllisLab website.

https://docs.expressionengine.com/latest/

# Answer
> 0 votes
Antenna - https://devot-ee.com/add-ons/antenna \- is another useful addon for adding and outputting video data. It works by you adding the video URL to a custom field (or inside a Grid field). The template tag can then spit out the video along with various bits of meta data as required.

---
Tags: video
---


title: Customizing the default EE email layout

text:
# Question
Title: Customizing the default EE email layout
I am using EE's contact form {exp:email:contact\_form} for user submitted queries on my site and would like to know if its possible to customize the layout of the email it sends?

Currently I have several fields that need to be sent (first name, last name, mobile, email & message) and I have added them to the message content by naming all the inputs with the

name="message\[\]"

attribute which adds each field on its own line. Am I able to add in for e.g a header piece of copy ("The following is a query from your website") or labels for the fields ("Firstname: {first\_name\_input}" ?

# Answer
Sure can, the secret is in using hidden fields:

To add a generic message you could do:

```
<input type="hidden" name="message[]" value="The following is a query from your website">

```

Or to add a heading for a field do:

```
<label for="cheese">What's the best cheese?</label>
<input type="hidden" name="message[]" value="--favourite cheese--">
<input type="text" id="cheese" name="message[]" value="">

```

That will output something like:

*The following is a query from your website*

*--favourite cheese--*

*Gorgonzola*
> 0 votes

---
Tags: templates, email-contact-form
---


# Question
Title: Using CartThrob with PayPal Express (error 10004), is there a way to view long/full error messages?
I'v run into a sudden issue with CartThrob and PayPal Express in which it is giving me the following short error message:

`error 10004: Transaction refused because of an invalid argument. See additional error messages for details.`

Unfortunately, I'm having a hard time troubleshooting this issue because error 10004 can have a multitude of reasons for showing up but I can't find the specific issue without seeing the "long" error message. Is there a way to see the "long" error message with CartThrob natively? Or barring that, some way to see it through the PayPal developer site side?

# Answer
So it turns out CartThrob does give the long error message, but not the short one. The short error message can be added to the error output by editing the Cartthrob\_paypal\_express.php file in the payment gateways folder and adding $transaction\['S\_SHORTMESSAGE0'\]to the error\_message key on line 399.

In my case, my issue ended up being this:

> Error code: 10004
>
> Short message: Internal error
>
> Long message: Transaction refused because of an invalid argument. See additional error messages for details.

It is confusing because PayPal sometimes gives the same long message as the short message with the same error code, thus making it look like there is no long message attached.

Unfortunately, I still do not have any more information on how to fix my problem.
> 0 votes

---
Tags: cartthrob, paypal, paypal-express-checkout
---


# Question
Title: Freeeform template variables always show up
I'm using variables in my notification template. This works great when a use enters a value for that field in the form. The token {name} is replaced with the value the user entered in the text input.

But when the user doesn't enter a value in the form field the token is printed in the email. {name}

I was expecting either a form value or nothing to be printed to the email notification.

Is there a way to configure this? My notifications are full of tokens that I'd like to only if print the user entered the matching field value.

patrick

# Answer
> 0 votes
Notifications use conditionals the same way as within a template tag. to use {name} as an example, you would do the following:

```
{if name}{name}{/if}

```

This would show the value if one was entered and be disregarded if the field was left blank. However, you might want to also include a label.

```
{if name}Name: {name}{/if}

```

---
Tags: solspace-freeform
---


# Question
Title: Exp-resso Store: What is the Mollie Webhook?
I'm using store 2.x and (almost!) everything works fine. There is one small thing bugging me. Mollie sends me a warning: the webhook isn't correctly connected.

That's quite obvious; I didn't enter any webhook.

My question: What webhook URL should I enter in my account at Mollie?

*Update 20160222 Mollie API webhook image:*

*Update 20160222 checkout code:*

```
{exp:store:checkout
form_class="form-horizontal"
return="shop/order/ORDER_HASH"
error_handling="inline"
error_delimiters='<span class="help-inline">|</span>'}

{if no_items}
    {redirect="shop/checkout"}
{/if}

 <fieldset>
                    <legend>Payment info</legend>
                    <div class="control-group">
                        <div><b>{billing_name}</b></div>
                        <div>{billing_address1}</div>
                        <div>{billing_address2}</div>
                        <div>{billing_city} {billing_postcode}</div>
                        <div>{billing_state_name}</div>
                        <div>{billing_country_name}</div>
                        <div>{billing_phone}</div>
                        <div>{order_email}</div>
                    </div>
                </fieldset>

                <fieldset>
                    <legend>Shipping info</legend>
                    <div class="control-group">
                        {if shipping_same_as_billing}
                            Shipping = billing
                        {if:else}
                            <div><b>{shipping_name}</b></div>
                            <div>{shipping_address1}</div>
                            <div>{shipping_address2}</div>
                            <div>{shipping_city} {shipping_postcode}</div>
                            <div>{shipping_state_name}</div>
                            <div>{shipping_country_name}</div>
                            <div>{shipping_phone}</div>
                        {/if}
                    </div>
                </fieldset>

        <fieldset>
            <legend>Payment</legend>

            {if error:payment_method}
                <div class="control-group">
                    <div class="alert alert-error">{error:payment_method}</div>
                </div>
            {/if}

       <div class="control-group">
                <label class="control-label" for="payment_method">Payment</label>
                <div class="controls">
                    <select id="payment_method" name="payment_method">
                        <option value="PayPal_Express"> Paypal</option>
                        <option value="Mollie_Ideal"> iDeal (via Mollie)</option>

                    </select>
                </div>
            </div>

        </fieldset>

        <fieldset>
            <legend>Review</legend>

            <table class="table table-condensed">
                <thead>
                    <tr>
                        <th style="width:60%">Product</th>
                        <th style="text-align:right">Total</th>
                    </tr>
                </thead>
                <tbody>
                    {items}
                        <tr>
                            <td>{item_qty} × {title}</td>
                            <td style="text-align:right">{item_subtotal}</td>
                        </tr>
                    {/items}
                    <tr>
                        <th>Subtotal</th>
                        <th style="text-align:right">{order_subtotal}</th>
                    </tr>
                    {if shipping_method}
                        <tr>
                            <td>Shipping ({shipping_method_name})</td>
                            <td style="text-align:right">{order_shipping}</td>
                        </tr>
                    {/if}
                    {if order_handling_val}
                        <tr>
                            <td>Handling</td>
                            <td style="text-align:right">{order_handling}</td>
                        </tr>
                    {/if}
                    {if order_tax_val}
                        <tr>
                            <td>{tax_name} ({tax_percent}%)</td>
                            <td style="text-align:right">{order_tax}</td>
                        </tr>
                    {/if}
                    <tr>
                        <th>Total</th>
                        <th style="text-align:right">{order_total}</th>
                    </tr>
                </tbody>
            </table>
        </fieldset>

<div class="form-actions">
    <a href="{path='shop/checkout2'}" class="button nonprimair">Back</a>
    <input type="submit" name="submit" value="checkout" class="button cta" />
{/exp:store:checkout}

```

# Answer
> 0 votes
I've just seen this myself - I think that it's because the server wasn't reachable through Mollie through the entire transaction. I've seen it three instances in the past week:

* When the site is actually offline and I'm going through the flow in Test mode. It can't handshake so it fails.
* When the server isn't responding; I'm finding that in the Mollie logs, the site becomes unreachable every day at 11am like clockwork; presumable something is restarting. I've got a question in to the server people now to see what is scheduled at that time.
* When the site could not handshake back after the transaction. After that pause at 11am, mails stopped coming in immediately. So in that time, a transaction occurred but there was no notification...for about 4-5 minutes. Mollie's logs showed that too (so I'm looking today at the Escort plugin to move transactional mails to Mandrill or Mailgun)

---
Tags: expresso-store, payment-gateway
---


# Question
Title: Can I make a directory that lists by first letter of last name?
I'm making a people directory index and would like A-Z links, where clicking on a letter produces all people whose last names begins in that letter.

I'm pulling from a People channel, which has a Last Name field, but it doesn't look like the exp:channel:entries search parameter can search on just the first character of a field?

Is there an easy way to do this? My next idea is running SQL WHERE last\_name LIKE 'x%', but I'd prefer a more elegant solution if one exists.

# Answer
You could try http://gotolow.com/addons/low-alphabet as that allows you to group entries by letters (and numbers if you need).
> 2 votes

# Answer
(Is this the same question Making a directory's A - B - C - D etc. links ?)

I had the same issue, and made a solution that might / might not suit your setup, and post it here. I use Profile:edit to connect Memberfields with a 'peoples channel' and dynamic parameters for searching.

1) New members get accepted by an admin who also fills in a Channel form for member\_profiles (= 'the peoples channel'). This form does a few things, but this part extracts the first letter from their last name.

```
<input type="hidden" name="member_letter" value="{exp:trunchtml chars="1"}{member_last_name}{/exp:trunchtml}">

```

2) This field 'member\_letter' is searchable.

3) On my search page I have this:

```
<form id="artists_lettersEmpty" class="float-right" method="post" action="{path='{segment_1}/{segment_2}/'}">
    <input id="symbol" class="button tiny callout LastButton" name="search:member_letter" type="submit" value="↺">
</form>
<form id="artists_letters" class="float-right" method="post" action="{path='{segment_1}/{segment_2}/medlem'}">
    <input id="a" class="button tiny letter" name="search:member_letter" type="submit" value="A"> <input id="b" class="button tiny letter" name="search:member_letter" type="submit" value="B"> <input id="c" class="button tiny letter" name="search:member_letter" type="submit" value="C"> <input id="d" class="button tiny letter" name="search:member_letter" type="submit" value="D"> <input id="e" class="button tiny letter" name="search:member_letter" type="submit" value="E"> <input id="f" class="button tiny letter" name="search:member_letter" type="submit" value="F"> <input id="g" class="button tiny letter" name="search:member_letter" type="submit" value="G"> <input id="h" class="button tiny letter" name="search:member_letter" type="submit" value="H"> <input id="i" class="button tiny letter" name="search:member_letter" type="submit" value="I"> <input id="j" class="button tiny letter" name="search:member_letter" type="submit" value="J"> <input id="k" class="button tiny letter" name="search:member_letter" type="submit" value="K"> <input id="l" class="button tiny letter" name="search:member_letter" type="submit" value="L"> <input id="m" class="button tiny letter" name="search:member_letter" type="submit" value="M"> <input id="n" class="button tiny letter" name="search:member_letter" type="submit" value="N"> <input id="o" class="button tiny letter" name="search:member_letter" type="submit" value="O"> <input id="p" class="button tiny letter" name="search:member_letter" type="submit" value="P"> <input id="q" class="button tiny letter" name="search:member_letter" type="submit" value="Q"> <input id="r" class="button tiny letter" name="search:member_letter" type="submit" value="R"> <input id="s" class="button tiny letter" name="search:member_letter" type="submit" value="S"> <input id="t" class="button tiny letter" name="search:member_letter" type="submit" value="T"> <input id="u" class="button tiny letter" name="search:member_letter" type="submit" value="U"> <input id="v" class="button tiny letter" name="search:member_letter" type="submit" value="V"> <input id="w" class="button tiny letter" name="search:member_letter" type="submit" value="W"> <input id="x" class="button tiny letter" name="search:member_letter" type="submit" value="X"> <input id="y" class="button tiny letter" name="search:member_letter" type="submit" value="Y"> <input id="z" class="button tiny letter" name="search:member_letter" type="submit" value="Z"> <input id="å" class="button tiny letter" name="search:member_letter" type="submit" value="Å"> <input id="ä" class="button tiny letter" name="search:member_letter" type="submit" value="Ä"> <input id="ö" class="button tiny letter" name="search:member_letter" type="submit" value="Ö">
</form>

```

3) form id="artists\_lettersEmpty" resets the form (by searching without letter)

4) form id="artists\_letters" searches after the visitor clicks the button with that letter. As you see, we ae on a Swedish site.

5) Result shows up here:

```
    <h4>Resultat:</h4>
{exp:channel:entries
channel="member_profiles"
disable="pagination|category-fields|member-data|relations"
dynamic_parameters="search:member_letter"
orderby="member_last_name"
sort="asc"
dynamic="off"}
{member_first_name} {member_last_name}
{/exp:channel:entries}

```
> 1 votes

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


title: Total items from relationship field

text:
# Question
Title: Total items from relationship field
I'm trying to wrap items in a ul if there are more than one, however I am getting the if always false, this is caused due to `{feature_content:total_results}` returning false. I end up with `<h1>TOTAL: ""</h1>` so it's not even zero.

Can someone enlighten me as to what I'm missing?

```
{exp:channel:entries channel="feature"}
<!-- Feature Section -->
<div class="layoutholder">
    <div class="row">
        <div class="small-12 large-10">
            <h1>TOTAL: "{feature_content:total_results}"</h1>
            {if feature_content:total_results > 1}
                <ul class="bxslider-features">
                    {feature_content}
                        <li><div>{feature_content:content}</div></li>
                    {/feature_content}
                </ul>
            {if:else}
                {feature_content}
                    <div>{feature_content:content}</div>
                {/feature_content}
            {/if}
        </div>
    </div>
</div>
{/exp:channel:entries}

```

Based on this answer Relationship field entries total count I would have thought the above to work.

# Answer
> 0 votes
This fails for me:

```
{if feature_content:total_results > 1}

```

Shouldn't it be?

```
{if feature_content:total_results >= 1}

```

If it's less than 1, there are no relationships to show anyway.

# Answer
> 0 votes
Found it!

```
{feature_content:total_rows}

```

Would be super useful if this was actually documented anywhere I could find!

---
Tags: templates, relationships, ee3
---


# Question
Title: Optimising structure of exp_channel_data table
I have a site with around 800 columns on exp\_channel\_data table. I would like to know if I can go ahead and optimise the structure of this table by doing the following 1) changing field from text to a suitable smaller data type like varchar 2) alter indexes

If I go ahead and do these changes will expression engine override these changes next time I try to save to dB or save site settings or any such thing.

# Answer
Errr... when you've reached that many columns (therefore, that many fields in field groups, around 400 fields), you probably want to think of a higher-level refactor process. This will be much more fool-proof than manually editing database column types.

Sure, the example you gave will give you more space with your total amount of available columns and your database imprint. But that isn't addressing the issue and will likely come back to bite you in the behind. It's also highly manual and will require your intervention in customizing all of those columns.

EE won't reformat your column types after they are created (after making a new field). So you have no real issue there. You might find EE tries to save something to a modified field it can't handle, resulting in a MySQL error.

You should really look at the systemic problem: you have way too many custom fields in one site.

Can you describe the situation of this site that is resulting in so many custom fields? We can probably help you better with more information as to how this site reached so many fields.
> 0 votes

---
Tags: database, mysql, channel-fields, index
---


# Question
Title: Show sub categories where location has jobs
I have a category group that's attached to several channels, including the jobs channel.

This isn't the way I'd have configured this initially but never mind.

I have 2 parent categories USA & Europe and then cities as sub categories. I want to show the cities and the jobs in those cities.

Not all cities have jobs and right now, using GWCategories, I'm spitting out cities where there are no jobs.

```
{exp:gwcode_categories channel="jobs" last_only="yes" cat_id="13" show_empty="no"}
{cat_name}
{/exp:gwcode_categories}

```

Gives me all cities, irrespective of whether they have jobs or not.

# Answer
The issue turned out to be the status parameter. Several entries with 'closed' status.

Code that works is

```
{exp:gwcode_categories
  status="open"
  channel="jobs"
  show_empty="no"
  last_only="yes"
  cat_id="19"
}

  {cat_name}
  {embed="careers/.jobs" cat_id="{cat_id}"}

{/exp:gwcode_categories}

```
> 0 votes

---
Tags: categories, gwcode-categories, category-group, child-categories
---


# Question
Title: Trouble getting related entries with grid fields in stash list
I have a channel entry for houses in which the user can enter all the details for a house (I simplified the fields for this). For the home page, I am pulling a list of "model homes" that are a multiple relationship field and stashing them for displaying in my template. So I am inside my channel\_entries loop for the home page and down a bit in my stash template. Here is my stash segment for this:

My relationship field in the home page is `Relationship Field = {model_homes}`

```
{exp:stash:set_list name="sv_model_homes" parse_tags="yes"}
    {model_homes}
        {stash:sv_house_url}{model_homes:url_title}{/stash:sv_house_url}
        {stash:sv_overview}{model_homes:overview}{/stash:sv_overview}
        {exp:stash:set_list name="sv_address" parse_tags="yes"}
            {model_homes:address}
                {stash:sv_street}{address:street}{/stash:sv_street}
                {stash:sv_city}{address:city}{/stash:sv_city}
                {stash:sv_state}{address:state}{/stash:sv_state}
                {stash:sv_zip}{address:zip}{/stash:sv_zip}
            {/model_homes:address}
        {/exp:stash:set_list}
        {exp:stash:set_list name="sv_house_images" parse_tags="yes"}
            {model_homes:house_images cover_only="yes"}
                {stash:sv_house_image_full}{image:url{/stash:sv_house_image_full}
                {stash:sv_house_image}{image:url:gallery}{/stash:sv_house_image}
                {stash:sv_house_title}{image:title}{/stash:sv_house_title}
            {/model_homes:house_images}
        {/exp:stash:set_list}
        {exp:stash:set_list name="sv_details" parse_tags="yes"}
            {model_homes:house_details}
                {stash:sv_price}{house_details:price}{/stash:sv_price}
                {stash:sv_bedrooms}{house_details:bedrooms}{/stash:sv_bedrooms}
                {stash:sv_bathrooms}{house_details:bathrooms}{/stash:sv_bathrooms}
                {stash:sv_living_rooms}{house_details:living_rooms}{/stash:sv_living_rooms}
                {stash:sv_dining_rooms}{house_details:dining_rooms}{/stash:sv_dining_rooms}
                {stash:sv_square_footage}{house_details:square_footage}{/stash:sv_square_footage}
            {/model_homes:house_details}
        {/exp:stash:set_list}
    {/model_homes}
{/exp:stash:set_list}

```

Inside the houses channel fields are the following `grid` and `channel_images` fields.

INSIDE the homes entry are the following fields giving me trouble:

```
GRID - {address}

CHANNEL IMAGES - {house_images}

GRID - {house_details}

```

This is my `{content_home}` template (display) for this content segment:

```
<ul class="slides">
    <li>
        <div class="row">
            {exp:stash:get_list name='sv_model_homes'}

            <div class="col-md-4 col-sm-6">
                <div class="thumbnail boxed">
                    <div class="listing-image">
                        <span class="listing-tag important">Model Home</span>
                        {exp:stash:get_list:nested name='sv_house_images'}
                        <img src="{sv_house_image}" alt="{sv_house_title}">
                        <div class="image-links">
                            <div class="left">
                                <a class="inner" href="{sv_house_image_full}" data-lightbox="related-1">
                                    <i class="fa fa-camera"></i>
                                </a>
                            </div>
                            <div class="right">
                                <a class="inner" href="{site_url}house/{sv_house_url}">
                                    <i class="fa fa-link"></i>
                                </a>
                            </div>
                        </div>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details'}
                        <div class="image-tags">
                            <ul class="property-tags">
                                <li><span><i class="icon-bed"></i> {sv_bedrooms}<br><span class="small">Bedrooms</span></span></li>
                                <li><span><i class="icon-shower"></i> {sv_bathrooms}<br><span class="small">Bathrooms</span></span></li>
                            </ul>
                        </div>
                        {/exp:stash:get_list:nested}
                    </div>
                    <div class="description">
                        {exp:stash:get_list:nested name='sv_address'}
                        <h4>{sv_street}<br><small>{sv_city}, {sv_state}</small></h4>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details'}
                        <div class="row">
                            <div class="col-xs-6">
                                <strong>Property Size:</strong>
                            </div>
                            <div class="col-xs-6">
                                {sv_square_footage} SqFt
                            </div>
                            <div class="col-xs-6">
                                <strong>Rooms:</strong>
                            </div>
                            <div class="col-xs-6">
                                {sv_bedrooms} Bed, {sv_bathrooms} Bath
                            </div>
                        </div>
                        <hr>
                                                    <span class="price-tag">
                                                        ${sv_price}
                                                    </span>
                        {/exp:stash:get_list:nested}
                        <a href="{site_url}house/{sv_house_url}" class="btn btn-link " role="button">+ Show Details</a>
                    </div>
                </div>
            </div>

            {/exp:stash:get_list}

        </div>
    </li>
</ul>

```

The problem is that I AM getting information, just not the correct information.

If I test the loop like this:

```
<div class="row">
    {exp:stash:get_list name='sv_model_homes'}
        {sv_house_url} - {count}<br>
    {/exp:stash:get_list}
</div>

```

I get the proper `{sv_house_url}` and `{count}`. It loops through the trhee tests and count 1, 2, 3.

However, in my markup for `{content_home}`, (above), I just get the first entry. I've tried using the `prefix=''`tag, but that didn't change anything for me. (I could have been using it incorrectly too though.)

What do I need to do in order to get the proper data from my stash set\_list?

# Answer
First off, thanks for the input @Natetronn. If this is what you were talking about, let me know so I can accept your answer. :)

I tried using the context param before and after rounding out the nesting, but wasn't able to get it functioning properly for this. Even after nesting the lists I was still just capturing a single one of the loop data sets. I think the context parameter is supposed to handle setting and retrieving this way too from what I read, but I wasn't able to get that working. If I am doing this the hard way and context works this way, please let me know so that I can utilize the addon properly. :)

I was able to achieve my desired results using the following "set\_list". Again, simplified, but I'm including the `{channels_entry}` tags to make it more clear for those that may need more info.

```
{exp:channel:entries
    channel="home_page"
    limit="1"
}
    {exp:stash:sv_title}{title}{/exp:stash:sv_title}
    {exp:stash:sv_url_title}{url_title}{/exp:stash:sv_url_title}
    {exp:stash:sv_entry_id}{entry_id}{/exp:stash:sv_entry_id}
    {exp:stash:sv_entry_date}{entry_date format="%Y %m %d"}{/exp:stash:sv_entry_date}
    {exp:stash:sv_edit_date}{edit_date format="%Y %m %d"}{/exp:stash:sv_edit_date}
    {exp:stash:set_list name="slideshow_images" parse_tags="yes"}
        {slideshow}
            {slideshow:slider_images}
                {stash:sv_slideshow_image}{image:url:slider-optimized}{/stash:sv_slideshow_image}
                {stash:sv_slideshow_title}{image:title}{/stash:sv_slideshow_title}
            {/slideshow:slider_images}
        {/slideshow}
    {/exp:stash:set_list}
    {exp:stash:sv_welcome_title}{welcome_title}{/exp:stash:sv_welcome_title}
    {exp:stash:sv_welcome_greeting}{welcome_greeting}{/exp:stash:sv_welcome_greeting}
    {exp:stash:set_list name="sv_model_homes" parse_tags="yes" parse_depth="2"}
        {model_homes}
            {stash:sv_house_id}{model_homes:entry_id}{/stash:sv_house_id}
            {stash:sv_house_url}{model_homes:url_title}{/stash:sv_house_url}
            {stash:sv_overview}{model_homes:overview}{/stash:sv_overview}
            {exp:stash:set_list:nested name="sv_address_{model_homes:entry_id}" context parse_tags="yes"}
                {model_homes:address}
                    {stash:sv_street}{address:street}{/stash:sv_street}
                    {stash:sv_city}{address:city}{/stash:sv_city}
                    {stash:sv_state}{address:state}{/stash:sv_state}
                    {stash:sv_zip}{address:zip}{/stash:sv_zip}
                {/model_homes:address}
            {/exp:stash:set_list:nested}
            {exp:stash:set_list:nested name="sv_house_images_{model_homes:entry_id}" parse_tags="yes"}
                {model_homes:house_images cover_only="yes"}
                    {stash:sv_house_image_full}{image:url}{/stash:sv_house_image_full}
                    {stash:sv_house_image}{image:url:gallery}{/stash:sv_house_image}
                    {stash:sv_house_title}{image:title}{/stash:sv_house_title}
                {/model_homes:house_images}
            {/exp:stash:set_list:nested}
            {exp:stash:set_list:nested name="sv_details_{model_homes:entry_id}" parse_tags="yes"}
                {model_homes:house_details}
                    {stash:sv_price}{house_details:price}{/stash:sv_price}
                    {stash:sv_bedrooms}{house_details:bedrooms}{/stash:sv_bedrooms}
                    {stash:sv_bathrooms}{house_details:bathrooms}{/stash:sv_bathrooms}
                    {stash:sv_living_rooms}{house_details:living_rooms}{/stash:sv_living_rooms}
                    {stash:sv_dining_rooms}{house_details:dining_rooms}{/stash:sv_dining_rooms}
                    {stash:sv_square_footage}{house_details:square_footage}{/stash:sv_square_footage}
                {/model_homes:house_details}
            {/exp:stash:set_list:nested}
        {/model_homes}
    {/exp:stash:set_list}
{/exp:channel:entries}

```

Then in my "get\_list", I achieved what I needed by pulling out the data like this:

```
<div class="flexslider title-slider" data-animation="fade" data-loop="true">
    <div class="title">Model Homes</div>
    <ul class="slides">
        {exp:stash:get_list name='sv_model_homes'}
            {switch='<li><div class="row">||'}
            <div class="col-md-4 col-sm-6">
                <div class="thumbnail boxed">
                    <div class="listing-image">
                        <span class="listing-tag important">Model Home</span>
                        {exp:stash:get_list:nested name='sv_house_images_{sv_house_id}'}
                            <img src="{sv_house_image}" alt="{sv_house_title}">
                            <div class="image-links">
                                <div class="left">
                                    <a class="inner" href="{sv_house_image_full}" data-lightbox="related-1">
                                        <i class="fa fa-camera"></i>
                                    </a>
                                </div>
                                <div class="right">
                                    <a class="inner" href="{site_url}house/{sv_house_url}">
                                        <i class="fa fa-link"></i>
                                    </a>
                                </div>
                            </div>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details_{sv_house_id}'}
                            <div class="image-tags">
                                <ul class="property-tags">
                                    <li><span><i class="icon-bed"></i> {sv_bedrooms}<br><span class="small">Bedrooms</span></span></li>
                                    <li><span><i class="icon-shower"></i> {sv_bathrooms}<br><span class="small">Bathrooms</span></span></li>
                                </ul>
                            </div>
                        {/exp:stash:get_list:nested}
                    </div>
                    <div class="description">
                        {exp:stash:get_list:nested name='sv_address_{sv_house_id}'}
                            <h4>{sv_street}<br><small>{sv_city}, {sv_state}</small></h4>
                        {/exp:stash:get_list:nested}
                        {exp:stash:get_list:nested name='sv_details_{sv_house_id}'}
                            <div class="row">
                                <div class="col-xs-6">
                                    <strong>Property Size:</strong>
                                </div>
                                <div class="col-xs-6">
                                    {sv_square_footage} SqFt
                                </div>
                                <div class="col-xs-6">
                                    <strong>Rooms:</strong>
                                </div>
                                <div class="col-xs-6">
                                    {sv_bedrooms} Bed, {sv_bathrooms} Bath
                                </div>
                            </div>
                            <hr>
                            <span class="price-tag">
                                ${sv_price}
                            </span>
                        {/exp:stash:get_list:nested}
                        <a href="{site_url}house/{sv_house_url}" class="btn btn-link " role="button">+ Show Details</a>
                    </div>
                </div>
            </div>
            {if count == absolute_results}
                </div></li>
            {if:else}
                {switch='||</div></li>'}
            {/if}
        {/exp:stash:get_list}
    </ul>
</div>

```
> 0 votes

# Answer
I think you may have forgot to nest your nested set\_lists? Looks like you're doing it on your nested get\_lists, however.

These set\_lists need to be nested.

* sv\_address
* sv\_house\_images
* sv\_details

Also, I'm not sure but, you may need to use the context param on those nested set\_lists and nested get\_lists too. Maybe along with the `{entry_id}`. And this would come after fixing your nesting so if nesting fixes all your issues then disregard this part.
> 0 votes

---
Tags: stash, ee3, loop, list, nested-list
---


title: CP dashboard is not visible for users

text:
# Question
Title: CP dashboard is not visible for users
The CP Dashboard from the Forms Module is only visible for de admin. I would like to make it visible for a member group. The member group can access the module but they don't see the dashboard on de CP home page.

# Answer
> 0 votes
Double check to see if you have an options setting under the 'Accessories' group for Forms. If so, try setting access there. You should also be able to set the permissed groups under the member group permissions settings. It would help knowing what version of EE and what version of Forms you are using.

---
Tags: devdemon-forms
---


title: Order articles by Popularity

text:
# Question
Title: Order articles by Popularity
I want to have a kind of 'trending' or 'most popular' area on my homepage which lists the top 10 most popular articles.

Is there a simple way to order entries by popularity?

# Answer
Sure - first you need to track views in order to determine popularity. So on your "single entry" templates, add `track_views="one"` to your `channel:entries` tag.

Then, you can use `orderby="view_count_one"` on your `channel:entries` listings tags.
> 11 votes

# Answer
## View Count + Total Comments

You can also use the variable {comment\_total} in conjunction with {view\_count\_one} for an alternate assessment of popularity.

On the `exp:channel:entries` listing tag

```
orderby="view_count_one|comment_total"

```

**Conditional might be**

```
{if comment_total >= '10' AND view_count_one >= '10' }
This entry is trending
{if:else}
This is a regular entry
{/if}

```
> 1 votes

---
Tags: entries, orderby
---


# Question
Title: EE3 DevDemon Editor not inserting images
I have checked and double checked my settings. I don't see anything wrong in them.

I have established a file upload location and verified it is working correctly with a Channel Images field. When I set the same location for the images in the Editor image upload location it is not working.

I can click the 'Image' button in the toolbar and the insert window opens. I can then either drag/drop or click insert and select the image I would like to insert. The title shows up and appears to be ready to insert, but the window then closes and drops a blank space in the copy section. When you look at the source, you can see an empty image 'figure' block.

```
<figure><img data-image=""></figure>

```

See images for visual.

# Answer
> 0 votes
I received a response from Manuel of DevDemon support. This was a bug and has been corrected for a future release coming out soon.

---
Tags: file-uploads, devdemon, ee3, editor, uploads
---


# Question
Title: 404 Not Found error when deleting an entry
I've built several sites with EE but I've never had this error. In my last project, if I try to delete an entry (no matter from which channel) I receive a Not Found Page.

> Not Found
>
> The requested URL /system/index.php was not found on this server.
>
> Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

I notice, however, that the entry is eventually deleted, but I can't give the client a site with this error and tell him to pretend nothing happened.

What should I do?

# Answer
> 0 votes
Try checking the $config\['cp\_url'\] value in system/expressionengine/config/config.php is what you expect. It's usually something like 'http://www.yoursite.com/admin.php'.

---
Tags: 404, delete, error-500
---


title: Assets - Strict Standards Error

text:
# Question
Title: Assets - Strict Standards Error
I have a error on the back-end of my clients site relating with assets which I urgently need to resolve somehow. It is using Assets 2.4 and EE 2.7.1

> Strict Standards: Static function Assets\_base\_source::get\_settings\_field\_list() should not be abstract in ..../assets/third\_party/assets/sources/base\_source.php on line 197

Can you please advice me what can be done ?

# Answer
> 0 votes
You should update your PHP configuration (in PHP.ini) to suppress strict standards errors:

```
error_reporting = E_ALL & ~E_STRICT

```

---
Tags: assets, pixelandtonic, php-errors
---


# Question
Title: How to include an html encode php script in a layout template?
Am trying to include an html encode php script on the very top of a layout template.

Am allowing php to execute on this layout template, however I end up with something like this

```
{!-- ra:000000007e39e89a000000001069d118 --}

```

Any help is appreciated!

# Answer
I recommend not allowing PHP execution and using a plugin instead.

https://devot-ee.com/add-ons/stringy https://devot-ee.com/add-ons/phpstringfun
> 1 votes

---
Tags: ee2, php, encode
---


# Question
Title: call_user_func() expects parameter 1 to be a valid callback
I've transferred an ExpressionEngine site from the staging server to live but now I'm getting the following error for pretty much any {exp:channel:entries} tag:

```
Severity: Warning

Message: call_user_func() expects parameter 1 to be a valid callback, no array or string given

Filename: channel_entries_parser/Parser.php

Line Number: 380

```

Here is one of the tags causing it:

```
{exp:channel:entries dynamic="no" channel="blog_post" limit="10"}
<h3>{title}</h3>
{/exp:channel:entries}

```

The differences between the servers are:

* Staging: PHP Version 5.4.35 Live: PHP Version 5.4.45
* Staging: Apache Version Apache/2.2.15 (CentOS) Live: Apache Version Apache/2.2.17 (Atomic)

EE v2.10.2 Addons: cache\_buster, ed\_imageresizer, ep\_better\_workflow, excerpt, fieldpack, freebie, freeform, freeform\_campaign\_monitor\_hook, index.html, lamplighter, list.txt, low\_seg2cat, mx\_cloner, reefine, reelocate, republic\_structure\_tweaks, stash, structure, structure\_nav, structure\_page\_exists, switchee, trunchtml, url\_tube, wygwam

# Answer
> 2 votes
Looks like the problem is originating from system/expressionengine/modules/channel/mod.channel.php line 2343 which returns a Closure for `tagdata_loop_end` and the live server doesn't understand Closures for some reason. I've added an `if` to line 380 in Parser.php so it ignores the Closure as a temporary workaround:

```
if (is_callable($callbacks['tagdata_loop_end'])) $tagdata = call_user_func($callbacks['tagdata_loop_end'], $tagdata, $row);

```

# Answer
> 1 votes
If such a vanilla Channel Entries tag on a template by itself is causing that error, I'd start disabling add-ons until the error goes away. In that list of add-ons are many with extensions that could be creating unexpected behavior.

Start by heading to Add-ons \> Extensions and clicking the "Disable Extensions" button on the top right. Access that front end reduction template again and see if the error persists. If it doesn't, then you can re-enable extensions and try disabling them one at a time until you find the culprit. If you browse your `exp_extensions` table, in this case the most likely extensions are going to have hooks using `channel_entries_tagdata_end`.

---
Tags: channel-entries, php-errors
---


# Question
Title: Does the REElocate plugin bij exp:resso actually moves my ExpressiongEngine website or does it copy it?
Does the REElocate plugin bij exp:resso actually moves my ExpressiongEngine website or does it copy it? I have an ExpressionEngine website and I'd like to copy this to another domain (thus server), for an development/experiment environment. So whenever I use the REElocate plugin, I hope it doesn't actually move my whole website. :P Thanks!

# Answer
I don’t think it does either. I’m pretty sure all it does is fix up the various config strings within an EE database to point to the correct locations after the MySQL has been moved over to a new machine. The moving of the rest of the assets that make up your website is down to you to do.
> 1 votes

---
Tags: plugin, expresso
---


title: Hide category in entry when empty

text:
# Question
Title: Hide category in entry when empty
The html

```
<div class="categorie"><b>Rechtsgebied:</b> {categories}{if "{parent_id}"=="10"}<i>{category_name}</i> {/if}{/categories}</div>

```

When I publish a new article, is it possible for me to hide the category on the website (so this piece of html) when all the categories are unchecked? Is this being done easily with an if statement?

I hope I'm being clear, if not, please ask

thanks :)

# Answer
> 0 votes
Maybe Stash addon can help here. This piece of code creates a Stash variables with the list of categories inside and then it only outputs it with the div class if the variable is not empty.

```
{exp:stash:set name="cats" parse_tags="yes"}{categories}{if "{parent_id}"=="10"}<i>{category_name}</i>{/if}{/categories}{/exp:stash:set}

{if {exp:stash:not_empty name="cats"}}
<div class="categorie"><b>Rechtsgebied:</b>
{exp:stash:cats}
</div>
{/if}

```

# Answer
> 0 votes
You can probably do what you want using Buzzing Pixel's Category Construct add-on. It is a very simple add-on that provides a raft of manipuation options for working with categories - including the ability to count how many categories are set for an entry (or collection of entries).

The actual EE code will depend on what else you are doing with your template, but you can find the (short, simple) documentation here:

https://buzzingpixel.com/software/category-construct/documentation/template-tags

HTH

---
Tags: categories
---


# Question
Title: How to display value/label pair inside notification template?
I would like to display a value/label pair inside of my notification template. For example, assuming I can use {label\_name:value}, this method only returns the label name.

# Answer
> 0 votes
You could try the documentation for freeform entries here

Basically use `{freeform:label:FIELD_NAME}`

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


# Question
Title: Check for channel entry seo data or use template code instead of defaults
I am using stash on a client site and was pushing over data from the entry itself for SEO meta, but want to provide the user the ability to customize it with the SEO Lite tab. Is there a way I can check for the SEO Lite custom entry specific values only? It seems that the default values are being checked against as well. Currently, I was trying to use the tag pair to do things like this:

```
{exp:seo_lite use_last_segment="yes"}
    {if title}
        <title>{title}</title>
    {if:else}
        <title>{exp:stash:seo_title strip_tags='yes' trim='yes'}</title>
    {/if}
    {if meta_description}
        <meta name="description" content="{meta_description}">
    {if:else}
        <meta name="description" content="{exp:stash:seo_desc strip_tags='yes' trim='yes'}">
    {/if}
    {if meta_keywords}
        <meta name="keywords" content="{meta_keywords}">
    {/if}
{/exp:seo_lite}

```

Does anyone know what I should be doing in order to accomplish this? Or if it's even available?

EE3, Stash 3.0.0, SEO Lite 1.5.1

# Answer
The only thing I can think of in your case is to specify some default in the description or keywords that you know and can check against. So, if SEO Lite defaults you'll know about it and can then use the ones from the entry.

The way I usually do this though is with extra tags, have you looked at those? http://wedoaddons.com/seo-lite/extra-tags
> 1 votes

---
Tags: stash, parse-order, ee3, seo, seo-lite
---


# Question
Title: Color Coding days if they have multi-day events
I have a monthly calendar, and I just want to change the color of a day if it has an event on that day. It works great with single day events, but for days that span multiple days, day\_event\_total only counts the first day. Code looks like this:

```
<td class="day_cell {if day_event_total > 0}has_events{/if}">
    {if day_event_total > 0}
    <a class="num"
        href="{path='/envelopers/community/calendar'}/{date format="%Y/%m/%d"}/">
    {/if}
    <div class="date">
        {date format="%j"}
    </div>
    {if day_event_total > 0}
        </a>
    {/if}
{if:else}
    <td class="day_cell out_of_range">
    <div class="date">
    <span class="num">
        {date format="%j"}
    </span>
    </div>
{/if}
</td>

```

# Answer
The issue here is that the {if event\_multi\_day}{/if} conditional is only available within the {events}{/events} variable pair. Color-coding events is easy this way, but color-coding days based on event data is not really possible.
> 0 votes

---
Tags: solspace-calendar
---


title: Cookie-free subdomain

text:
# Question
Title: Cookie-free subdomain
I created a subdomain with redirects for my site images at images.domain.com in order to avoid cookies.

Based on my read of EE documentation, I should go to Admin / Security and Privacy / Cookie Settings and put .www.domain.com in the cookie domain box to set the cookies for that subdomain and that way avoid cookies for images.domain.com.

Site performance tools are still showing cookies for the images. Any suggestions?

# Answer
> 1 votes
Not that I'm an expert, but what I've implemented in the past has been in .htaccess, not defining privacy settings in EE, until now I've not given it much thought... This answer gives some light - what you've done is set it so cookies aren't sent back from that domain for the content generated by EE, but they will still be sent in the request, therefore failing the performance tests. Also remember that EE doesn't have any involvement in the static content - that's the server - the admin settings are only for content generated by EE - so if you had your CSS and JS files as templates, then this would be served by EE, otherwise if they're external files they're delivered directly from the server, not EE.

You don't have to have a separate domain to be able to deliver cookie-less content, the subdomain just assists in multiple domain calls (so multi-threaded requests). I read elsewhere that Google advises that it's only worth doing if you have more that 5 items - assuming images are delivered via the static, then it'll be worth it. As an example, if all your CSS is in one minified file and all your JS is in another, and the images were via a CDN, then there would be little point.

> Opening http connections costs time, and it is not always the case that opening more connections is efficient. Reducing the number of resources is much more effective than just piling up lots of open HTTP connections.

This article gives a good description of specifying the .htaccess to remove cookie from the relevant file requests - note this is irrelevant of domain and is fairly self explanatory:

```
<FilesMatch "\.(js|css|jpg|png|jpeg|gif|xml|json|txt|pdf|mov|avi|otf|woff|ico|swf)$">
    RequestHeader unset Cookie
    Header unset Cookie
    Header unset Set-Cookie
</FilesMatch>

```

The second code from that article refers to unset eTag:

> Entity tags (ETags) are a mechanism to check for a newer version of a cached file.

Ref.

`unset pragma` \- I can't find a numpty guide by Googling, but all references go hand in hand with reducing the header and caching information, although I have read that this line doesn't explicitly state "don't cache the content", and elsewhere I've read some browsers may still assume. So might need `Header set Pragma "no-cache"` instead of their suggested `Header unset Pragma`.

This chunk I add to my .htaccess to set the browser caching time of certain files:

```
<IfModule mod_expires.c>
 ExpiresActive On
 <FilesMatch "\.(ico|jpg|jpeg|png|gif)$">
  ExpiresDefault "access plus 2 weeks"
 </FilesMatch>
 <FilesMatch "\.(js|css|swf)$">
  ExpiresDefault "access plus 2 days"
 </FilesMatch>
</IfModule>

```

And if you want to compress certain files sent from the server (still in the .htaccess file):

```
<IfModule mod_deflate.c>
# Insert filter
  SetOutputFilter DEFLATE
# Netscape 4.x has some problems...
  BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems
  BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine
# BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# NOTE: Due to a bug in mod_setenvif up to Apache 2.0.48
# the above regex won't work. You can use the following
# workaround to get the desired effect:
  BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

# Don't compress images
  SetEnvIfNoCase Request_URI \\.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
  Header append Vary User-Agent env=!dont-vary
</IfModule>

```

Note that the compression settings in EE are only relevant to the pages served by EE - templates. **Not** the external static/resource files.

---
Tags: cookies, subdomain
---


# Question
Title: MSM "You are not authorized to access this page" error
I'm having problems with an MSM install into an existing site (EE 2.9 / MSM 2.1.7) where non super admins can't switch to the added sites.

The links in the site switching dropdown look like `admin.php?/cp/sites&site_id=1&page=XXX` and `admin.php?/cp/sites&site_id=2&page=XXX` and when you click on them as a super admin you get redirected to whatever page you're on. But when logged in as a non-super admin you actually end up on `admin.php?/cp/sites&site_id=2&page=XXX` which is where the error message appears.

I've changed `cp_session_type` to cookies only and I've checked that the member group has the necessary privileges.

What else should I be looking at?

# Answer
It turns out that `/system/expressionengine/libraries/Sites.php` is unique to each MSM installation and needs to be downloaded from your account for the licence # it's associated with. You can't just copy a previously downloaded version of MSM over.
> 0 votes

# Answer
Member group settings are unique per site. Make sure that group has access to the control panel for the sites you wish them to have access on.
> 0 votes

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


# Question
Title: Further extending the SEO Lite through the advanced config options
I almost have what I am after working completely thanks to the answer from @bjørn-børresen on this previous question.

Now I have the description and images working the way I need, but I cannot get the title replacement to operate like I am needing.

Using the documentation, I entered the config options as:

```
/**
 *
 * Pull additional info for SEO Lite
 *
 * channel_id => array(field_id => tag_name)
 **/
$config['seolite_extra'] = array(
    '13' => array(                               // mission
        'headline' => array(
            'field_id' => 38,                    // {intro_title}
            'field_type' => 'text',
        ),
        'desc' => array(
            'field_id' => 37,                    // {brief_intro}
            'field_type' => 'editor',
        ),
        'image' => array(
            'field_id' => 36,                    // {page_header}
            'field_type' => 'file',
        )
    )
);

```

So inside my SEO template, (simplified here of course), I have the variable `{extra:headline}`in my template, but it doesn't seem to be reading. I am including the `switchee` logic to check for a default text string inside the default value entered and using the `chopper` plugin to trim the characters and strip html.

```
<title>{extra:headline} | {site_name}</title>
<meta name="keywords" content="{meta_keywords}" />
{exp:switchee variable="{meta_description}" parse="inward" }
    {case value="/\\\\My default string/"}
        <meta name="description" content="{exp:chopper chars='157' append='...'}{extra:desc}{/exp:chopper}"/>
        <meta property="og:description" content="{exp:chopper chars='157' append='...'}{extra:desc}{/exp:chopper}"/>
    {/case}
    {case default="Yes")
        <meta name="description" content="{exp:chopper chars='157' append='...'}{meta_description}{/exp:chopper}" />
        <meta property="og:description" content="{exp:chopper chars='157' append='...'}{meta_description}{/exp:chopper}"/>
    {/case}
{/exp:switchee}

```

The only issue I am having is getting the `{extra:headline}` to output.

EE 3.1.4, Stash 3.0.0, SEO Lite 1.5.1

# Answer
> 0 votes
As far as I can tell `{extra:headline}` should output fine, I would check:

1. That the channel\_id is correct. If you have multiple channels you would need to add this config for each channel (specifying which fields to pull data from for each channel)
2. That the field\_id's are correct. Note; SEO Lite for EE3 only supports type 'text' or 'file'. So even if you're pulling from an 'editor' field you'll have to specify 'text' (as the type of content pulled from exp\_channel\_data is text).

And lastly, inspecting the code I see it supports "max\_length" which is not specified in the docs, I'll fix that. But that means you should probably not need to use chopper (and switchee?).

Something like this in your config:

```
'desc' => array(
        'field_id' => 37,                    // {brief_intro}
        'field_type' => 'text',
        'max_length' => 157,
    ),

```

I realise that `{extra:headline}` was the main issue here, but again, I don't see why that shouldn't be output so please doublecheck the database id's you've used. (what is output for it btw, the actual tag ({extra:headline}) or just empty?)

---
Tags: ee3, seo, seo-lite
---


# Question
Title: Zenbu live look link and Publisher drafts
Zenbu offers the option to add a Live Look link to it's entries overview. But our client was complaining, this doesn't work for draft entries (using Publisher). Adding the `{exp:publisher:toolbar}` to the template is also not an option for them.

To be able to view the entry as draft, you need to add `?publisher_status=draft` to the preview template url. But there's no way to do that

# Answer
> 0 votes
**Option 1: Add javascript to preview template**

Add this script to the preview template you want to use for previewing Prublisher draft entries:

```
<script>
    var url = window.location.href;
    if (url.indexOf('publisher_status') == -1){
        if (url.indexOf('?') > -1){
            url += '&publisher_status=draft'
        }else{
            url += '?publisher_status=draft'
        }
        window.location.href = url;
    }
</script>

```

Only when no publisher status is present in the querystring, it will be added and the page will be refreshed.

**Option 2: Change the Fancybox code in Zenbu**

Look for the `zenbu_index.js` file in `/third_party/zenbu/javascript` and look for `Fancybox for Live Look`.

Replace this

```
$(this).fancybox({
    'overlayShow'       : true,
    'centerOnScroll'    : true,
    'type'              : 'iframe',
    'width'             : '90%',
    'height'            : '90%',
    'autoScale'         : true,
    'titlePosition'     : 'inside'
});

```

With this

```
var FancyBoxHref = $(this).attr("href")+"?publisher_status=draft";

$(this).fancybox({
    'href'              : FancyBoxHref,
    'overlayShow'       : true,
    'centerOnScroll'    : true,
    'type'              : 'iframe',
    'width'             : '90%',
    'height'            : '90%',
    'autoScale'         : true,
    'titlePosition'     : 'inside'
});

```

This involves editing code from the Zenbu module. So keep in mind that updating the module will also undo those changes. And it will add the querystring to all live look url.

---
Tags: ee2, publisher, zenbu, livelook
---


# Question
Title: Expression Engine conditional statements not behaving as expected
I'm really very new with expression engine, so bear with me:

I have an exp:playa:parents call, and I need to set the category conditionally.

I have the following:

```
            {exp:playa:parents
                    {if segment_4 == "new_arrivals"}
                        {if segment_3 == "furniture"}
                            category="57"
                        {/if}
                        {if segment_3 == "lighting"}
                            category="59"
                        {/if}
                        {if segment_3 == "accents"}
                        category="58"
                        {/if}
                    {if:else}
                        category="{segment_4_category_id}"
                    {/if}
                    channel="products"
                    disable="categories|member_data"
                    dynamic="no"
                    limit="24"
                    paginate="bottom"
                    {if rev_segment_1 == "all"}limit="500"{/if}
            }

```

As a programmer, the if/else logic seems... logical, but that doesn't seem to help the fact that the category doesn't seem to get set properly at all.

Is there a subtlety to conditional statements in EE that I am clearly not understanding? Am I approaching this the wrong way?

Any help would be so appreciated.

Edit: the url that's failing: http://localhost/arcade/by/accents/new\_arrivals

this page gets called in two places, and either that page output doesn't work (like it does with that else block in there) or the category doesn't get set properly here: http://localhost/damien\_langlois\_meurinne\_for\_pouenat/by/furniture/seating and it displays all the category types (not just seating) \[this happens after removing the else block\].

I've checked with the html comment method you mentioned, and all the data seems to be fine.

When I turn on the profiling output, I get this as well for the playa call:

```
 (0.122617 / 14.88MB) Tag: {exp:playa:parents entry_id="8380" {if segment_4 == "new_arrivals"} category="58" {if:else} category="57" {/if} channel="products" disable="categories|member_data" dynamic="no" limit="24" paginate="bottom" var_prefix="playavTWmYmQm"}

```

# Answer
> 0 votes
I wouldn't expect the conditionals to work inside a module call. I'd likely deal with the conditionals prior and come up with one variable and use that in the module call. You will have to use Stash from @croxton as it's handy in these situations.

This is not tested, just a thought:

```
{!-- We're inside an exp:channel call I expect --}
{exp:stash:set parse_conditionals="yes" trim="yes"}
<!-- Capture one stash to one variable -->
{stash:catID}
{if segment_4 == "new_arrivals"}
  {if segment_3 == "furniture"}57{/if}
  {if segment_3 == "lighting"}59{/if}
  {if segment_3 == "accents"}58{/if}
{if:else}{segment_4_category_id}{/if}
{/stash:catID}
<!-- Capture either 500 or 100 as the limit -->
{stash:limit}
  {if rev_segment_1 == "all"}"500"{if:else}"100"{/if}
{/stash:limit}
{/exp:stash:set}

<!-- May need to wrap this is in a parse tag to ensure the dreaded EE parse order rears its head -->
{exp:stash:parse}
  {exp:playa:parents
  category="{exp:stash:catID}"
  channel="products"
  disable="categories|member_data"
  dynamic="no"
  limit="24"
  paginate="bottom"
  limit={exp:stash:limit}
  parse="inward"
}
...
  {/exp:playa:parents}
{/exp:stash:parse}

```

This is very crude but you can see the logic, capture your variables, set them and call them into the playa tag. There are a multitude of ways this can work and will require a bit of experimentation but the logic should be sound enough.

# Answer
> 0 votes
There doesn’t appear to be anything wrong with the logic, though you could be more concise using the {if:elseif} construct perhaps. Perhaps if you post the URL that is failing, and what you get from the logic statement for that URL, it might be easier to work out what is going on.

You might have thought of this already - but if not, sometimes it helps to simply dump out the variables as a comment in the HTML so you can see what actually is being used in the logic… so something like:

```
<!—- Segment 1: {segment_1} / Segment 2: {segment_2} … —>

```

---
Tags: playa
---


# Question
Title: Is there a way to get the member_id of a user that was just logged out?
I currently have the core file `Session.php` modified a little to keep track of login/logout information and `member_id`s - `create_new_session()` for login, `destroy()` for logout.

I realize that this can be better achieved with an extension using hooks - `member_member_login_single` after login, `member_member_logout` after logout.

The issue, though, is with the logout hook the system doesn't pass along any data (documentation), so there's no way for us to know the `member_id` of the user who just logged out.

Is there a way to accomplish this at all aside from modifying core files? I already have a hacky solution (editing core files), so I'm looking for the "right" way to do this.

# Answer
> 1 votes
Although the hook doesn't provide any information you can use, you could do a query on the exp\_members table where ip\_address is equal to the users ip, and sort the results by last\_activity descending. Logging out should record the timestamp into the last\_activity field and the ip address is updated every time a member logs in. As a result, this should then allow you to get the relevant data for that member to use in your tracking. But yes, definitely use hooks instead of hacking core files :)

---
Tags: ee2, add-on-development, hook, session-end-hook
---


# Question
Title: How to add like functionality on channel entry
I need the like functionality on channel entry with counter. Please advise.

Thanks

# Answer
> 0 votes
I would stay away from secondary plugins and modules because you never know when the author will stop supporting or updating them.

If you really want to get into visitor interaction, I recommend Solspace's Freeform module. It's a bit complex, but it can be used for polls, surveys, voting and other needs.

---
Tags: channel-entries
---


title: Exporting Products to a CSV

text:
# Question
Title: Exporting Products to a CSV
Is there a way of exporting all products and data to a CSV file from carthrob expression engine v2.8.1?

Kind regards,

Dan

# Answer
> 2 votes
I don't know of any particular 3rd party add-ons that are crafted to specifically export Cart Throb data, but it's a pretty cut-and-dry process to output a MySQL table to CSV. You can use a tool like Sequel Pro (OS X) or MySQL Workbench (Windows, Linux) to select your data with a query and then save the query results as a CSV file.

If you require something easier to work with or more integrated with ExpressionEngine, there might be an add-on to help, but I personally don't know of one. Datagrab might have integration with Cart Throb. Hopefully someone else can chime in.

The process of crafting a PHP script or a full EE add-on to export MySQL tables is a pretty trivial development process. It might take some time to get right but it's not complex at all. Consider going for it (assuming you are a developer)!

# Answer
> 2 votes
Try https://devot-ee.com/add-ons/ajw-export. I recently used it to export Store products.

# Answer
> 0 votes
https://devot-ee.com/add-ons/zeal-smart-export is the best option to export data from channel without do any code or sql query.

# Answer
> 0 votes
I second the use of EE tags and templates.

You don't have to worry about third-party module updates and support. You also can use the same method for exporting other content with any number of different tags attached including HTML, XML, etc.

We have even used that method to export content with Quark, InDesign and other publishing tags.

---
Tags: cartthrob, export, csv, product
---


# Question
Title: Expresso store - adding note after order
Is it possible to add a note to an order AFTER it is completed.

I'd like the user to add a note AND add data to a hidden field that is added to an order.

This really needs to be done after the order is paid for.

# Answer
Store uses channel entries to store it's data, so theoretically you could return them to a URL with the entries ID in it like `http://sitename/thanks/999` and make an index template inside a folder group title 'thanks.group\>index.html' and make it a channel form that picks up {segment\_3} as the entryID.

Hide the rest of the fields and show just the comments field, hitting save will save the entry with the extra detail. You'd likely want to do some serious checking/validation to make sure it's the same user/session as you don't want just anyone typing in random numbers stuffing other people's orders, but defiantly worth a look.

I've done similar with Freeform and I think post-purchase updates.
> 0 votes

---
Tags: expresso-store, custom-fields, orders
---


# Question
Title: How to get max count for a loop in channel entries tag
I am trying to get the max results for the categories inside this channel entry. If the current category is the last one in the loop I don't want to add a , after the output.

```
   {exp:channel:entries channel="ch_efn_gallery" entry_id="295"}
    {categories}
            {"{category_id}":"{category_name}"}
           {if categories:count!=categories:total_results},{/if}
    {/categories}
   {/exp:channel:entries}

```

*categories:count* gives me the correct number. But *categories:total\_results* doesn't work. And i din't find out how to get the max value for categories. Actually this template has much more output but i shortened it to the core of my problem.

# Answer
> 1 votes
I solved my problem by using php. First i go through all of the categorys and count them. after that i check it with another variable where i count the current Category.

```
[
{exp:channel:entries channel="ch_efn_magazin" entry_id="304"}
    {
     "ID": "{entry_id}",
     "Category": [{
        <?php $maxCat = 0; $currentCat = 0; ?>
        {categories}
           <?php $maxCat++; ?>
        {/categories}

        {categories}
          "{category_id}":"{category_name}"<?php $currentCat++; if($maxCat != $currentCat) echo(','); ?>
        {/categories}
        }]
 }
{/exp:channel:entries}

```

The whole reason I am doing this, is to create a JSON file. I know that there is this Json Plugin by Rob Sanchez but with this plugin I wans't able to loop through my Channel\_Images. That's why I decided to do it like this.

# Answer
> 0 votes
You could try and simply use the backspace tag

Assuming it's that straight forward. I've never really liked the EE categories tag, I lean towards GW Categories. You can then disable categories in your main loop to save some overhead.

# Answer
> 0 votes
GW Categories is free, but for EE1 and EE2 only - do something like:

```
{exp:gwcode:categories entry_id=“295" style=“linear” backspace=“1"}
{cat_id}:{cat_name},
{/exp:gwcode:categories}

```

If you want to work in EE3 (or plan to) you could use Category Construct as a direct replacement - though currently the ‘backspace’ feature in Category Construct is broken.

---
Tags: categories, entries, loop, count
---