# Question
Title: It is possible to paginate the categories??
It is possible to paginate the categories??

Inside the site project there is a lot of categories, and i would paginate them. But i don't know if it's possible or not to paginate a categories list.

Thanks,

Stéphane

# Answer
> 1 votes
None of the category-related tags or add-ons have pagination that I am aware of.

But you could use the Query module or the Active Record plugin to generate your category listing. Both of these have pagination built in.

---
Tags: categories, pagination
---


# Question
Title: Channel Images: Unable to upload images to product entry
I am having the issue that I am unable to upload any images to the product entry,

The console error I get is:

XMLHttpRequest cannot load http://www.findsignage.co.uk/?ACT=38. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://findsignage.co.uk' is therefore not allowed access. admin.php?S=239ef94834e3801b60655ed166061f89f7044695&D=cp&C=content\_publish&M=entry\_form&channel\_id…:1 Uncaught TypeError: Cannot set property 'innerHTML' of undefined

Thanks

# Answer
> 3 votes
The error suggests that you're trying to access content on another domain or sub-domain via JavaScript. Specifically from the information you have provided I think the `www` is the cause of the problem as this is seen as a separate subdomain and not allowed in the cross-origin policy.

Make sure that you pick either `findsignage.co.uk` or `www.findsignage.co.uk` as your fully qualified domain name and stick with it. The debate is out as to which is better to use but it really doesn't make too much difference as long as you're consistent in your choice.

Take a look through your EE config and that set for Channel Images and ensure all references are set to the same location (one of the above). That should resolve the cross-domain origin issue.

---
Tags: ee2, channel-images
---


# Question
Title: Shipping discount for one shipping method in CartThrob
Is it possible to have a shipping discount for just one shipping method in CartThrob?

Basically, our client would like to set up Free Shipping Over X, with X being $150 but have the free shipping ONLY apply to UPS Ground shipping (which is $10).

My guess is that this isn't exactly possible. It seems like a workaround would be to use "Amount Off For Orders Over X", however I'm positive that our client won't go for that.

# Answer
> 0 votes
So this was all confusing. Turns out all the client needed to do was set the amount that shipping should be free in their shipping settings.

# Answer
> 0 votes
You could modify the Cartthrob\_discount\_free\_shipping\_over\_x. Open it up… find this:

```
        if ($this->core->cart->subtotal() >= $this->core->sanitize_number($this->plugin_settings('order_over')))
    {
        $this->core->cart->set_discounted_shipping(0);
    }

```

change it to this:

```
        if ($this->core->cart->subtotal() >= $this->core->sanitize_number($this->plugin_settings('order_over')))
    {
        if ($this->core->cart->shipping_option() == "YOUR METHOD HERE")
        {
            $this->core->cart->set_discounted_shipping(0);
        }
    }

```

Review some of the other plugins if you feel like adding settings for the shipping option, or want to create a completely new plugin based on that existing one. I suggest putting it in the cartthrob \> third\_party \> discount\_plugins folder for ease of maintenance.

Here's some docs related to discount plugin creation: http://cartthrob.com/docs/developers/discount\_plugins/index.html

---
Tags: cartthrob
---


# Question
Title: Setting blank value for first option for dynamic Freeform select "load from channel field" list type
I am trying to set up Freeform Pro's dynamic Select list types (Country, State, and Load from Channel Field). I would like the first option to be an empty value / label pair like:

> -- Select --

For country and state I was able to insert a blank value by modifying the corresponding language files (hackish, but it could work). Or I could of course just copy and paste a regular value/label list into the Newline Delimited Textarea option.

Unfortunately, I cannot figure a way to include a blank value/label pair for the "Load from Channel Field" option. I would like to keep this dynamic so the list is automatically updated without forcing the client to remember to update the field as the channel data changes.

Has anyone been able to find a better solution for inserting an empty value/label pair for the first entry in these dynamic selects?

# Answer
> 2 votes
I seem to recall on a large project I worked recently that if you're using Pro to create the actual form AND you're also using the code it generates or the simple {freeform:field:my\_field\_name} in your template then you're limited to no real options.

If you build the template using traditional you can insert a bogus `<option value="nothing">Select</option>` in the code but past that you either build it manually and have blank options or use the Freeform shortcut tags and deal with the lack of "select" options unfortunately.

That was some 6+ months ago so it may have changed.

# Answer
> 0 votes
I had this exact same issue and thought I had solved it with the following jQuery:

```
$(document).ready(function() {
      $('#myList').append('<option value="1" selected="selected">-- None Selected --</option>;');
 });

```

But, if the user left this option selected without choosing anything else from the select box, Freeform considered it invalid input and errored out. I wanted users not to have to select from this box, as "no selection" was a valid possibility.

I ended up adding "None Selected" as one of the entries in the channel, closing it so it wouldn't show in the channel but would still show in the select box on the form, and using the following jQuery to set it as the default choice.

```
$("#myList option[value=109]").attr("selected", "selected")

```

where 109 was the entry id of the "None Selected" entry I had created.

---
Tags: solspace-freeform
---


# Question
Title: Publish layout thumbnail file names changed after update
I recently updated a site from 2.1.x to v2.7.3

I've synced my file directories, images display on the front-end just fine. But I'm having issues with the thumbnails in publish layouts (they show in the file browser and file manager fine as well).

So for example, this is what I see in the admin:

The path to the missing image is /images/uploads/instruments/\_thumbs/TEN\_ANN\_FA.png

On my server, the file is definitely there, but it has "thumb\_" appended to it: /images/uploads/instruments/\_thumbs/thumb\_TEN\_ANN\_FA.png

This is the same case for ALL of the thumbnails in the publish layouts.

Any ideas why this has happened? And is there somewhere in the config I can manipulate the thumbnail file names so that it finds them correctly?

# Answer
> 0 votes
Give this a try if you haven't already.

1. rename \_thumbs to \_thumbs\_OLD
2. In the control panel, navigate to **Content \> Files \> File Upload Preferences**
3. Click on the Synchronize button for the upload destination having issues.

---
Tags: publish-layout, image-path, thumbnails, filename
---


title: Post multiple entries via Channel Form?

text:
# Question
Title: Post multiple entries via Channel Form?
Don't need an edit function - just a way for a new member to post new entries, one time, in custom fields (10 of them) in a single channel via one page Channel Form. So basically one form with 10 fields, each of which will be a new entry in one single channel.

Not sure if Channel Form can do this or if there's another plugin. I found one called Mefu but it only works for editing multiples not posting new ones.

Any suggestions?

# Answer
The Channel Form module is what you use to submit entries from the front-end of the site.

> The Channel Form **makes it possible to add** and edit entries from outside of the Control Panel using a regular form inside a template.

I don't understanding the "multiple entries" part of your question title so can't offer much assistance there.
> 2 votes

---
Tags: channel-entries
---


title: Better debug output

text:
# Question
Title: Better debug output
I'd like to know if there is any way to output the document's source before any of it is rendered. This would mean retaining all tags, markup, and code: PHP, HTML, EE tags, scripts, etc to see the entire doc. All this set is accessible via debug but it's horrendously garbled and hard to shift through.

# Answer
I'm not following your question 100% but take a look at the **EE Debug Toolbar**. It's the newest addon for debugging EE templates and may give you more of what you're wanting.

> Adds an unobtrusive interface for debugging output on an ExpressionEngine 2.0 site. Replaces default Profiler and Template Debugger provided with ExpressionEngine.
> 2 votes

---
Tags: debugging
---


# Question
Title: Timed Out at Control Panel Login as Super Admin
I have a site that I have running on a company server that is an internal server. It does not allow requests from outside to come in. The entire site works fine on my local computer and on a server that is external.

On my internal server I am getting these errors in the error log

`[warn] mod_fcgid: read data timeout in 61 seconds`

`[error] Premature end of script headers: admin.php`

So my thought is that it is something with it calling out and waiting on a response. I have disabled the Auto check for update in the control panel. And that allowed it to work for a little while. But now I am not able to login as a Super Admin. I am able to login as any other type of member including one that is a copy of the Super Admin profile.

I am running EE 2.7.3

Does anyone have any help for me?

Thanks

# Answer
Have you tried cranking up max\_execution\_time? Try 300 Various ways to do it - some cPanel versions let you configure it along with php version or you could use a php.ini file
> 1 votes

---
Tags: control-panel, login, super-admin
---


# Question
Title: Freeform upload error: The file could not be written to disk
My client uses Freeform Pro to take resumés and cover letters through a lengthy career registration page. After working fine for two months, applicants started getting this error:

The form you submitted contains the following errors

* The file could not be written to disk.

They only have about 10 megs of files in the upload folder, and have collected 274 documents already through this Freeform Pro form. I was able to upload files through FTP to the upload destination, so it doesn't seem to be a server limit. They are using EE 2.6.1 and Freeform Pro 4.1.3

Is there limit in ExpressionEngine, Freeform Pro, or the server that can be changed to allow uploads to continue? What might be causing this?

Edit: After further investigation, I found the problem appeared only for logged out users. If I was logged in, I had no problem uploading files through the form. This indicated the problem was not a hidden limit setting.

# Answer
> 4 votes
After more investigation, I reviewed the settings for the upload field. Once I checked this previously unnecessary option, the problem disappeared.

> **Disable XSS Clean** This option allows you to disable system XSS cleaning just for this file upload field in case you are having issues with user uploads being incorrectly blocked.

While I can't be sure, and the hosting company denies it, I suspect they changed a setting or upgraded software causing XSS cleaning to become a problem.

# Answer
> 0 votes
I've had this before too where the client had reached the disk storage limit on their hosting account. Upgrading hosting or clearing out some old files to free up storage might help.

---
Tags: solspace-freeform
---


# Question
Title: Super Search - {super_search_keywords} Not Parsing
I have an instance where `{super_search_keywords}` wont parse. Everything else Parses fine and checking the documentation it is possible to use the tag outside of `{super_search:results}` \- anyone have any ideas?

```
{super_search_total_results} Results found for {super_search_keywords}
{exp:super_search:results limit="50"}
    {title}
{/exp:super_search:results}

```

# Answer
> 2 votes
In my experience, `{super_search_keywords}` won't parse outside the results loop, despite what SolSpace's documentation says.

---
Tags: supersearch
---


# Question
Title: Secondary site on MSM not retaining its URL
EE 2.7.2.

I have a secondary site on Multi Site Manager. Users can only login to EE from the main site, so I have no admin.php for the secondary site.

In the secondary site's index.php, I have:

```
 $assign_to_config['site_name']  = 'secondary_site_name';
 $assign_to_config['cp_url'] = 'http://primarysite.com/cp';
 $assign_to_config['site_url'] = 'http://secondarysite.com';

```

However, when I go to Admin --\> General Configuration for the secondary site, **URL to the root directory of your site** is still set to primarysite.com

How do I make this setting correct? Note: I will be adding additional sites later.

# Answer
> 1 votes
EE CP don't use variables from index.php. Only from config's or from admin.php. Index.php is only effected on Frontend.

For other sites the system preference is keep in DB (exp\_sites table). So you just need to change it for each site.

p.s. possible you setup your first site site\_url in admin.php - you need to removed for your model.

# Answer
> 0 votes
Just out of interest, what problems exactly does this cause? I'm currently in the process of setting up an MSM build (actually upgrading it from an old EE1 installation) and your question made me notice that I have this happening too.

Are you using a config bootstrap (FocusLab Master Config)? If so you can 'fix' it by adding this to your config.master.php:

```
// --------------------------------------------
// RESET MSM SETTINGS IN A SHARED CONTROL PANEL
// --------------------------------------------

// are we in the control panel?
if (isset($_GET['D']) && $_GET['D'] == 'cp')
{
    switch ($_REQUEST['exp_cp_last_site_id']) {
        case '1' : $env_config['site_url'] = "http://site1.com/"; break;
        case '3' : $env_config['site_url'] = "http://site3.com/"; break;
        case '5' : $env_config['site_url'] = "http://site5.com/"; break;
    }
}

```

If you're not using a bootstrap, this should work in your main config.php file too, but change the `$env_config` to just `$config` instead. In each case you'll need to hardcode the site id and the site url.

---
Tags: multi-site-manager, config
---


title: Ajax Request from Template

text:
# Question
Title: Ajax Request from Template
I am trying to return json from a module method. Very simple example at this point.

```
public function mealDates()
{
    echo "{\"foo\" : \"bar\"}";
}

```

From the template

```
$.ajax({
    //request dates that are already taken
    type: "POST",
    url: "ACT=79",
    success: function(json){
        console.log(json);
    },
    error: function(e){

    }
});

```

If I declare dataType: 'json' returns error. If I don't I still am not getting the {"foo" :"bar"} from method. Suggestions on how to return json to template?

Thanks

# Answer
You can use `send_ajax_response()` which will return JSON and works well for response to ajax requests. For your example you'd do

```
public function mealDates()
{
    $array = array(
        'foo' => 'bar',
    );

    return $ee()->output->send_ajax_response($array);
}

```
> 2 votes

---
Tags: module, ajax, json
---


# Question
Title: Adding a PayPal button along with credit cards with exp-resso store
I have a checkout page with a drop down menu containing credit card options. The client would also like to add a PayPal button.

I'm using PayPal Pro as the payment processor. Previous iterations of the checkout page used PayPal express which provided the functionality we're looking for, i.e. Visitors click to go to client's PayPal page, log-in to PayPal, pay and re-direct to confirmation page.

I tried adding a button using PayPal's button generator, but it just caused the page to reload when clicking on it - it also disabled the "Place Order" button when I selected a credit card.

Any suggestions on adding a PayPal button?

# Answer
Don't use PayPal's button generator, because that won't be integrated at all with Store. You want to add PayPal Express as an additional option in Store, alongside PayPal Pro.

You can enable both payment methods in the control panel. Then you will need to use either hidden fields or radio buttons to give users a choice of which payment method to use.

To do this, submit a `payment_method` field in your checkout:

```
<input type="radio" name="payment_method" value="PayPal_Pro" />
<input type="radio" name="payment_method" value="PayPal_Express" />

```
> 1 votes

---
Tags: expresso-store, paypal
---


# Question
Title: Low variable as channel entry_id parameter across MSM sites
I'm trying to access the entry\_id of an entry (one only) selected with Low Variables, to use as a parameter in a channel entries tag.

The entries are stored in site A. The template is in site B.

Other SE solutions involve using the variable syntax instead of the tag syntax, however, that syntax only works with the Low Variables 'select' variable type, which does not allow selections across MSM sites.

* The Playa variable type does allow selections across MSM sites but I can't figure out how to use that to output the entry id's as an early-parsed parameter in the channel entries tag. Whatever I try produces nothing.
* I have tried setting up the variable in site A using the select variable type and then using the variable syntax in Site B template, but it doesn't allow me to pull info from site A using that syntax.
* I have tried using the :parse syntax with site A selected. If I use this outside the channel:entries tag it works and outputs the correct entry\_id, but using it inside the entries tag:

```
{exp:channel:entries site="default_site" channel="project_news|projects" limit="1" entry_id="{exp:low_variables:parse var='default_site:gv_ft-featured-stories'}" orderby="date" sort="desc" dynamic="no" disable="category_fields|member_data|pagination"}
```

Doesn't work - it just produces:

```
entry_id="M10o93H7pQ09L8X1t49cHY01Z5j4TT91fGfr"
```

* I have enabled early parsing in the variable settings.

Any advice appreciated.

# Answer
OK - got it working by using :parse in a tag pair around the channel:entries tag:

```
{exp:low_variables:parse var='default_site:gv_ft-featured-stories'}
{exp:channel:entries site="default_site" channel="project_news|projects" limit="1" entry_id="{gv_ft-featured-stories:data}" orderby="date" sort="desc" dynamic="no" disable="category_fields|member_data|pagination"}{title}
...
{/exp:channel:entries}
{/exp:low_variables:parse}

```

There might be other/better ways but this is working for me.
> 3 votes

---
Tags: multi-site-manager, low-variables
---


title: exp_assets_index_data table is MASSIVE

text:
# Question
Title: exp_assets_index_data table is MASSIVE
I'm running assets2, connecting to some S3 buckets. At the moment we're transitioning between one set of buckets and another, so I would expect our index to be twice as big as it will eventually be. But recent dumps of the database seem to be growing exponentially (it leapt from 10.4Mb to 40Mb in a week and there's an editorial team of one working on the build!) and I think it's the assets\_index\_data table - a snapshot this morning tells me that it has 3,045,452 rows.

I'd be surprised if we had 10,000 images in these collective buckets, so I can't figure out why that table is so gargantuan - surely it can't be right? It contains big groups of rows that all have the same session id - it's almost as if every time it indexes the buckets, it creates new rows rather than updating existing ones, leading to an enormously bloated table.

Of course I may be completely wrong and perhaps it needs to be this big, but it doesn't seem right and can't continue to grow this way!

# Answer
> 1 votes
Assets does add new rows every time you run indexing. Assets also should be deleting the rows belonging to the current session once it's done indexing (if it's allowed to run to the end).

Either way, it's completely safe to truncate that table, unless you are in the middle of running an index update.

---
Tags: assets, amazons3
---


title: Filling in spaces for entries...

text:
# Question
Title: Filling in spaces for entries...
Like, say if you require 10 entries in your Channel limit but there is only 4. Is there a way of filling in these 'spaces' with alternate text or html?

I've found a plugin called Filler which does exactly this but it doesn't work in my case as I'm filtering the results through a couple of custom field searches via another plugin.

Anyone had to address something like this? Or any suggestions of another way to get alternate content into a channel entries loop as described above? Would use an if conditional but that won't work so is basically a way of faking an entry or entries that's needed.

# Answer
> 2 votes
If it's a form of daily calendar than I'd look to handle the display purely in the front-end templates so that each hour slot is laid out in full. You can then just loop through the channel entries for that channel and test on a single conditional to see if it has either been *booked* or is *vacant*. This can be either be a status message on the channel entry or checking the existence of a particular field for details of that appointment.

In this case you wouldn't need any filler content as it's handled by the template itself and you're just adding a status to it.

---
Tags: channel-entries
---


# Question
Title: Control Panel theme that looks like Wordpress
I think EE's Control Panel is super simple and intuitive. Granted, I have been using it for over 3 years now, so I am comfortable in it. However, I have had several clients over the years express that they are more comfortable in the Wordpress Backend.

I was wondering, is there any Control Panel theme available that makes the EE Control Panel look and behave similar to Wordpress' backend? (Nav on the left, similar nav organization, publish page layout, etc).

Thanks!

**UPDATE:** I was able to accomplish most of what I wanted by modifying the control panel CSS. Basically, just to get the top nav down along the left.

It's not everything I wanted, but it's a start. Basically, I just made a copy of `/themes/cp_themes/default/` and called it `/themes/cp_themes/wordpressy/` and added the following CSS to `global.css`:

```
body {
    background-color: #27343C;
}
#branding {
    margin-bottom: 0px;
}
#mainMenu {
    width: 15%;
    height: 100%;
    float: left;
    position: fixed;
    left: 0px;
    top: 20px;
    z-index: 9999;
}
#navigationTabs {
    margin: 0px;
}
#navigationTabs li:last-child{
    width:100%;
}
#navigationTabs li,
#navigationTabs li li {
    float: none;
}
#mainWrapper {
    float: right;
    width: 85%;
}

```

I would like to be able to split the main "Content" menu item into individual menu items for each Channel, with maybe "Add New" and "View All" sub items... maybe I could do that with some clever jQuery?

And my reasoning again, for those who think this is a pointless endeavor, is just to break down some imaginary barriers that some clients of mine seem to have when switching to a new CMS.

# Answer
I'd recommend giving Zoo Flexible Admin a whirl. It allows you to create a custom menu in the control panel per member group - and that is a pretty powerful thing when it comes to reorganizing the menus in the control panel, labelling them in a manner that makes sense for your client and stripping out anything they really don't need to see or even have access to. You can greatly simplify the control panel and achieve a much more streamlined experience for your site admins with it. I highly recommend it. And of course within the publish page itself, EE's native publish layouts give you the ability to reorganize the publish screen itself - not hugely, but certainly enough to improve the admin experience there as well.
> 7 votes

# Answer
You can find the available CP themes at http://devot-ee.com/add-ons/filter?t=cpt \- but in the end EE and WP are different applications, think about content differently, and hence require different architectures in the Control Panel.
> 7 votes

---
Tags: control-panel, themes, cp-themes
---


title: Template Caching and Cache Times

text:
# Question
Title: Template Caching and Cache Times
I've been playing around with the caching settings on my EE site. I'm getting really good server response times and the getting the number of queries right down which is perfect.

I've always avoided caching due to content 'being out of date', but I realise if you have the config value 'new\_posts\_clear\_caches' set to 'y' then each time there is a new post or one gets edited or a new comment is added then the cache is cleared.

My question is about the cache expiry times. I've been defaulting to 60 mins but now I'm thinking that if the cache is cleared when new content is posted then why not set this much higher - 24 hours or so? Is there a downside to this?

I have some tags which really don't need updating much at all - category lists for example.

Obviously, I'm not caching any parts which vary based on member login etc...

What do people set their cache times to?

# Answer
I personally think the ideal is that each page is cached non-stop until the content or template changes. This is possible with add-ons like Causing Effect CE Cache, which is great for high-performance / high-load sites. On these sites, pages can be cached for days and months without being refreshed.

When I use only the built-in EE caching, I tend to set the cache refresh time to be 60 - 180 minutes. It's arbitrary--long enough to help performance, but short enough that site content managers can always trust that their changes will go live that day.

But I think it's fine to set a much longer cache expiration time--especially if the site content managers understand how the cache works.

There's a famous saying that cache invalidation is one of the two hard problems in computer science. And, for EE--both with its native caching, and with add-ons like CE Cache and Solspace Static Page Caching, the reality is that sometimes the cache expiration for a particular page / template doesn't happen as expected.

So imho the one reason to set shorter cache durations is for EE to have more chances at refreshing pages / templates in any period, because it may fail to refresh the cache in one way or another at any given moment. But this is a little issue, or a non-issue, if the content manager knows how to recognize whether a change has gone "live," and also then is comfortable manually refreshing the cache when needed.
> 3 votes

# Answer
It's been long enough now that I don't remember the details, but I had a conversation with Nevin of Engine Hosting and his recommendation was 10 minutes max. Maybe a conversation with someone from your hosting environment is in order.
> 1 votes

---
Tags: caching, optimization
---


# Question
Title: Exp:resso store shipping plugin doesn't show up
I don't see the option to add the standard USPS, UPS and FedEx Shipping plugins when I add a new method.

The extension is enabled and the settings already in place. But {field:shipping\_method} produces an empty drop-down on my checkout template

# Answer
> 2 votes
You will need to goto Add-ons \> Extbesions and enable the extension. The docs are a bit out of date at the moment but should be fixed soon.

The page from your screenshot is for the Default Shipping Module in Store v2. The new shipping structure will only show avilable methods based upon your shipping destinations and the customers address.

# Answer
> 1 votes
I also had this issue, Uninstalling, removing the settings in the extension table and reinstalling resolved the issue.

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


title: Template 404 Redirect

text:
# Question
Title: Template 404 Redirect
Do you know if it's possible to redirect to a specific 404 page when a template group isn't found rather than just show the 404 with the incorrect url?

For example,

If I go to `example.com/nonexistant-templategroup/` I need it to redirect to `example.com/404/` rather than stay as `/nonexistant-templategroup/` showing the 404 template.

Cheers

# Answer
You can accomplish that by doing the following:

1. Make a template group called `404.group` and in that template group create an `index.html` template (this will be your 404 template)
2. Set *"Enable Strict URLs"* to *"Yes"* in your Global Template Preferences
3. For the *"404 Page"* setting choose *"404/index"* (the template you created in step 1 above), again in your Global Template Preferences
4. In `404.gorup/index.html` put the following conditional

```
{if segment_1 != "404" OR segment_2 != ""}
    {redirect="404/index"}
{/if}

```

This will ensure that when a 404 is triggered and your 404 template is shown, it will be further redirected to the *vanity* 404 URL of just `/404`.

There are a couple potential downsides to doing this, though.

* You won't have a record of these 404 URLs in Google Analytics so that you can see what URLs are erroring.
* The http status will not actually be 404, but 302 (redirect). You could get around this by using the HTTP Header plugin and deliberately setting the status with `{exp:http_header status="404"}`
> 3 votes

---
Tags: templates, 404, redirection
---


# Question
Title: Channel form categories {category_parent} returns ID instead of name?
The the EE docs here: http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_form/index.html#categories

It says the {category\_parent} tag should show: "The name of the category parent if it exists, indented according to the category depth."

In fact, it outputs the parent's ID, not the name.

**Is this an error in the docs, or a bug in EE?**

# Answer
To fix this problem I'm using the Cat2 addon to convert category id into something else (in my case url\_title):

```
{categories}
     {if "{category_group_id}" == "12" && "{category_depth}" > 1}
          {exp:cat2:url_title category_id="{category_parent}"}
     {/if}
{/categories}

```
> 0 votes

# Answer
I'd say it's a bug, otherwise the variable would more logically be category\_parent\_id.
> 0 votes

---
Tags: categories, channel-form
---


# Question
Title: Unable to use price:plus_tax with Matrix field
I've got a matrix for my price modifiers. I don't map the base price field because I want to use the modifiers price as the full price.

So when I use my {price} variable I get the price without tax. I've tried {price:plus\_tax}, but that doesn't seem to work. Everything is ok when I view my cart, but I really want the option to show the price with or without the tax in the step before.

# Answer
The price:plus\_tax tag won't work with a text field. It needs to be one of the various CartThrob Price Fieldtypes to use that tag.

If you use the `{exp:cartthrob:item_options}` tag to display your matrix modifiers, you'll be able to use :plus\_tax.
> 0 votes

---
Tags: cartthrob
---


# Question
Title: Moved updated site to live hosting, getting white screen on front-end and when trying to view CP login page
I got an established site running locally on my computer and updated EE from 1.6.9 to 2.7.3. I also made other modifications to the site and it was working fine locally. I moved all the local site files to the live host and renamed the old stuff "system\_old, themes\_old, etc." like I was doing an upgrade. After everything was uploaded I changed the folder names and dropped the live DB and then imported the updated DB. I get a white page when trying to access control panel and the front-end of site. I have attached an image of the debug error I get. I can see the old local path is still there... I 99% sure my DB is connected ok, and all files have been uploaded. I haven't changed any paths yet, because I cant login to the CP...any ideas? I really need to get this working soon as my site is down :/

EDIT: I've managed to get rid of the PHP errors, but the Fatal Error belwo those is still there causing issues...any idea what that is from?

# Answer
> 3 votes
From these errors it looks like the paths are pointing to folders that don't exist (because you're moving from a local setup to live). Have you ever used a multi-environment config like Focus Lab's Master Config?

Since you can't log into the control panel and it *looks* like the issue has to do with paths, you could get the paths reconfigured using a multi-environment config. Focus Lab documented the installation process very well. I'd recommend looking into it.

# Answer
> 1 votes
It looks like you still have references to your local filesystem for both your **themes** folder and your **templates** folder.

These values might be set in your `config.php` file, or directly in the database. (If you set them via config, you can override any bad values in the database.)

Pop these in your `config.php` file to fix this up:

```
$config['tmpl_file_basepath'] = '/real/path/to/templates';
$config['theme_folder_path'] = '/real/path/to/themes';

```

# Answer
> 0 votes
Excellent suggestions by Derek and Aaron.

It could also be something much simpler -- try re-uploading ALL files and reset permissions. White screens can caused by corrupted files during transfer via FTP/SFTP.

---
Tags: upgrade, blank-screen
---


# Question
Title: Comments - Convert HTML to character entities
I wanted all my private messages and comments HTML text to be converted to character entities.

Fortunately for private messages, I was able to do it by setting a configuration via the Control Panel

Members -\> Preferences -\> Private Messaging Preferences -\> HTML Formatting in Private Messages

Looking for a similar configuration for comments in the Control Panel, I can't seem to find any.

Is there a configuration for this specifically for comments?

# Answer
I believe that's generally located in the General Channel Settings, and would need to be set per channel, which makes sense, since comments can be turned on and off per channel. See image:
> 1 votes

---
Tags: comments
---


title: Long URL's and templates

text:
# Question
Title: Long URL's and templates
I'd like to use some templates to display content at segment 4 of the URL.

http://example.com/news/world/australia/melbourne

News and World have their own templates and Australia is channel entry that uses the same template as World. I'd like to extend the Australia channel entry to Melbourne and use a new template but not sure how?

# Answer
> 1 votes
There are probably other ways to do it, but you could…

Turn off dynamic processing of url's since segment\_3 will not be an article title. Then use `{if}` statements. For example, something like:

```
{if segment_3 =="australia" AND segment_4 ==""}
   <p>return this</p>
{if:else segment_3 =="australia" AND segment_4 =="melbourne"}
    {embed="australia/cities"}
{/if}

```

Your template to process city information, would then be displayed on the country template. It's like setting up a single page site processor, within a template group. Basically, you are controlling the url with various {if} statements.

My only concern here would be about the potential number of cities you'd like to display. Manual specification of the cities pretty much means manual modification of template every time a new city is added. You might want something more flexible to add cities on the fly.

---
Tags: channel-entries, segments
---


# Question
Title: Can't 'Edit' an asset in the Assets module
We have number of sites running the P&T Assets add-on. All are working fine and allow us to 'Edit' the properties of a file or image when right-clicking on the asset. However, we've just started a new build **using EE: v2.7.3 and Assets: 2.2.2** and for some reason, choosing 'Edit' when right-clicking doesn't display the edit pop-up. We can successfully choose 'View', 'Rename' and 'Delete'...but choosing 'Edit' does nothing?

I've tried in Safari, Chrome and Firefox. All fail. I'm guessing it's a permissions issue? However, I'm logged in as 'Super Admin'.

Any thoughts?

Gary

# Answer
According to Andris @ P&T, the issue was caused by a bug in Assets. A fix will be included in the next version of Assets.

> I fixed it for your install and this fix will be included in the next Assets version, so you don't have to worry about updating, unless you update to Assets 2.2.4, which is currently the freshest version out there and it does not include this fix. If you do and this error comes back, let me know - I'll fix it again :)
> 0 votes

---
Tags: assets
---


# Question
Title: Simple conditional statement and parse order problem
I'm fairly new to ExpressionEngine, and I hope the problem I'm running into is a simple one to solve. I'll try to illustrate it as best as possible:

I have a radio button field (created within a channel form) called `favorite_food`. It has 4 options, namely `Pasta`, `Vegetables`, `Poultry`, and `Fruit`. The form displays great, and submitted values are saved in the channel entries.

The problem comes in when I'm trying to display the results on another template, and specifically adding a conditional statement that checks if the user selected `Fruit` or not is causing me to go a little crazy. This is what I've tried:

```
{exp:channel:form channel="foods" entry_id="{segment_4}"}

    <!-- displays "Fruit" successfully -->
    <div>{favorite_food}</div> (displays Fruit on the screen)

    <!-- this does not display anything at all? -->
    {if favorite_food == "Fruit"}
        <div>You chose fruit!</div>
    {/if}

    <!-- even with PHP, this works great... -->
    <?php echo "{favorite_food}"; ?>

    <!-- ...but this also doesn't display anything at all? -->
    <?php
        if ("{favorite_food}" == "Fruit")
            echo "<div>You chose fruit!</div>";
    ?>

{/exp:channel:form}

```

I should mention that the PHP parsing is set to "input" on this template too. I hope I'm missing something really obvious here...thanks in advance for any assistance!

# Answer
The radio field might need to be parsed like:

```
{if "{favorite_food}" == "Fruit"}
    <div>You chose fruit!</div>
{/if}

```

which makes it an advanced conditional (parsed later in parse order).

For php on input, the php is run before the ee tags get parsed. So when the template is parsed after the php was run your php statements would look like:

```
<!-- even with PHP, this works great... -->
{favorite_food}

<!-- ...but this also doesn't display anything at all? -->

```

So the first works. The second doesn't output anything (other than the comment) because {favorite\_food} is evaluated as a string only instead of as an ee variable, and so as a conditional it's false. If on the other hand you had php set on output, the first would still work and the second should as well.
> 2 votes

---
Tags: ee2, conditionals, channel-form
---


# Question
Title: Anyone know of a way to toggle entries or fake it?
As in there are 4 default entries - call them 1, 2, 3 & 4 they are in fact defined by custom fields - and people can post in one of them making it ‘active’ with some predefined info (via Channel Form).

If this info is not there they see the default entry 1. If Mr Jones posts something to channel field 1 then it shows in the results (1A if you will) and 1 is either closed, filtered or otherwise hidden.

Can’t be done by conditionals (afaik and have tested) and set up precludes actually editing 1. It must continue to exist and reappear if 1A gets deleted by the author.

Any suggestions? Am I missing something obvious?

# Answer
> 1 votes
If I'm understanding what you are saying, and I'm not certain I am, I don't believe it can be done the way you are setting it up.

My understanding is that you have four pieces of text, that you wish to switch between based on various conditions. My understanding of the conditions are that: (1) if content exists in a field, and (2) if content has changed / been updated in a field, and (3) all content exists within a single record.

The issue is that these aren't individual entries. Adding dates and timestamps for comparison ONLY really work on individual entries. You have one entry in which you are trying to compare with itself.

You might be able to do this within a Matrix Field or another field type, but otherwise, I'd state, you need multiple entries.

Within a single entry, you can do basic logic tests: is there content in field\_a; does field\_b contain; etc. But with multiple records / entries you can (with some fiddling) compare dates and add other complexities.

Now, if you will ONLY ever be displaying either / or entry\_1 versus one of entries 2 through 4, and you have a trigger for active, then you'd should ONLY need to check a field for if it contains content and if its marked active. That's doable. Assuming only one of the fields can be active at a time.

For example, if I have fields:

```
field_one : Good Morning Sir
field_two : You'll fine today's weather horrid
field_three: The sky is a brilliant blue sir, the day awaits you…
field_four: Stay home, Go back to bed. Hide I say, HIDE!!
field_active: one, two, three, four

```

Then you could basically set-up:

```
<h2>{field_one}</h2>
{if field_two !=""}<p>{field_two}</p>{/if}
{if field_four !=""}<p>{field_four}</p>{/if}

```

That's a simple comparison, which would add text to an always default message `{field_one}` But if you have some sort of activation key for one field over an other, then you'd need to also check for the activation field and the content.

---
Tags: channel-entries
---


# Question
Title: Manual member account activation for one group
Is there any way to have one member group require manual activation but have another group not require any activation?

# Answer
I could not find a way to do this using member preferences as they are global for all member groups, so I got a little creative.

I created a custom member field and called it "approved". I made it a select field and set the selections to "yes" & "no".

In the registration form for the member group that I want to manually approve, I created a hidden field that automatically sets the "approved" value for all submissions to "no".

When I receive the notification email that a new member has registered, I log into the CP, check out their member profile info that they submitted and if they are approved, I set the member field to "yes".

In any templates that this member group has access to, I placed a conditional that checks the value of "approved" whenever someone is logged in. If the value is "no", I redirect them to a page that says their account is pending. If "yes", they see the normal content.

So an unapproved member can still login, but they won't see any content until I flip the switch.
> 1 votes

# Answer
If you are not using a membership add-on, then the easiest method is to approve all incoming memberships into the default membership group, which requires not activation (I recommend at least manual activation). Similar to what @Mediapimp has done, you would track their membership option and just perform manual escalation on those with additional privileges.

But I believe some of the membership plug-ins do allow for set-ups that can handle different approval processes.
> 1 votes

---
Tags: members, activation
---


# Question
Title: If statement on segment eq url_title - strange behavior
My goal was to mark current/active article on the list. Code looks like:

```
<ul class="list-plain">
{exp:channel:entries channel="products" category="{segment_3_category_id}" orderby="title" sort="asc" status="open" paginate="bottom" dynamic="no"}
{if switchee_no_results}<div class=""><p>No entries yet.</p></div>{/if}
<li {if segment_4=="{url_title}"} class="current"{/if}><a href="{site_url}{segment_1}/{segment_2}/{segment_3}/{url_title}">{title}</a></li>
{/exp:channel:entries}
</ul>

```

but no class added to the proper list item.

Then I have decided to check if IF statement works and did simple test run

```
Seg: {segment_4} - URL: {url_title}
{if segment_4=="{url_title}"}FOUND!{/if}

```

no result found even there was proper Seg to Url match.

Then I have checked if there is no results

```
Seg: {segment_4} - URL: {url_title}
{if segment_4=="{url_title}"}FOUND!{if:else}NOT FOUND{/if}

```

and I have got proper matches.

Any clue what is going on?

Thanks

# Answer
You are comparing two variables where you compare one with quotes `""` and one without. So that probably gives a mismatch because it compares the two variables as different types.

So change this:

```
{if segment_4=="{url_title}"} class="current"{/if}

```

into:

```
{if "{segment_4}"=="{url_title}"} class="current"{/if}

```

probably also this would work (not tested).

```
{if {segment_4}=={url_title}} class="current"{/if}

```
> 1 votes

---
Tags: segments, url-title, ifelse
---


title: Low Seg2Cat and category image

text:
# Question
Title: Low Seg2Cat and category image
I'm trying to pull a category image using `segment_n_category_image` variable from Low Seg2Cat add-on.

Code looks like:

```
<img src="{segment_2_category_image}" alt="{segment_2_category_name}" class="img-responsive img-ctr">

```

and output:

```
<img class="img-responsive img-ctr" alt="XYZ Category Title" src="{filedir_1}xyz_image.jpg">

```

It looks fine except `{filerdir_1}` part which I have no clue where comes from.

Any idea?

Thanks

# Answer
Low Seg2Cat deliberately doesn't parse the file paths in the category image for performance reasons.

You can use the Parse File Paths add-on to get those parsed.
> 2 votes

---
Tags: categories, low-seg2cat
---


# Question
Title: GWcode Categories and class_current is not added
My code for GWcode Categories add-on looks like:

```
{exp:gwcode_categories group_id="4" cat_url_title="{segment_2}" last_only="yes" class="list-plain" class_current="current_category"}
<a href="{path="{segment_1}/{complete_path}"}">{cat_name}</a>
/exp:gwcode_categories}

```

Based on Nick suggestion I have used GWcode CatMenu add-on

```
{exp:gwcode_catmenu group_id="4" cat_url_title="{segment_2}" min_depth="2" class="list-plain"}
<a href="{path="{segment_1}/{complete_path}"}"
{if active} class="current"{/if}>
{cat_name}
</a>
{/exp:gwcode_catmenu}

```

but I have no clue why on current category class is not added.

Thanks

# Answer
> 0 votes
As I wasn't able to get GW CatMenu output categories in a way I want, I have decided to go back to GW Categories and use logic below to indicate active/current category:

```
{exp:gwcode_categories group_id="4" cat_url_title="{segment_2}" last_only="yes" class="list-plain"}
{if "{segment_3}"=="{cat_url_title}"}{cat_name}
{if:else}
<a href="{path="{segment_1}/{complete_path}"}">{cat_name}</a>
{/if}
{exp:gwcode_categories}

```

# Answer
> 1 votes
Looks like you need the GW CatMenu add-on; class\_current isn't listed in the docs for GW Categories.

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


title: Freemember parsing error

text:
# Question
Title: Freemember parsing error
Currently using EE 2.7.3 and Freemember 2.3.1. I made sure to create an encryption key first for my config file. I've followed the documentation so far, it's thorough and keeps things minimal. Unfortunately, immediately after calling Freemember I'm being given this error:

> Parse error: syntax error, unexpected ':' in /home/.../system/expressionengine/third\_party/freemember/mod.freemember.php on line 397

This is line 397 of mod.freemember.php:

```
$return_url = ee()->input->get_post('return_url') ?: $this->history(0);

```

And here is my login markup:

```
{if logged_out}
    <a href="#" class="login">Login</a>
    <div id="login-modal">
            {exp:freemember:login return="PREVIOUS_URL"}
                <input type="text" name="username" value="" maxlength="32" placeholder="Username">
                <input type="password" name="password" value="" maxlength="32" placeholder="Password" autocomplete="false">
                <input type="submit" name="submit" value="Submit">
                {if auto_login}
                    <p><input type="checkbox" name="auto_login" value="1" {auto_login_checked} > Auto-login on future visits</p>
                {/if}
                <a href="{path='member/forgot_password'}">Forgot your password?</a>
            {/exp:freemember:login}
    </div>
{/if}
{if logged_in}
    <a class="login" href="{exp:freemember:logout_url}">Logout</a>
{/if}

```

div#login-modal is being toggled with JQuery (1.10.4)

What is causing this? My guess is I've overlooked something but I'm out of ideas.

**EDIT:** Trying to isolate the issue, any hint of Freemember tags on the page will return an error.

# Answer
> 2 votes
That syntax you pointed out on line 397 is PHP 5.3 only. You are likely on an older version of PHP.

---
Tags: freemember, expresso
---


title: structure:breadcrumb Not working

text:
# Question
Title: structure:breadcrumb Not working
Im trying to add breadcrumbs to my application, Although I am not getting any results. Below you can see my code and a image of the result i am getting :(

```
<div>
   <ul>
      <li class="home">
    <a href="/">
      <span class="pictos home-icon" aria-hidden="true" data-icon="H"></span> Home
        </a>
    <span class="pictos smallArrow" aria-hidden="true" data-icon="P"></span>
      </li>
     {exp:structure:breadcrumb here_as_title="yes" wrap_each="li" inc_separator="yes" separator=" <span class='smallArrow' aria-hidden='true' data-icon='P'></span>" inc_home="no" add_last_class="yes" class="active"}
     {/exp:structure:breadcrumb}
     {if freebie_1 == "search"}<li class="last">Search Results</li>{/if}
   </ul>
</div>

```

# Answer
> 0 votes
All code works. Issue is resolved. The url wasnt being recognised as I was forcing the path

---
Tags: structure, url-title, links, freebie
---


# Question
Title: Template Access Restriction Redirection is not working
I have a template where I only want "Members" to be able to access. If a user that is not part of the "Members" group tries to access that page, I want it to redirect to a `sign-up/index`

Here is what I did in the templates

However, my problem is that when I tried accessing this certain template as "Guest", I only see a blank page. I am not redirected to `sign-in/index`.

Am I missing something here?

# Answer
> 2 votes
When you use template access restrictions, EE doesn't do a browser redirect to your no-access template (`sign-in/index`)--it just displays that template in-place.

For example, if you browse to `/members-only` in your browser and that's a template with the access restriction, EE will display the `sign-in/index` template at the `/members-only` URL.

So, first of all, make sure that you see what you want when you browse to `/sign-in` in your browser -- make sure that's not blank. Also be sure that you don't have any conflicting template access restrictions on `sign-in/index`!

Then, if that's OK, check that your code in `sign-in/index` can adapt to the different URLs where it will be displayed.

Does any of that help?

---
Tags: templates, redirects
---


title: Assets2: Date Field Expectations

text:
# Question
Title: Assets2: Date Field Expectations
It seems the Date field of an asset is only modified when a file is initially uploaded, thereby representing an upload date or pseudo-created date (date it was created in Assets and not necessarily when the file was created). Is this correct?

Replacing an existing file with a newly uploaded one does not appear to update the date. Is that a bug or is that intentional?

Are there any other options for modifying the date other than editing it directly after an asset is replaced or writing a hook to do it automatically?

We're using ExpressionEngine 2.5.3 with Assets 2.2.1.

# Answer
> 1 votes
The "Date" field is for the user to modify. It does not represent the time the file was uploaded - use "date\_modified" for that. On initial upload, the Date is set to the same value as "date modified", so that it has at least some value, but, other than that, it's more of a descriptive field, so, again, use "date\_modified".

---
Tags: assets
---


title: Get category_id of entry before loop?

text:
# Question
Title: Get category_id of entry before loop?
I want to list out all posts based on the category\_id of the current entry. But how can I get the category\_id before the loop?

Basically, what I could do is this:

```
{exp:channel:entries channel"mychannel" category_id="2"}
 {title}
{/exp:channel:entries}

```

The problem is, I don't know the `category_id` at that point. As of now, I'm doing a basic channel entries loop, and run an embedded template that I pass the `category_id` to. And that template lists out all the posts with that category set.

So using gwcode\_categories, I can get the category\_id and pass that along with the embedded template, like this:

```
{exp:channel:entries channel="mychannel"}
    {embed="include/get_posts"
    category="{exp:gwcode_categories entry_id="{entry_id}" last_only="yes" style="linear"}{cat_id}{/exp:gwcode_categories}"}
{/exp:channel:entries}

```

My categories are nested, so that's why I'm using last\_only btw.

But, is there a plugin of some sort that I can use to get the category\_id of the current entry before the loop? Like some sort of global dynamic variable?

# Answer
> 1 votes
I just found the solution by using this free addon called Low Seg2Cat which just lets me get the category\_id of the current uri and pass that along with the initial channel:entries loop. Like this:

```
{exp:channel:entries channel="mychannel" category="{last_segment_category_id}" dynamic="no"}

```

I spent hours making that embedded template thing to work. And now I don't even need it. Allthough I did learn that it's possible to accomplish amazing stuff by embedding templates, so I got that going for me, which is nice.

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


# Question
Title: What is the best way to determine geolocation in EE?
I need to be able to determine a visitors location (city, state) when they get to the site and then show them content based on that.

For example, if I go to the site. I would see all the information about the store closest to me, with the ability to change the default store to a different one.

I saw this plugin, but it looks like it's reviews of late haven't been very good.

thanks.

# Answer
ExpressionEngine doesn't really need to come into this. Try using HTML5's geolocation API. The success of this approach will depend on the visitor's browser. For instance, Chrome will be using Google's location data which is, as you'd imagine, pretty good and can fall back to use things such as your WAN name to locate you.

http://html5doctor.com/finding-your-position-with-geolocation/

Otherwise you'll need a database of IP ranges vs their location. This is, at best, going to be no more reliable than the HTML5 Geolocation API as it will only show the location of where my 'node' pops up and joins my ISP's backbone.

For instance using an IP to location service (IP2Location) my current location is shown as being about 100 miles from where I actually am - in the UK that's a big deal. A similar demo using HTML5 Geolocation shows the actual road I am on.

Here are some sample IP location bits http://www.iplocation.net/

For a store locator you wouldn't go far wrong using Objective HTML's Google Maps for ExpressionEngine add-on. It's ideal for that sort of thing.

So, to summarise, I would use a combination of HTML5 Geolocation API and feed the resulting lat/lon into GM4EE.
> 2 votes

---
Tags: geofinder, ip
---


# Question
Title: Very slow performance on production, not on local dev, doesn't seem to be the database
I'm running an ExpressionEngine site using CartThrob for a shopping cart. Some of the pages are loading extremely slowly on the production server (7, 10, 15 seconds of Controller Execution Time as reported by CodeIgniter profiler), even when there is no traffic at all to the site. The same pages running on a dev server with the exact same codebase and exact same database are taking less than one second to load by the same measure. The problem seems worst on pages with lots of database queries, though that could be a red herring.

At first, I thought the issue was with the database or the connection to the database, but the CodeIgniter profiler indicates that the sum of all database queries on production for the slowest page (180 queries) is only about 0.6 seconds. Looking at the CodeIgniter database driver source, that number appears to be measured in PHP, so it seems like the problem is not in the database or the connection to the database.

In addition, looking at the Template Debugging log on production, there doesn't seem to be a single step that takes an inordinately long time. Rather each step seems to take just generally longer than on the dev server.

My local development machine is a Macbook running MAMP, and the Server is a 4GB Linode VPS running Ubuntu. I have separately benchmarked PHP/MySQL performance on both, and the Macbook was slightly faster at InnoDB selects, inserts, and updates, but not considerably so. I also benchmarked disk read/write on both machines, which came back almost identical. Just to check, I also migrated to another Linode server but the results are the same.

What else should I look into as to what might be causing this problem?

# Answer
> 1 votes
I'd guess it's not EE.

Check the Network tab in FireBug or whatever browser dev tool you use.

Check apache, mysql and php error logs too.

Another good test is to reduce the code... Remove all and put pieces back in and test until you isolate the problem code.

# Answer
> 1 votes
Did you try the following:

* enable / disable Gzip (under Admin -\> System Administration -\> Output and Debugging Preferences)
* Are you using AutoMin? If so try to enable / disable "Enable Caching"
* Does your server has hardware caching, if so. disable software Caching...
* Some servers only allow caching or other settings be set trough .htaccess

# Answer
> 0 votes
Although I use Linode as a host and have generally been happy, my experience is that php runs really slow on their boxes. Way slower than in your local Macbook Pro environment.

I've experienced over 50% CPU 'steal' as well which is a bit annoying. My advice would be to consider a dedicated server if you can't optimise your site any more.

One more piece of advice - get New Relic on there and you'll have a much clearer idea of where the problem is. From what I've found, it's not the database that is the bottleneck, but php.

# Answer
> 0 votes
I encountered the same problems after to a Wamp upgrade (2.4). An other strange problem occurred too: the .htaccess files to remove index.php, no more was recognized by the local Apache server.

So i've found this solution putting this code inside httpd-vhosts:

```
<VirtualHost *:80>
    ServerName localhost
    DocumentRoot "D:/Dropbox/www/mysite"
    ErrorLog "logs/localhost-error.log"
    CustomLog "logs/localhost.log" common

    <Directory "D:/Dropbox/www/mysite">
        allow from all
        order allow,deny
        AllowOverride All
    </Directory>
</VirtualHost>

```

And now the .htaccess is recognized and working fine, but the page loading was very very slow (8-10 seconds).

I tried many .htaccess parameters, include the official one in the EE doc. With this one, the performance is very good (0.5 seconds):

```
# Dont list files in index pages
IndexIgnore *

<IfModule mod_rewrite.c>

  # Enable Rewrite Engine
  # ------------------------------
  RewriteEngine On
  RewriteBase /

  # Redirect index.php Requests
  # ------------------------------
  # RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
     #RewriteCond %{THE_REQUEST} !/system/.*
  #RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

RewriteCond %{REQUEST_METHOD} !=POST [NC]
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/system/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

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

RewriteCond %{QUERY_STRING} ^(ACT=.*)$ [NC,OR]
 RewriteCond %{QUERY_STRING} ^(URL=.*)$ [NC,OR]
 RewriteCond %{QUERY_STRING} ^(CSS=.*)$ [NC]
 RewriteRule ^(.*)$ /index.php?&%{QUERY_STRING} [L]
  </IfModule>

```

---
Tags: cartthrob, php, mysql, performance
---


# Question
Title: Trying to use low_replace inside an EE Multi Select field
I have a channel for scholarships with a a Multi Select field with a list of schools. Each scholarship is available to certain schools, so I want to create a div with a class for each school, so I can use jQuery to hide/show scholarships available for each school using select. The options are hard coded right now.

```
<select>
<option value="Example1-High-School">Example1 High School</option>
<option value="Example2-High-School">Example2 High School</option>
</select>

```

What I am getting

```
<div class="Example1 High School Example2 High School">
 More information about the scholarship
</div>

```

What I want

```
<div class="Example1-High-School Example2-High-School">
 More information about the scholarship
</div>

```

Here is my template code:

```
            {exp:channel:entries channel="scholarships" dynamic="off" sort="asc" orderby="title"}
            <div class="{schools}{exp:low_replace find='SPACE' replace='-'}{item}{/exp:low_replace} {/schools}">
                <h2>{title}</h2>
                <h3>Schools:</h3>
                <ul>{schools}
                    <li>{item}</li>
{/schools}      </ul>
                {description}
            </div>
            {/exp:channel:entries}

```

# Answer
> 0 votes
How about something like this:

```
class="{exp:low_replace find="SPACE|," replace="-|SPACE" multiple="yes"}{schools backspace="1"}{item},{/schools}{/exp:low_replace}"

```

---
Tags: parsing, low
---


title: Exporting Channel Entries on EEv1

text:
# Question
Title: Exporting Channel Entries on EEv1
I'm currently trying to export channel entry data from a version 1 ExpressionEngine site, v1.6.9 to be exact.

Can anybody tell me what the best way of doing this would be, Looking around a lot of modules on devot-ee etc seem to be ExpressionEngine v2 specific.

Thank You

Adam

# Answer
> 2 votes
I have ended up going with the following plugin found on devot-ee

Weblog Entries Exporter

Seemed to do the trick. Specifically for ExpressionEnginev1 it gives the option of exporting as a .CSV or .XML. Just what I needed

---
Tags: channel-entries, import, export
---


# Question
Title: categories: parent and children - to display using twitter bootstrap
I am using twitter bootstrap and was wondering if it is possible using EE's native category channel tags, to append a class="dropdown-toggle" to any parent category that contains children, and apply class="dropdown-menu" to the children's unordered list.

```
<ul class="nav nav-stacked products_nav">
    <li><a href="products.php">All products</a></li>
    <li class="dropdown">
        <a class="dropdown-toggle" data-toggle="dropdown" href="#">Corn Tortillas</a>

        <ul class="dropdown-menu">
            <li><a href="products_corn_tortilla1.php">Tortilla 1</a></li>
            <li><a href="#corn_tortilla2">Tortilla 2</a></li>
            <li><a href="#corn_tortilla3">Tortilla 3</a></li>
        </ul>
    </li>
    <li><a href="products_better-for-you-tortillas.php">Better-For-You Tortillas</a></li>

    <li><a data-toggle="tab" href="#">Artisan Style Tortillas</a></li>
    <li><a href="products_wraps.php">Wraps</a></li>

    <li><a data-toggle="tab" href="#">Tortilla Chips</a></li>
    <li><a data-toggle="tab" href="#">Tostadas</a></li>
    <li><a data-toggle="tab" href="#">Taco Shells & Kits</a></li>
    <li><a data-toggle="tab" href="#">Chicharrones</a></li>
    <li><a data-toggle="tab" href="#">Salsa, Dips, Toppings</a></li>
    <li><a data-toggle="tab" href="#">All Others</a></li>
</ul>

```

I took a look at this add-on, but from looking thru the examples, it doesn't seem to do what I need: http://gwcode.com/add-ons/gwcode-categories

# Answer
> 2 votes
Brad, i've got something similar working on a local site. Was able to achieve what you're trying to do using a similiar addon by the same developer GWcode CatMenu

You can use my code as a starting point..

```
<nav id="menu">
{exp:gwcode_catmenu cat_url_title="{segment_1}" }
{if no_results}<!-- if no valid category was provided in the URL segment show only root categories as our menu-->
{exp:channel:categories
channel="demo"
parent_only="yes"
disable="member_data|pagination"
}
<a href="{path='{category_url_title}'}" title="{category_name}"><span>{category_name} {if category_name !=""}<i class="fa fa-caret-down"></i>{/if}</span></a>
{/exp:channel:categories}
{/if}
<a href="{path='{complete_path}'}"{if active} class="current"{/if} title="{cat_name}">{if gw:open} class="current"{/if} {cat_name} {if has_children} <i class="fa fa-caret-down"></i>{/if}</a>
{/exp:gwcode_catmenu}
</nav>

```

---
Tags: channel, categories
---


title: Single Entry Linking

text:
# Question
Title: Single Entry Linking
Ok, my site is made up of Cities and Properties within each city. The usual flow is on the homepage there is a list of Cities, you click a city and it goes through to a City view which will then have a list of Properties, to which you can click through to a Property view.

Well some of my Cities only have 1 property, so I would like the link from City to go directly to the Property view, not the city view.

```
{exp:channel:entries channel="city" dynamic="no" orderby="city_sort_order" sort="asc"}
                <li class="location-box colour-{city_colour}">
                    <a href="{url_title}">
                        <div class="location-box colour-{city_colour}">
                            <figure>
                                <h1>{title}</h1>
                                <img src="{city_main_image}" alt="">
                            </figure>
                        </div>
                    </a>
                </li>
                {/exp:channel:entries}

```

Any advice?

# Answer
You can count how many `playa:parents` the city has.

```
{exp:channel:entries channel="city" dynamic="no" orderby="city_sort_order" sort="asc"}
<li class="location-box colour-{city_colour}">
    <a
    {if '{exp:playa:total_parents field="property_city"}' == 1}
        {exp:playa:parents field="property_city" var_prefix="property"}href="/{url_title}/{property:url_title}"{/exp:playa:parents}
    {if:else}
        href="/{url_title}"
    {/if}
    >
        <div class="location-box colour-{city_colour}">
            <figure>
                <h1>{title}</h1>
                <img src="{city_main_image}" alt="">
            </figure>
        </div>
    </a>
</li>
{/exp:channel:entries}

```

Please, test this code.
> 1 votes

# Answer
count the number of properties. if the number of properties ==1 redirect to the property. How to code it exactly is upto the way you've set up the properties and cities channels
> 1 votes

---
Tags: channel-entries
---


# Question
Title: Expresso Store PHP Error when login into the CP
I'm using Expresso Store 2 with the latest download of 2.2.0 and using EE version of 2.7.2.

When log into the CP and then try and view the site I get a PHP Error page with the following lines:

```
A PHP Error was encountered
Severity: Warning
Message: include(/Users/grahamcopekoga/Documents/sites/vintageceramics/fukuoka/expressionengine/modules/member/mod.member_register.php): failed to open stream: No such file or directory
Filename: composer/ClassLoader.php
Line Number: 269

```

AND THIS:

```
A PHP Error was encountered
Severity: Warning
Message: include(): Failed opening '/Users/grahamcopekoga/Documents/sites/vintageceramics/fukuoka/expressionengine/modules/member/mod.member_register.php' for inclusion (include_path='.:/Applications/MAMP/bin/php/php5.4.10/lib/php')
Filename: composer/ClassLoader.php
Line Number: 269

```

AND THIS:

```
Fatal error: Class 'Member_register' not found in /Users/grahamcopekoga/Documents/sites/vintageceramics/fukuoka/expressionengine/third_party/store/src/Store/Service/MemberService.php on line 23

```

I'm on a test server running MAMP. When I log out of the CP I can view the site, so its a login in issue with Store.

Does anyone know why?

Many thanks in advance.

# Answer
> 1 votes
Per the comments - OP was running ExpressionEngine Core edition.

Expresso Store requires the full version of ExpressionEngine, as it relies on internal member management features only available in the full version.

---
Tags: expresso-store
---


# Question
Title: Exp-resso store - do something on status change
I was just wondering if there is a way to create an extension that allows me to do something if an order's status is changed. There doesn't currently seem to be a hook that allows this to happen, but I'm sure there was in Store 1...

Thanks, Dan

# Answer
> 3 votes
There isn't currently an extension hook which is called when an order status is changed (there wasn't in Store 1 either).

However, it's a pretty obvious requirement so I'll make sure it is included in the next version (coming shortly after EE 2.8).

Update: `store_order_update_status_start` and `store_order_update_status_end` hooks are included in Store 2.3.0:

https://exp-resso.com/docs/extension\_hooks.html#order\_status\_hooks

---
Tags: expresso-store
---


# Question
Title: Primary Category {selected} in Channel Form
Primary Category, when used with Channel Forms as per these instructions: http://www.solspace.com/docs/primary\_category/using\_with\_channel\_form/, does not function as expected.

The problem is that the `{category}{/category}` tags make all selected categories `{selected}`, even if they are not the single selected Primary Category. So the select box for the Primary Category selection has multiple selected options, which of course is not allowed in HTML and so it often highlights the incorrect value as the selected one.

Is there another way, other than using the `{selected}` variable, to select only the single Primary Category in this category select box? Otherwise it can't function reliably in Channel Forms unless each entry is assigned to only a single category.

# Answer
The solution to this, graciously supplied by Solspace, is to use an `exp:primary_category` tag inside each select option to check if it's the selected primary category:

```
<select name="primary_category">
        {categories}
            <option value="{category_id}" {exp:primary_category entry_id="{entry_id}"}{if '{category_id}' == '{primary_category_id}'}selected="selected"{/if}{/exp:primary_category}>
                {category_name}
            </option>
        {/categories}
</select>

```

Hopefully they'll update their docs so this issue doesn't come up again.
> 1 votes

---
Tags: solspace, channel-form, primary-category
---


# Question
Title: WYGWAM Hangs (504 Gateway Time-out) when adding apostrophe
I have a Channel Form on the frontend that contains a WYGWAM field. The field works fine unless I add an apostrophe.

If I do, after hitting submit, it hangs and I get a "504 Gateway Time-out" error.

I can add other symbols like quotes, dashes, question marks, etc. without issue. Clicking the WYGWAM source button, I see it is displaying correctly `'`. I am using the basic `{field:event_description}` code, nothing special.

Other fields in the form (not WYGWAM) work fine and I can add apostrophes to those fields without errors. The issue is also only on the front end and not in the control panel where I can add apostrophes there.

I am using EE 2.7.3 and WYGWAM 3.2.2

# Answer
> 2 votes
The problem lies in updating expression engine to the latest version. 2.7.3 here’s the code i changed in /system/codeigniter/system/core/Security.php

Current function in 2.7.3

```
/*
public function entity_decode($str, $charset = NULL)
{
    if (strpos($str, '&') === FALSE)
    {
            return $str;
    }

    if (empty($charset))
    {
            $charset = config_item('charset');
    }

    do
    {
        $matches = $matches1 = 0;

        $str = preg_replace('~(&#x0*[0-9a-f]{2,5});?~iS', '$1;', $str, -1, $matches);
        $str = preg_replace('~(&#\d{2,4});?~S', '$1;', $str, -1, $matches1);
        $str = html_entity_decode($str, ENT_COMPAT, $charset);
    }
    while ($matches OR $matches1);

    return $str;
}
*/

```

/\*Old function earlier function EE -- This does the trick! -- \*/

```
public function entity_decode($str, $charset='UTF-8')
{
    if (stristr($str, '&') === FALSE) return $str;

    // The reason we are not using html_entity_decode() by itself is because
    // while it is not technically correct to leave out the semicolon
    // at the end of an entity most browsers will still interpret the entity
    // correctly.  html_entity_decode() does not convert entities without
    // semicolons, so we are left with our own little solution here. Bummer.

    if (function_exists('html_entity_decode') &&
        (strtolower($charset) != 'utf-8'))
    {
        $str = html_entity_decode($str, ENT_COMPAT, $charset);
        $str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\\1"))', $str);
        return preg_replace('~&#([0-9]{2,4})~e', 'chr(\\1)', $str);
    }

    // Numeric Entities
    $str = preg_replace('~&#x(0*[0-9a-f]{2,5});{0,1}~ei', 'chr(hexdec("\\1"))', $str);
    $str = preg_replace('~&#([0-9]{2,4});{0,1}~e', 'chr(\\1)', $str);

    // Literal Entities - Slightly slow so we do another check
    if (stristr($str, '&') === FALSE)
    {
        $str = strtr($str, array_flip(get_html_translation_table(HTML_ENTITIES)));
    }

    return $str;
}

```

---
Tags: wygwam, channel-form
---


# Question
Title: Link to categorised listing entries using Structure
I am designing a site just now that has a 'reviews' section and in that section each review can be categorised, e.g. 'Album Review', 'Live Review', 'Press Review' etc.

**The url structure I have is:**
www.mysite.com/reviews/album/actual-album-review
www.mysite.com/reviews/live/actual-live-review

I can get my categories to display in the sidebar and when each one is clicked it filters the reviews to the correct categories but the links to those reviews, when clicked, don't show the actual reviews, just the list of entries again. The reviews are listings of the reviews page.

Can anyone shed any light on how to get this working? I've been scratching my head for a few hours now!

I am using the latest version of EE, Structure and Freebie - I also have Zoo Triggers but I am having more joy with Freebie so the template code relates to this.

My template code:

```
<div class="large-2 columns">
     <h5 class="show-for-medium-only">Sub Navigation</h5>
     <a href="{path='reviews'}">All Reviews</a>
     {exp:channel:categories class="subNav show-for-medium-up"}
     <a href="{structure:page:url}{category_url_title}" {if freebie_2 == category_url_title}class="currentSubNav"{/if}>{category_name}</a>
     {/exp:channel:categories}
</div>

<div class="large-7 columns">
     <div class="leftCol">
     {embed="includes/breadcrumb"}
     {exp:channel:entries channel="reviews_page" limit="1" disable="category_fields|member_data|pagination"}
     <h2>{title}</h2>
     {reviews_page_content}
     {/exp:channel:entries}

     <!-- If -->
     {if freebie_1 == "reviews" && freebie_2 == ""}
     {exp:channel:entries channel="single_review" limit="10" disable="category_fields|member_data" dynamic="no"}
     <div class="review clearfix">
          <div class="row">
               <div class="medium-8 large-8 columns">
                    <div class="reviewDetails">
                         <p class="main">{title}</p>
                         <p class="sub">{review_subject}</p>
                    </div>
               </div>
               <div class="medium-4 large-4 columns">
                    <a href="{path='reviews'}/{freebie_2}/{url_title}" class="siteButton">Read Review<i class="fa fa-long-arrow-right"></i></a>
               </div>
           </div>
     </div>
     {/exp:channel:entries}
     {/if}
     <!-- If -->

     <!-- If -->
     {if freebie_1 == "reviews" && freebie_2 != ""}
     {exp:channel:entries channel="single_review" dynamic="no" limit="5" category="{exp:freebie:category_id segment='2'}" parse="inward"}
     <div class="review clearfix">
          <div class="row">
               <div class="medium-8 large-8 columns">
                    <div class="reviewDetails">
                         <p class="main">{title}</p>
                         <p class="sub">{review_subject}</p>
                    </div>
               </div>
               <div class="medium-4 large-4 columns">
                    <a href="{path='reviews'}/{freebie_2}/{url_title}" class="siteButton">Read Review<i class="fa fa-long-arrow-right"></i></a>
               </div>
          </div>
     </div>
     {/exp:channel:entries}
     {/if}
     <!-- If -->
</div>

```

# Answer
> 0 votes
Double check your listing channel setting and that they're using the right template. If you update that, you'll need to resave the listing entries to use the new template. Make sure no template groups match your URL segments as it can confuse EE. Also, you should use {page\_url} inside your channel tags, the structure variables are for the current page and not to be used inside like that.

---
Tags: categories, structure, freebie
---


# Question
Title: Can't get multi day events to display properly over multiple months
I would like to display Solspace calendar dates in a list so the dates display as follows:

* One day event - May 31
* Multi day event - May 30-31
* Multi day event with range in 2 months - May 31-Jun 1

I've been unable to get both multi day options to work using the following conditional. For multi day events over 2 months, it still displays May 31-1.

My code is:

```
{if event_multi_day AND {event_start_date format="%M"} == {event_end_date format="%M"}}
{event_start_date format="%M %j"}-{event_end_date format="%j"}
{if:elseif {event_start_date format="%M"} != {event_end_date format="%M"}}
{event_start_date format="%M %j"}-{event_end_date format="%M %j"}
{if:else}
{event_start_date format="%M %j"}
{/if}

```

To narrow down the issue further, if I have an event that occurs May 31 to June 1, and want it to display May 31-Jun 1, I get no result if I use the following:

```
{if {event_start_date format="%M"} != {event_end_date format="%M"}}
{event_start_date format="%M %j"}-{event_end_date format="%M %j"}{/if}

```

# Answer
> 0 votes
I figured out the answer to my own question. I was using the wrong placement and combination of " and '. What works for me is as follows:

```
{if event_multi_day AND "{event_start_date format='%M'}" == "{event_end_date format='%M'}"}
{event_start_date format="%M %j"}-{event_end_date format="%j"}
{if:elseif "{event_start_date format='%M'}" != "{event_end_date format='%M'}"}
{event_start_date format="%M %j"}-{event_end_date format="%M %j"}
{if:else}
{event_start_date format="%M %j"}
{/if}

```

Thanks to those who responded.

---
Tags: solspace-calendar
---


# Question
Title: Parse error: syntax error, unexpected '='?
```
Parse error: syntax error, unexpected '=' in /var/somepath.../../ee/system/expressionengine/libraries/Functions.php(679) : eval()'d code on line 3

```

I get this error if I embed a a template.

I tried exit(0) at all the partitions below ,but it still gives me the same error.I tried exiting at the first line too,but I face the same problem.The code works only when the embed is removed.My php stage is output.

{embed="includes/constants"}

---

```
ini_set('error_reporting', E_ALL |  E_STRICT);
error_reporting(E_ALL | E_STRICT);
ini_set('log_errors',TRUE);
ini_set('display_errors',FALSE);
ini_set('error_reporting', E_ALL & ~E_NOTICE & ~E_WARNING);
error_reporting(E_ALL & ~E_NOTICE & ~E_WARNING);
//True modified date - sent to header
$last_modified = gmdate('D, d M Y H:i:s T', getlastmod());
$SERVER_ROOT = '/var/www/projects/tensports/htdocs/tsport/';

```

---

```
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: $last_modified GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

date_default_timezone_set('Asia/Kolkata');
define("BASE_URL", "http://www.tensports.com/");

```

---

```
//include_once $SERVER_ROOT.'/include/cookie.php';
include_once $SERVER_ROOT.'/classes/DB.class.php';

//for all the constant variables
$STATIC_URL = 'http://www.tensports.com/';
$MOB_STATIC_URL = 'http://www.tensports.com/mobile';
$PRE_LAUNCH_URL = '';
$COOKIE_DOMAIN_PATH = '.tensports.com';
$SOURCE_COOKIE_NAME = 'tensports_source';
$APPLICATION_ROOT = '/var/www/projects/tensports/htdocs/tsport';
$from_status = array("Sent","Not Accepted","From Accepted","From Rejected");
$to_status = array("Not Responded","To Accepted","To Rejected");

//$DEFAULT_PIC = $CDN_URL."images/profile-pic-def.jpg";
//session_start();

include_once $SERVER_ROOT.'/include/social_plugins.php';
//------------------------------------------------------------------------------------------------
include_once $_SERVER['DOCUMENT_ROOT'].'/include/constants.php';
//include_once $SERVER_ROOT.'/config/country-redirect.php';
include_once $SERVER_ROOT.'/classes/Main.class.php';

```

---

```
ob_start();
define("PAGE_LIMIT", 10);
$host = "10.0.202.144";
$user = "tensports"; //"stensportsadmin";
$pwd  = "fd48a6aac21cfe4555f44e0e68daf805"; //"r7QMB$#ZnCV&mG";
$db   = "tensports"; //"staging_tensports_db";
$country = "";
$mysql = new DB();//DB Class

try{

    $mysql->Connect($host, $user, $pwd, $db);
}catch( Exception $e){
    print($e);
}

error_log($mysql->Connect($host, $user, $pwd, $db));
$main = new Main($mysql);//Main class
$currDate       =   date('Y-m-d');
$currDateTime   =   date('Y-m-d H:i:s');
$currTime       =   date('g:i A');

```

# Answer
This one's not worth tracking down the root of to be honest -- this is most definitely not what embeds are for, and I'm not surprised you're hitting an error when trying to load this giant hunk of PHP as an embed.

My advice is to work *with* ExpressionEngine, not *against* it by cramming dozens of lines of PHP into a template. I'd look at moving your custom code into extensions and plugins/modules as required. Start by reviewing EE's developer documentation.
> 5 votes

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


title: Error when calling DevDemon Forms field

text:
# Question
Title: Error when calling DevDemon Forms field
I am developing a directory and have created a channel that holds information such as name and logo etc for a business. In this channel I have used channel forms, although I have no idea how to actually integrate it into my html. Below I have shown some screen shots that show my code and the results im getting. Please help

# Answer
You're using an outdated version of the DevDemon Forms add-on which doesn't support the version of EE you're running - upgrade to the most current version (3.4.6).

(The error is that the `ip_address` column was removed from the `exp_security_hashes` table a few versions back.)
> 1 votes

---
Tags: devdemon-forms
---


title: CE Image query strings params?

text:
# Question
Title: CE Image query strings params?
Is possible to use CE Image in the same way of timthumb? for example, this image:

```
timthumb.php?src=//mysite.s3.amazonaws.com/WebStatic/Images/Static/109/slide-1.jpg&w=1280

```

can be used with CE Image? something similar to:

```
{exp:ce_img:single src="//mysite.s3.amazonaws.com/WebStatic/Images/Static/109/slide-1.jpg"}&w=1280

```

thanks

# Answer
Just use the `width` parameter.

```
{exp:ce_img:single src="//mysite.s3.amazonaws.com/WebStatic/Images/Static/109/slide-1.jpg" width="1280"}

```

See all the available parameters for CE Image.
> 2 votes

---
Tags: ce-image
---


# Question
Title: Expresso Store: Routinely import inventory from third party source
I have a question that pertains to Expresso.

We have a client that wants e-commerce and a new website. We'e already sold them on the importance of a CMS for the job they want done and naturally we also recommended Expresso. But it gets a bit complicated from this point..

They have an AS400 Mainframe that they use to keep all of their pertinent data, like inventory. They have the know how and expertise to expose this data to us, but the big question is "how do we get it into Expresso?"

There's the data import plugin here: http://devot-ee.com/add-ons/data-import

But I'm not sure it can specifically meet our needs. Does anyone have a recommendation for how to achieve this?

tdlr; takeaway:

Inventory data from AS400 mainframe must be injected into Expresso. Client have resources on hand to expose data in whatever way we want (xml file, sql, whatever). How do we get it into Expresso?

# Answer
> 2 votes
I've been using DataGrab for the same thing. As of the current version, only Store 1 is supported, however, it's fairly easy to modify the Store datatype to support Store 2.

Once you set up the import in DataGrab, it provides you a URL which you can hit with cron to regularly import updates.

---
Tags: ecommerce, expresso, import
---


title: If statement for grid field type

text:
# Question
Title: If statement for grid field type
I have a grid field type that is working correctly without any issuse. What i am trying to do is create an if statment basied on the search criteria of the grid search.

What I have:

```
<div class="twelve columns">
    {courses search:course_type="Foundation" search:degree_type="Masters" search:applies_to = "<?php echo $degreeName ?>"}
    <div class="more-button white course-list-title">
        {courses:course_number} {courses:course_title}
    </div>
    <div class="course-list-content">
        <p>{courses:course_content} </p>
    </div>
    {/courses}
</div>

```

The code above works fine. What I want to do is create an if statment basied on the number of rows, that only returns one thing regardless if there are rows or not.

Something like this:

```
{if courses:total_rows > 0 search:course_type="Foundation" search:degree_type="Masters" search:applies_to = "<?php echo $degreeName ?>" }
    Some Code
{if:else}
    Some Other Code
{/if}

```

# Answer
> 1 votes
You'll need to separate the conditional from the variable pair, as they parse as two completely different entities in EE. There's no way to combine them into one tag.

However, this is fairly simple to do. Try something like this.

```
{if courses:total_rows > 0 }
    {courses search:course_type="Foundation" search:degree_type="Masters" search:applies_to = "<?php echo $degreeName ?>" }
        Some Code
    {/courses}
{if:else}
    Some Other Code
{/if}

```

---
Tags: grid
---


# Question
Title: Expresso Store Download expiry notice conditional?
I'm using Expresso Store v1 and my client recently added some downloadable products. We've set the download expiry on these products to 48 hours and we've now made changes to the order confirmation page to encourage customers to download their purchases right away.

However, is there a simple way to produce a 'download expired' notice once the download has expired? Currently the download button just vanishes which has led to a few confused customers!

I suppose I was hoping their might be a conditional '{if expired}' or a parameter that could be used to set a message.

# Answer
> 2 votes
Store doesn't have a built in way to display a message when the download link expires.

I would recommend using something like the DT Plugin to display an expired message. I haven't used it in a while, but I assume you could do something like this:

```
{if {order_date} < {exp:dt ee_format="false" format="%s" day=“-2”}}
    This link has expired
{/if}

```

---
Tags: expresso-store
---


title: Standard pagination not working

text:
# Question
Title: Standard pagination not working
I'm having issues getting pagination to work, using the same settings I usually do but paging doesn't change the content / listed entries.

I've stripped down my template for testing and currently have this:

```
    {exp:channel:entries
        channel="blog_entries"
        limit="12"
        orderby="date"
        sort="desc"
        paginate="top"
        paginate_base="blog/"
        dynamic="no"
    }

        <article>
            <a href="{page_url}" title="{title}">{title}</a>
            <span class="post-date">{entry_date format="%m.%d.%y"}</span>
        </article>

        {paginate}<p class="pagination load-more">{pagination_links}</p>{/paginate}

    {/exp:channel:entries}

```

I tried disabling extensions to test if any were interfering but then I get a 404 on pagination URLs.

Also, this part is really odd, but one minute it's displaying posts by date in descending order, and the latest post shows first and then I'll refresh as I'm testing, and it starts from a different date, as if it's lost a bunch of posts.

This one is correct:

And this is what I randomly get:

\**Note that yes, these are both the same page, page 1.

EE v2.7.3 Build 20131210

Addons I have installed:

Any ideas what could be going on here? Would any of the extensions I have installed be causing this issue?

# Answer
> 1 votes
It's because you have `dynamic="no"` in your parameters. Pagination depends on the URL, which in turn means the channel entries tags need to be dynamic.

---
Tags: structure, pagination
---


# Question
Title: Match entries in sales: How can i add a custom field to the article title?
In a wine shop article titles are very often identical. That makes it difficult for my client to choose the right product to be on a sales list. This screenshot should say it all:

Is it possible to change that? Something like this would be perfect in my case:

custom\_field-title (the custom field is the wine ID in my clients workflow, for example 1234. That's not the ExpressionEngine entry\_id. That would show something like this:

1234-Chardonnay

If custom\_field-title is not possible: article\_id-title would be already some help.

Thanks!

# Answer
Try MX Title Control (free) - you can create any title or url template using any ee tags.
> 2 votes

# Answer
Have you looked at the various addons which automatically generate a descriptive title?

E.g. http://devot-ee.com/add-ons/title-master

That way you can use your own custom field as the actual title, and leave the entry title for something more descriptive in relationship fieldtypes etc.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Freeform get return value wether user recieve email or not
I have created form using freeform

> > when user fill-up form user as well as admin receive the email but admin want to receive another email whether user received email or not

for ex: while fill upping form if i enter correct email user will receive email but when i enter wrong it will not. notification should be regarding this whether user received email or not

freefrom send mail using ee()-\>email-\>send();

i tried to get return value for this but it always return true if email is correct or wrong ee()-\>email-\>send();

# Answer
> 1 votes
as I understand you want to be sure, that email which user is entered is exist.

First of all I don't know any EE add-on which which can do this. Because of email specific (as is - not related to EE) is no good methods to do this. You can do telnet request to the server, but this methods is not good for most free servers (gmail/yahoo/hotmail etc.), this may cause your server IP to be added to a blacklist and it will mean that you will not able to send email to this servers at all. Plus some server can have "catch all email" setting and will not give you right answer.

p.s. only way to receive another email whether user received email or not is to setup admin email as sender. So he will get server answer on his email.

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


# Question
Title: How to manage existing entries of channel with structure without select template from each entry?
I have install structure on existing web site. I have lots of entries. the problem is entries does not working after installing of structure. Because of entries has selected default template group. I need to manually select template group from each entries, but i have lots of entries so, it will take more time.

I have already select templates in channel settings of structure. if i select template group in entries its working properly.

If you have any solution, please let me know.

FYI:

ExpressionEngine: 2.7.2

Structure: 3.3.6

Thanks, Jignesh

# Answer
You need to write custom script for this. You can find script example on Structure support forum. My small modification of this script (you need to create template with rights to run php code)

**!make DB backup before run the script!**

```
<?php
/**
* Batch reset template_id for Structure entries
*/

$site_pages = ee()->db->query( "SELECT site_pages
                                       FROM exp_sites
                                       WHERE site_id = 1" )->row()->site_pages;

$str = base64_decode($site_pages);
$arr = unserialize ($str);
$new_template_id = PASTE-NEW-TEPLATE-ID-HERE; //e.g. 24;

// Set new template_id
foreach( $arr[1]['templates'] as $key => $template_id )
{
    $arr[1]['templates'][$key] = $new_template_id;
}

// Serialize & encode
$new_arr = serialize($arr);
$new_str = base64_encode($new_arr);

$query =  ee()->db->query( "UPDATE exp_sites
                                   SET site_pages = $new_str
                                   WHERE site_id = 1
                                 " );
exit;
?>

```
> 2 votes

# Answer
I think yet there is no way but you can do it using sql query directly from db
> 0 votes

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


# Question
Title: stash:cache and no_results inside channel:entries does not redirect
This seems to be linked to the issue discussed on this question however it's using cache tags instead of parse and I'm redirecting to a 404.

My code is as follows:

```
{exp:stash:cache name="page"}

  {exp:channel:entries
    channel="post"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    require="yes"
  }

    {if no_results}{redirect="pages/404"}{/if}

  {/exp:channel:entries}

{/exp:stash:cache}

```

I'm accessing this template from the following URI - `/posts/test-post-that-doesnt-exist`

This post doesn't exist, however the template still renders and does not redirect as you'd expect with the `no_results` tag.

Following the idea on this question I added an empty `no_results` and it redirects correctly.

```
{if no_results}{/if}
{if no_results}{redirect="404"}{/if}

```

It smells like a prefix issue, if I removed the stash:cache tags it redirects correctly.

Has anyone else has this issue? Is there a work around? Am I missing something (have tried prefix and unprefix parameters on the stash:cache tag).

Ta

# Answer
I'm not sure if this works with the `{exp:stash:cache}` tag or not, but you can try it:

```
{exp:stash:cache name="page" unprefix="my_prefix"}
    {exp:channel:entries
        channel="post"
        disable="categories|category_fields|member_data|pagination|trackbacks"
        require="yes"
    }
        {if my_prefix:no_results}{redirect="404"}{/if}
    {/exp:channel:entries}
{/exp:stash:set}

```
> 2 votes

---
Tags: stash, redirects, no-results
---


title: group items from channel, by 8

text:
# Question
Title: group items from channel, by 8
I want to group entries by 8. The last div demonstrates that there might be an exact amount of entries that are divisible by 8.

```
<div class="item-container active">
 item 1
 item 2
 item 3..
 item 8
</div>

<div class="item-container">
 item 9...
 item 16
</div>

<div class="item-container">
 item 17
 item 18
 item 19
</div>

```

I want to do it this way so I can use a jquery slide in effect, when you click a button, it would slide/fade-in the next div of items.

I was able to achieve this thanks to the math count % == 0, thanks guys.

Now I have another question, I need to output the appropriate carousel list links

```
<ol class="carousel-indicators">
        <li data-target="#myaccountCarousel" data-slide-to="0" class="active"></li>
    {exp:channel:entries channel="recipes"}
        {if count % 8 == 0}
            <li data-target="#myaccountCarousel" data-slide-to="{if count % 8 == 0}{count / 8}{/if}"></li>
        {/if}
    {/exp:channel:entries}
</ol>

```

You can see what I am trying to do with {count / 8} so the html will render like, obviously it is not working, but you can see what I am trying to do, my goal html output would be:

```
<li data-target="#myaccountCarousel" data-slide-to="0"></li>
<li data-target="#myaccountCarousel" data-slide-to="1"></li>
<li data-target="#myaccountCarousel" data-slide-to="2"></li>
<li data-target="#myaccountCarousel" data-slide-to="3"></li>
<li data-target="#myaccountCarousel" data-slide-to="4"></li>
<li data-target="#myaccountCarousel" data-slide-to="5"></li>
...

```

I thought maybe I could set a dynamic variable with doing something like:

```
{if count % 8 == 0}{dynamic_variable == count / 8}{/if}

<li data-target="#myaccountCarousel" data-slide-to="{dynamic_variable}"></li>

```

I know I could use stash to store the variable but I don't know how I would get count / 8 math to work outside of the conditional since the EE docs say the math only works within a conditional, any help is appreciated.

# Answer
Now that ExpressionEngine includes a **modulus operator** (as of 2.7.1), you can also use that instead of `switch` if you prefer.

Put the first html block's opening tag and the final block's closing tag *outside* of `channel:entries` and use modulus to conditionally close and re-open blocks of html:

```
<div class="item-container active">
    {exp:channel:entries channel="some_channel"}

        your output here <br>

        {if count % 8 == 0}
            </div>
            <div class="item-container">
        {/if}

    {/exp:channel:entries}
</div>

```

EE Documentation on Modulus Operator
> 5 votes

# Answer
switch can help in this case:

```
<div class="item-container active">
    {exp:channel:entries channel="yourchannel"}
        <img src=".." />

        {if count != total_results}
          {switch='|||||||</div><div class="item-container">'}
        {/if}
    {/exp:channel:entries}
</div>

```
> 3 votes

# Answer
You could also use the new modulus operator:

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

    {if count % 8 == 1}
        <div class="item-container active">
    {/if}

        <img src=".." />

    {if count % 8 == 0 OR count == total_results}
      </div>
    {/if}
{/exp:channel:entries}

```
> 2 votes

---
Tags: channel, entries
---