# Question
Title: Playa: Reverse Relationship Entries without a channel entry
Is it possible to simply retrieve the entries from a Playa field that are in use?

Let's say I have a Team channel with everyone in the company's bio. 5 of those people have been selected across various Blog channel entries as the author. (In this case, a different person is logging in to post the entries, and we want to link to their bios.) Can I, with one tag, simply fetch the Team entries that are actively selected within Blog entries, in a sidebar without having a Blog entry as context?

Thanks!

Mark

# Answer
Would the `{exp:playa:parents}` tag do the trick?

Essentially your looking for all of the entries (parents) which have a team member set to be the author. You could loop over your team members (or potentially one member, if it's the member permalink page) and then use the `{exp:playa:parents}` tag to pull your specific articles. The parents tag also supports all standard channel:entries tags, so you could do further refining with the search parameter if necessary.

http://docs.pixelandtonic.com/playa/templating/module/parents.html

Update: Updating my answer after clarification

What about adding something like this, which would be cached to help performance?

```
{exp:stash:set_list name="members"}
  {exp:channel:entries
  channel="blogs"
  search:member="not IS_EMPTY"}

  {stash:name}{member_name}{/stash:name}

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

{exp:stash:get_list name="members" unique="yes"}
  {name}
{/exp:stash:get_list}

```

So in the above code, we're pulling back all blogs that have the member field not empty. You'll notice this loop has a {stash:set\_list} surrounding it which lets us store each item in a list.

After that chunk of code we use the {stash:get\_list} to pull back our list of names, and we specify the unique parameter so we don't return multiple names that are the same.

I didn't test the above code, so definitely check the syntax, but hopefully that would work. Also, check the stash docs for more info on those tags, https://github.com/croxton/Stash/wiki
> 1 votes

---
Tags: playa, reverse-related-entries
---


title: Matrix-loop within another matrix-loop

text:
# Question
Title: Matrix-loop within another matrix-loop
i'm quite new to ExpressionEngine so please forgive me if this is a stupid/badly formed question, but i could really use some help on this one.

So my problem is that within my template i have a matrix-loop, and within that loop i have another matrix loop, which depends on the value of the outer loop.

Here's how i would like it to work:

```
{outer_matrix_field var_prefix="outer"}
    {another_matrix_field var_prefix="inner"}
        {if inner:package_{outer:row_count} == "y"}
            .. do stuff in here ..
        {/if}
    {/another_matrix_field}
{/outer_matrix_field}

```

The `inner:package_{outer:row_count}` gets parsed to `inner:package_1`, but that in turn is not parsed into its value.

It seems to me like it is some problem with the order of how EE parses/executes the tags, and i've tried with parse="inward" everywhere and that seems to do nothing.

Now i know that this could probably be solved using something like Playa, but that is not an option as the client has specifically asked for this solution.

So, what i need to know is if this is even possible.

Thank you

# Answer
> 2 votes
Like you mentioned in your comment, embeds should do the trick, but be aware embeds are very costly to performance. If you have a big loop, and subsequently many embeds, you could see a rather significant performance decrease.

Instead of your normal embeds, you can also try using stash embeds. https://github.com/croxton/Stash/wiki/%7Bstash%3Aembed%7D

Also, take a look into ce caching to see if you can avoid having to run the potentially costly loop each page load. http://devot-ee.com/add-ons/ce-cache

---
Tags: matrix
---


title: Multiple Nested "Layers" using Playa

text:
# Question
Title: Multiple Nested "Layers" using Playa
I'm trying to build a database of K-12 schools for a directory site and wanted to organize them nicely as well as make it easy to enter information in without re-entering the same info in too much.

I came up with this solution that involves 4 channels and playa fields:

* Channel: States - has only Title field (50 entries)
* Channel: Counties - has a Title field and a Playa field: state (58 entries in this channel for the state of CA alone)
* Channel: School Districts - has a Title field and a Playa field: county (100's of entries in this channel for the state of CA alone)
* Channel: Schools - has a Title field, a Playa field: district, as well as a number of other fields that pertain to the school.

I figured by having the prior relationships I can traverse up and get all the info I need without having to enter in the same info in each school all the time.

Main question is: Is my structure overkill?

My end goal is to use the module Reefine to use for filtering. This way users can use the filter menu to select their state, county and school district to find their school.

I have already entered some of the data in (all the states and counties for the state of CA, as well as about 150 school districts so far.

Any help/guidance for making this easier/more streamlined would be great. Thanks!

# Answer
> 1 votes
From a 50K foot view this approach seems feasible. Obviously when you have that many different nested relationships, you'll need to be conscious of performance and the number of queries on any given page, but that's something you can somewhat manage with your nesting/embedding technique and caching.

I'm working on a site with a similar problem where we have 50 items grouped into several sections, which are organized into an individual menu. Each of these (products, sections, menus) are channels, all connected via Playa.

My outer loop, which pulls in a menu and loops over individual sections looks like:

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

{tmpl_menu_sections}
 {stash:embed:menu:menu_section stash:section_entry_id="{entry_id}"}
{/tmpl_menu_sections}

{/exp:channel:entries}

```

And then the embed which pulls in individual sections and loops over their menu items is:

```
{exp:channel:entries
  disable="categories|category_fields|member_data|pagination|trackbacks"
  dynamic="off"
  entry_id="{stash:section_entry_id}"}

  <h3>{menu_section_title}</h3>

  {menu_section_products}
  <div class="menu-line-item clearfix">

    {title} {item_description}

  </div>
  {/menu_section_products}

{/exp:channel:entries}

```

Note that I have all of this being cached using CE Cache, so I really only have a major performance hit whenever I have set the cache to break.

---
Tags: playa, relationships, filter
---


# Question
Title: Trying to redirect a page to HTTPS using .htaccess, getting "too many redirects" error
Ugh, seems like I'm having a lot of htaccess issues lately. Recently moved a client site to new hosting from the cient's internal server. Their IT had setup SSL and updated the .htaccess to redirect http://site.com/login to https://site.com/login. This .htaccess file causes a "too many redirects" error. I've done a lot of trial and error testing on this and the results are always the same. I even found Adding a .htaccess redirect to https that plays nicely with existing EE .htaccess rules and tried that exact working htaccess file and got the same results. Any ideas?

```
RewriteEngine On

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

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

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

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

```

I've commented out everything but this and still have the same issue...

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

```

# Answer
> 3 votes
I've run into similar issues in the past, and honestly I gave up on htaccess in the end as I never could get it to work exactly as I intended.

A much easier solution I found was using an add on to force the redirect instead, doing it this way I gained direct control of pages needed redirecting in templates instead.

I used an addon called Force SSL, http://devot-ee.com/add-ons/force-ssl

You just pop {exp:force\_ssl} in the page you want to be secured and your set. In my case I wanted some pages to not be secured too, so for that I just use {exp:force\_ssl:restore}

Update:

Okay as it's still giving you the error when using other methods to redirect, this suggests to me there's something else causing the problems here. Just do this test for me. Remove all the ssl rules from htaccess, and also any occurrences of the Force SSL addon. Then goto any page on the site, but for SSL by putting https:// in the URL.

What I suspect is in this case it will redirect back to http:// from https://

If it does this then what's likely happening is there's something in the web server forcing insecure connections. This would be why you get too many redirects as it would just switch back and forth between the too hence the too many redirects error.

If it is this, just get in touch with your web host or whoever administers yoru server to get them to look into that as it's likely a config you don't have access too.

# Answer
> 0 votes
I've had similar issues; after discussion with our sys-admin, we determined that if you need anything on a site served with SSL (like a login page), you probably want the entire site served with SSL. Assuming everything you're serving on the front-end can be downloaded of HTTPS, that shouldn't be an issue. It adds some overhead, but, it's trivial, and doing so will prevent a few different attack vectors that you otherwise leave open when not securing the entire site.

In summary, turn on SSL for the whole site if you can. If that's not an option, I can throw a few minutes at your .htaccess file.

---
Tags: htaccess, redirects, ssl, secure
---


# Question
Title: Solspace Calendar: How to move existing entries to calendar channel?
So I recently bought the Solspace Calendar Add-On, because my site (that is already running) needed better functionality for the event dates. Problem is that I can't use the calendar field type on the existing channel... I have hundreds of entries in that channel and now I'm wondering how I can easily move those entries to the calendar channel. How would I go and do that?

Thanks in advance,

Marijn

# Answer
Importing into Solspace Calendar can be done putting a URL pointing to an .ics file in the **URL to iCalendar (.ics) file** custom field in the **Calendar: Calendars** channel.

What you could do is create an .ics file output in a regular EE template using {exp:channel:entries}. Then save this output as an .ics file and use it to import into Calendar as mentioned above.
> 1 votes

---
Tags: solspace, solspace-calendar
---


# Question
Title: Restoring publish layouts after fixing the disappearing fields bug
So I had a post here. I got the answer I needed and applied the fix, but I can't fix the existing fields from prior entries. Does anyone have a fix for this?

# Answer
> 1 votes
It appears that logging off, clearing the cache and logging back in did the trick. I just needed to rebuild the publish layouts after that. I don't know what I did different this time, but it's working now.

---
Tags: ee2, fields, publish-layout, bug
---


# Question
Title: New member registration set to require activation, but new registrants are working without it
I'm using Freemember plugin to manage member forms. I just setup a registration form and tried both activation methods, "self activation via email" and "manual activation by administrator". But a registrant can log in immediately and they never appear under "pending members" in the CP. Any ideas why they are being activated immediately? Thanks!

# Answer
> 3 votes
I had to remove the group\_id="7" from the freemember registration form tag. With it in there, the registrants never went to "Pending" first, they would be put into the member group with id of 7.

---
Tags: members, freemember, registration, register, activation
---


# Question
Title: What are the recommended ways to get to the bottom of slow load times in EE?
I'm experiencing some really slow load times with my EE install. Other sections of the site that aren't managed by EE are loading very quickly, but any time I hit an EE-managed section it takes at least 6 seconds to load. After enabling debugging I'm seeing these results:

> **Loading Time: Base Classes** — 0.0023
>
> **Controller Execution Time ( Ee / Index )** — 6.1133
>
> **Total Execution Time** — 6.1158

What might be the best way to track down the source of these slow loading times?

# Answer
Checkout the EE Debug Toolbar. It's a great utility for seeing where your bottlenecks. Main place to check is memory consumption and db queries. My guess is it's a combination of both.

EE Debug Toolbar

http://devot-ee.com/add-ons/ee-debug-toolbar

The latest version of EE is also compatible with New Relic, check this out. It's software specifically designed for this and EE is compatible with it now.

https://newrelic.com/
> 4 votes

# Answer
I would consider checking out the ExpressionEngine Whitepaper that Nexcess recently put out. It's a fairly in depth look at best practices for ExpressionEngine performance. Hope this helps. http://www.nexcess.net/expressionengine-best-practices-whitepaper
> 2 votes

# Answer
Almost always optimize caching with the Devot-ee or Solspace addon best suited to your specific site needs is a good idea. Read http://cdn.ctrlclickcast.com/transcripts/2011/eepodcast-055.pdf.
> 1 votes

---
Tags: debugging, loading-time, speed
---


title: Uneven category depths template

text:
# Question
Title: Uneven category depths template
I have a site where there is an uneven depth of categories for a product channel. Previously I've cobbled together a band-aid solution but I'm reaching out to see if there is a better way.

I have a simple category:

```
RootA
 -- AChild01
 -- AChild02
RootB
RootC

```

The URL would be:

```
/products/RootA/ -- Show Child categories
/products/RootA/AChild01 -- Show entries
/products/RootB -- Show entries
/products/ -- Show RootA, RootB & RootC

```

Basically I need to know if segment\_2 has child categories and if so then display Child category links. If segment\_2 doesnt have child categories then display entries assigned to it.

Not keen on using a 'category' keyword in the URL, familiar with Switchee and GWcode categories and am using stash (if that helps) and all takes place inside a single template as categories will change over time (names not depths).

How have others dealt with a clean URL structures **and** uneven category depths ?

# Answer
So with some trickery here's how I managed to get it working, you'll need: Stash, GWcode Categories & Switchee

URLS conform to either of these: mysite.com/products/category/list-entires mysite.com/products/category/sub-category/list-entries

```
{!-- Create list of top level categories WITHOUT children --}
{exp:stash:set name="flag_categories_1" save="yes" replace="no" parse_tags="yes"}{exp:gwcode_categories channel="flags" style="linear" show_empty="yes" depth="1" last_only="yes" backspace="1"}{cat_url_title}|{/exp:gwcode_categories}{/exp:stash:set}
{!-- Create list of top level categories WITH CHILDREN --}
{exp:stash:set name="flag_categories_2" save="yes" replace="no" parse_tags="yes"}{exp:gwcode_categories channel="flags" style="linear" show_empty="yes" depth="2" backspace="1"}{cat_url_title}|{/exp:gwcode_categories}{/exp:stash:set}
{!-- Crete list of Sub categories --}
{exp:stash:set name="has_child" save="yes" replace="no" parse_tags="yes" parse_condtionals="yes" trim="yes"}{exp:gwcode_categories channel="flags" depth="2" style="linear" backspace="1" show_empty="yes"}{parent_url_title}|{/exp:gwcode_categories}{/exp:stash:set}

```

All that above does is record stashes for Categories with No children, Categories with Children and a list of child categories.

Then we test segments, starting with the outermost (segment\_3).

```
{exp:switchee variable="{segment_3}" parse="inward"}
{!-- Seg 3 is a child category - Show list of entries--}
        {case value="{stash:flag_categories_2}"}
        …
        {/case}
{!--Seg3 not valid, Seg2 - not valid. Show root categories--}
    {case default="yes"}
        {switchee variable="{segment_2}" parse="inward"}
        {case value=""}
        …
        {/case}
{!-- Seg2 Category Has children, show child categories--}
        {case value="{stash:has_child}"}
        …
        {/case}
{!-- Seg2 - valid category with NO children, show list of entries --}
        {case value="{stash:flag_categories_2}" default="yes"}
        …
        {/case}
        {/switchee}
    {/case}
{/exp:switchee}

```

Hopefully this may help others trying to figure out something similar. Or chime in with your preferred method.
> 2 votes

---
Tags: templates, categories, switchee
---


title: EE 2.7 and File Sync

text:
# Question
Title: EE 2.7 and File Sync
So I'm not sure what is going on with EE 2.7.0 but the File Sync seems to be a bit whacky. I have 15 files uploaded to my remote server:

Then when I go to File Upload Preferences and click Synchronize I get the appropriate count and EE appears to sync the images:

But when I go to File Manager to view the files I only get 10 images:

Has anyone else seen this? It WORKED ONCE before but not anymore. My permissions for the "uploads" folder is 755 and the individual images are set to 644. So I'm not sure what else could be causing this.

Any ideas? I will probably submit this to Ellis Lab too but wanted to make sure I wasn't missing something.

# Answer
There is a patch here: http://ellislab.com/asset/bug\_patches/synchronize.zip

(replace synchronize.js in themes/javascript/compressed/cp/files/ with the one in this file)

**Edit:** apologies, just saw your comment. Will leave answer here for future Googlers...
> 2 votes

---
Tags: file-uploads, file-manager
---


# Question
Title: Populating Href With URL from Previous Page?
I'm basically trying to create a button that will take the users back to a search results page of a directory. Is there any way to populate `href` with the url of the previous page?

# Answer
There are a few add-ons that allow you to do this without having to rely on PHP or Javascript.

**Mo Variables**:

You would want to have `<a href="{last_page_visited}">Back to Search Results</a>` or you could do `<a href="{one_page_visited}">Back to Search Results</a>` the nice thing about Mo Variables is that it allows you to grab up to 5 pages of history from the session.

**URL Helper**:

With URL Helper you would want to use the following `<a href="{referrer}">Back to Search Results</a>`

They both offer similar functionality with each having something that other does not so evaluate them both and see which one suits your needs the best.
> 10 votes

# Answer
If you enable PHP this will output the previous URL. But HTTP\_REFERER can be modified by the users browser.

`<?=$_SERVER['HTTP_REFERER'];?>`
> 2 votes

# Answer
I extended a bit on Justin's submission, checking to ensure the reference was from within my own site. Eg. I didn't want to send people back to the Google search results page.

```
{exp:ce_str:ing allow_eecode="yes|yes" php}
    <?php
        $referrer = '{referrer}'; // using extension url_helper (http://devot-ee.com/add-ons/url-helper)
        $base_url = '{global:base_url}'; // site base path

        if (strpos($referrer, $base_url) === 0) { // check if they start the same
            echo '<a href="{referrer}">Go back</a>'; // add back link to page within site
        }
    ?>
{/exp:ce_str:ing}

```
> 2 votes

# Answer
you could off course also do a href="javascript:history.back();"
> 1 votes

---
Tags: url
---


# Question
Title: Freeform Pro Composer - Checkboxes & Values
I love the composer feature of FF Pro, but the problem I'm having is outputting custom markup for my form elements.

Inputs and Textarea's are no problem. But when I come to outputting Checkboxes or Radios I can't figure out how to do my own custom markup. Is this even possible?

The code to output the fields is this:

```
{composer:field_output}

```

But with Inputs I can do this:

```
{if composer:field_type == "text"}
    <span class="field">
        <label>{composer:field_label}</label>
        <input type="text" name="{composer:field_name}">
    </span>
{/if}

```

Which is perfect for text inputs, but there is no tags (which I can see) to output the Radio / Checkbox values, or even options inside a select menu.

I also can't understand how to use the "Composer Edit Form", and have values placed inside the value parameter... Without again... just getting FF to generate the markup for me.

The reason I need to edit the markup, is to add ID's and Classes to the form fields.

# Answer
You can add ids and classes to any form field with the attr: prefix.

```
{freeform:field:my_text_field attr:id="myId" attr:class="myClass"}

```

So in composer:

```
{freeform:field:{composer:field_name} attr:id="myId" attr:class="myClass"}

```

If you need it per item in radios and checkboxes, you can also adjust the wrapper attributes as params on {freeform:field:FIELD\_NAME} :

http://www.solspace.com/docs/freeform/default\_fieldtypes/#checkbox\_group http://www.solspace.com/docs/freeform/default\_fieldtypes/#radio
> 1 votes

---
Tags: solspace-freeform
---


# Question
Title: Limited results by the channel of a related entry
I have three channels: Books, Screenplays, and Reviews. The Reviews channel includes a relationships field, where the user can assign the review to a particular book or screenplay. Thus the relationships field draws its available choices from two channels, but the relationship itself is one-to-one (ie. Allow Multiple Relations is OFF).

As I understand it, this means that I have one parent channel (Reviews) and two child channels (Books and Screenplays).

I have no problem displaying the reviews for a specific book on the book's own page (/books/view/the-book-i-wrote); I do that by accessing the {parents} tag from inside a {exp:channel:entries channel=books} tag. However, what I also want to do is have a list of general book reviews on the book index page (/books/index.php) -- NOTE: *book* reviews only, excluding any screenplay reviews. So I want to limit the results derived from the reviews channel to ONLY those reviews that have been assigned a relationship to an entry residing in a *specific child channel*. I cannot work out how to do this.

I realised that assigning a channel parameter to the {parents} tag is not the way -- it is intended to differentiate between multiple parent channels, not limit the results derived from a particular parent.

Can anyone help me untangle this? Thanks.

# Answer
You could do something like this, but # of results may vary since the filtering is done inside the `entries` tag:

```
{exp:channel:entries channel="reviews" dynamic="no" limit="10"}
    ...
    {relationship_field channel="books"}
        {relationship_field:title}
    {/relationship_field}
{/exp:channel:entries}

```

### Update

My only other suggestion would be to add categories to the reviews channel for each type (ie. books & screenplays)
> 1 votes

---
Tags: relationships
---


# Question
Title: How to hide events that is already past in Solspace Calendar
I use Solspace Calendars for booking of a conference room. Since we do not need to see past bookings, is it possible to hide all past entries so the calendar in month view is not so cluttered. Thanks!

# Answer
> 1 votes
If you're simply listing events and occurrences in a chronological order and only want to display upcoming events, use {exp:calendar:cal} with the following parameters:

```
{exp:calendar:cal
    pad_short_weeks="n"
    date_range_start="today"
    date_range_end="+1 month" {!-- ...or whatever timeframe in the future --}
}

```

If you're using {exp:calendar:cal} to build a *monthly calendar table*, however, the above would give you a partial calendar table, with some weeks/days missing. In that case, try comparing each event's start date with the {current\_time} variable available in EE:

```
{if '{event_start_date format="%U"}' > '{current_time format="%U"}'} Your event data {/if}

```

Some points:

* Be careful of quotes in the above!
* Use the advanced monthly calendar example, or something along those lines. You may be able to pull it off with {exp:calendar:month} as well, but {exp:calendar:cal} is the most thorough and flexible tag.

---
Tags: solspace-calendar
---


# Question
Title: MX Lone Star not showing in Grid field options
According to this blog post, MX Lone Star is supposed to work with Grid.

However, when I tried changing a field's fieldtype to Grid and set one of the columns to the fieldtype MX Lone Star, I did not see it in the options.

I have already checked the Fieldtypes page and saw that it was already installed.

Any idea why this is the case?

# Answer
New version is available for download. All bugs with Grid field was fixed. My apologies for delay. Please send me email in case if you will have any errors in future.
> 3 votes

---
Tags: 2.7.0, mx-lone-star
---


# Question
Title: Repeating layout blocks within and across pages without a bunch of embeds?
I've currently got a project on my plate where content is presented in blocks of a few different styles, for instance:

* A: Introduction area with large graphic, headline, and copy
* B: Carousel/slider with headline, slides, and copy
* C: Testimonial block with headline, photo, quote
* ... and so on.

One page might might call for a layout combination of ABBCBA, another CBBA, and so on. There are a finite number of predetermined combinations.

I'm currently planning on using Blueprints to select the template and manage the publish layouts; the vast majority of pages will live in a single channel. A page with an ABA layout (selected with Blueprints) would utilize the following fields:

**Pages Channel**

* Block A1 - Headline (Text)
* Block A1 - Graphic (Assets)
* Block A1 - Copy (Wysiwyg)
* Block B1 - Headline (Text)
* Block B1 - Slides (Matrix)
* Block B1 - Copy (Wysiwyg)
* Block A2 - Headline (Text)
* Block A2 - Graphic (Assets)
* Block A2 - Copy (Wysiwyg)

For a page with an ABA layout, I could setup an ABA template, like this:

```
{embed='blocks/block_a' headline='{block_a1_headline}' graphic='{block_a1_graphic}'}
{embed='blocks/block_b' headline='{block_b1_headline'}' ...}
{embed='blocks/block_a' headline='{block_a5_headline}' graphic='{block_a5_graphic}'}

```

I've been paying enough attention to chattering within the community to know that including a huge pile of embeds like this is bad news for performance; I'm starting to wrap my head around Stash, but, I haven't seen any examples that appear to relate to the problem I'm trying to solve here.

Bottom line: is there another approach that will work with less overhead, or, is this acceptable, assuming there's adequate caching in place to keep load times snappy?

Could I use a snippet for each block type, and somehow pass the different entry fields to them?

Why not Playa with a channel for each block type? This site will have 150+ pages, each with several blocks that are unique to that page. Managing that many entries would be a huge hassle for content editors.

Why not Content Elements + Mason? We're concerned about multi-lingual and workflow compatibility with Publisher, and possible issues with search.

Your help, suggestions, and feedback will be greatly appreciated. Thank you!

# Answer
Nick, in case you missed it, have you considered stash + partials + stash templates.

Ive previously posted some code here. it will give you an idea of the structure.

To set content for your block a,b,c use {exp:stash:set name="block\_a"} in your page template.

The template can point to required layout like this {embed="layout/aba"}

In your layout template, add content blocks in required order like this {exp:stash:block\_a}

If you have vars to pass, you can use {exp:stash:set\_list...

Across your templates, reuse code by using stash templates.

And all this is achieved using a single embed.

And another benefit. You have a layout template abc and it has three blocks a,b,c. Your page template should also set content for blocks a,b,c. If you do not set content for say block b, passing only a,c the layout template will just skip block c and not display anything. That effectively gives you even further freedom to create extra layouts. In other words layout abc can also output combinations of ab or ac or bc.
> 1 votes

# Answer
I would recommend using Stash to do this. I know it takes some getting used to but this is a perfect use case for Stash.

You could also give Content Elements a shot here or use playa and three or more channels.

With Playa channel A1, B1, C1, etc. would be your content channels. They would store your content blocks so A1 might contain your carousel images and captions fields while B1 might contain just your intro paragraphs. Then you would create a channel with a playa field that would let you relate channels A1, B1, C1, etc. and order entries as you want them presented on the page. The new relationships feature in EE2.7+ might also work here but I've found so far that when you need to do something just a little more complex than simple many to many relationships you need Playa.

Content Elements does something similar and with its ability to use other fieldtype add-ons it might fit your need perfectly. It lets users create a block of content from a preset list of content types and drag/drop them to reorder as they see fit.
> 1 votes

# Answer
Mike Boyink has a great write-up on how to achieve something like this using Pixel & Tonic's Playa (which you might be able to do with EE's native Grid fieldtype now). I've used it on several sites myself and found it to be super flexible and useful for the specific situation you're describing.

http://www.train-ee.com/courseware/free-tutorials/comments/flexible-sidebars-using-playa

There's sample code available for download with Mike's article that can help get you up and running quickly (his tutorials are great).

I'd recommend using Switchee to iterate through your Playa field output. This will help keep your query count down and load times reasonable. The template code would look something like this:

```
{cf_playa_field}
    {exp:switchee variable="{channel_short_name}" parse="inward"}

        {case value="layout_block_a"}
            [ Layout Block A Output]
        {/case}

        {case value="layout_block_b"}
            [ Layout Block B Output]
        {/case}

        {case value="layout_block_z"}
            [ Layout Block Z Output]
        {/case}

    {/exp:switchee}
{/cf_playa_field}

```
> 1 votes

---
Tags: embeds, dry
---


# Question
Title: Pay by invoice - how to send and handle due date
As far as I can gather, i should use the payment type Manual for this purpose.

I have created an invoice template in EE, but I have two questions

1) Is there some obvious way of sending it to the customer?

2) How can i handle the due date? It has to be set for X weeks after the date the invoice is actually sent

Is this something I can do with Store, or will I have to look elsewhere?

Thanks

# Answer
> 2 votes
There is nothing built into Store that allows you to limit access to products to certain members. Having said that there are a few ways you can get around this. A while back I wrote a blog post about using Simple Commerce for creating invoices. While doing this with Store will be a bit different you might be able to apply some of the template logic or ideas into your setup.

1.) You will need to use an add-on to send the email to the client. You can use something like MX Notify or PostMaster to send the email when you submit the order (I would probably combine this with a status parameter so you can edit/draft the invoice before it is sent).

2.) You would again need to use an add-on to have a due date automatically sent. Personally I set the due dates manually but something like AutoExpire should do the trick, just remember to allow expired entries in your channel entries tags on the front-end.

All that said, there is not an out of the box solution that will allow you to do something like this, but it very doable.

**EDIT**

If you are still using Store v1 oppose to the newly released Store v2 you might be able to use Store: Quotations for your needs. I have never used it personally so I am not sure of all of it's features.

# Answer
> 1 votes
One way you could set up the due date - use a custom order field. Store provides up to 9 custom text fields per order. You would need to generate a hidden field during checkout which fills one of these fields with the date you need (either using javascript or an add-on which can generate dates for you).

This would make it very easy to display in the order confirmation email etc.

If you use the manual payment gateway then you can use the order confirmation email to send to your customer, or create an additional status and configure an email to be sent when you change the order to that status.

---
Tags: expresso-store
---


# Question
Title: Solspace user registration and avatar uploading
I have a particular configuration. I'm using an `<exp:user:register>` form to register a user while at the same time adding a donation to a shopping cart using exp-ressso Store module. Basically I have two forms. One of them gets submitted in Ajax (the Registration one), while copying over some values from the Store one. When the submit succeeds also the `<exp:store:checkout>`form gets submitted.

I would have previously added the donation to the cart by using `<exp:store:product` tag, reload the page with a #expanded hash in order to jquery .show the actual checkout form.

I like the fact that in two passages, the users of the charity website I'm developing have the chance to register and submit the donation.

Since I will be posting also a "donors list" page, I would like my users to be able to upload their avatar picture/logo which I will later post on the listing page. I was wondering I can I achieve this without having to rely on `<exp:user:edit>` tag in a subsequent page/moment.

Here's my markup code:

```
 {exp:channel:entries channel="cartoline" category="1"}
{exp:store:product
entry_id="{entry_id}"
form_class="importo-donazione importo"
form_id="importo"
return="cartoline/cartolina_autore#expand"
}
<input type="text" id="item_qty" name="item_qty" value="350,00"/>
<input type="submit" name="dona-ora" value="Dona ora!" />
{/exp:store:product}
{/exp:channel:entries}

```

and later on

```
    <section id="form">
     <div  class="wrapper">
         <h2>Inserisci i tuoi dati e procedi con la donazione</h2>

       {exp:store:cart}

    {if no_items}
        <p>La tua donazione è stata annullata. Clicca <a href="{path="cartoline/cartolina_autore"}" style="color: #fff;">qui</a> per indicare un nuovo importo per questa donazione</p>
    {/if}

<p class="thanks">Hai scelto di destinare <span>{order_total}</span> alla nostra causa! Grazie!</p>

{/exp:store:cart}

<div class="hidden">
{exp:store:checkout
payment_method="Paypal_Express"
return="thanks/ORDER_HASH"
require="billing_first_name|order_email"
form_id="store"
}
            </fieldset>
            <fieldset>
             <label for="order_custom1">Ragione sociale</label>
             <input class="username" type="text" value="{billing_first_name}" name="billing_first_name"/>
             </fieldset>
             <fieldset>
             <label for="{order_email}">email</label>
             <input class="email" type="text" value="{order_email}" name="order_email"/>
             <input type="hidden" name="XID" value="{XID_HASH}" />
             <input id="store-submit" type="submit" name="submit" value="invia" />
             </fieldset>

{items}
{exp:channel:entries
    entry_id="{entry_id}"
    disable="pagination|categories|member_data|category_fields|custom_fields"
    channel_short_name= "cartoline"}
{/exp:channel:entries}
{/items}
             <input type="submit" name="empty_cart" value="Annulla" />

    {/exp:store:checkout}
    </div>
    <div class="register-form">
    {exp:user:register
    form:id="registrazione"
    return="site/index"
    }
    <input class="username" type="text" value="" name="username"/>
    <input class="email" type="text" value="" name="email"/>
    <input class="logo" type="file" name="logo" value=""/>
    <input type="hidden" name="password" id="password" value="centronemo24" />
    <input type="hidden" name="password_confirm" id="password_confirm" value="centronemo24" />
    <input type="submit" value="procedi" name="submit"/>
    {if no_results}
        <p style="clear: both;">Ti sei già registrato per una donazione. Se vuoi farne un'altra, registrati come altro utente <a href="{path="logout"}">Logout</a></p>
    {/if}
    </div>
    {/exp:user:register}

```

And this is the relevant jquery

```
$(document).ready(function() {

$("#store .email").blur(function(){
    $("#registrazione .email").val(this.value);
});
$("#store .username").blur(function(){
    $("#registrazione .username").val(this.value);
});
$("#store .logo").blur(function(){
    $("#registrazione .logo").val(this.value);
});
// Get the hash of the page
var hashstring = window.location.hash.substring(1);
var found = false;
var checkedout = false;

// Do a hash exist?
if (hashstring.length > 0)
{
    // Split the hash by '&'-sign (in case you have more variables in the hash, as I have)
    var a = hashstring.split("&");

    // Loop through the values
    for (i = 0; i < a.length; i++)
    {
        // Split the string by '=' (key=value format)
        var b = a[i].split("=");

        // If the key is 'expand' (which tells us if the page is reloaded)
        if(b[0] == 'expand')
        {
            found = true;
        }

    }
}

if(found)
{

$('#form').show();
$(document.body).animate({
    'scrollTop':   $('#form').offset().top
}, 2000);
$('#importo').hide();

$('#registrazione').on('submit', function(e) {
  e.preventDefault();

  $.ajax({
    url: $(this).attr('action'),
    type: 'POST',
    data: $(this).serialize(),
    success: function() {
      // duplicate fields from first form into second form
      // as per whatever code you've already written

      // submit second form
      $('#store-submit').click();
    }
  });
});

```

I would like to add a field or something, in order to populate the avatar. I might also consider using a "guest" channel to post images and usernames along with e-mails, but since the member channel seems the most natural destination…

Do you have any thoughts? Thank you.

# Answer
You can upload an avatar images during registration with {exp:user:register} by using a **file** field with a `name=""` of `avatar_filename`:

```
 <input type="file" name="avatar_filename" />

```

However in general (not just with Solspace User but any form), uploading a file using AJAX may require a special javascript/jQuery plugin, such as AjaxFileUpload. Simply using .serialize() might not be enough: files are handled differently than simple form fields.
> 2 votes

# Answer
This sounds much harder than it needs to be. Have you thought about using Store's native member registration features?

https://exp-resso.com/docs/checkout\_tag.html#registering\_members

You can still use Solspace User to handle the update profile pages etc, but just use Store for the initial member registration during checkout.

Also I'd avoid uploading an avatar at the same time as checking out, payment processing etc. It's just too much that could go wrong in a single request. Why don't you just ask the customer to optionally upload an avatar *after* they make payment? That way it can be an optional extra if they want their avatar to be shown.
> 0 votes

---
Tags: expresso-store, file-uploads, solspace-user, registration, safecracker-registration
---


# Question
Title: (103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function
Currently trying to work out why our ExpressionEngine install is running so slowley, have just checked our error log and it's full of the following:

```
(103)Software caused connection abort: mod_fcgid: ap_pass_brigade failed in handle_request function

```

The entire site seems to hang on every page load then once it gets past this hang loads fairly quickly.

What would cause this error and how can I go about fixing it? Any ideas?

We're running on ExpressionEngine 2.7 and are using the Expresso Store module.

# Answer
Is there are particular reason you are using mod\_fcgi? Are you managing the server yourself?

From googling the error it doesn't seem related to EE at all - this question on Stack Overflow may be helpful:

https://stackoverflow.com/questions/12477627/mod-fcgid-ap-pass-brigade-failed-in-handle-request-function
> 1 votes

---
Tags: expresso-store, error, performance
---


# Question
Title: Can you override decimal places for Expresso Store price variables in the templates?
Expresso Store lets you determine your price decimal places globally. So even if you generally price things as whole dollars ($125.00), it's likely you'll need to set your display to 2 decimal places, since things like percent-based sales, shipping, and sales tax will require displaying the decimal places.

Is there any way, besides PHP, to override the decimal place setting right in the templates? I'm imagining something like `{price decimals="0"}` or maybe a more elaborate `{price format="something"}` where something apes PHP's `money_format()` syntax.

# Answer
> 2 votes
As Justin said, the best way to do this on a per-template basis is to use a separate add-on to format the number.

When you are using an add-on, remember there are `_val` variables available to you, which display the unformatted decimal. For example:

```
{price_val}
{sale_price_val}

```

Also if your price is a whole number, sometimes you can use these in your template to display it. E.g.

```
${price_val}

```

However, that won't work if some of your products do have a decimal place, or you want to consistently set the currency symbol or decimal separator.

# Answer
> 1 votes
There is nothing built into Store currently that would allow you to do that. Having said that there are a couple of plugins available already that you can use to format the numbers on the front-end without having to enable php in the the templates. Here are a few that I know of:

There might be more available, to get this added to the Feature Request list I would recommend email support@exp-resso.com so it might be added to a future release of Store.

---
Tags: expresso-store, number-format
---


# Question
Title: What would be a reasonable configuration for a pizza store?
I'm wondering what would be the best implementation for a pizza store. The workflow would be:

* User adds a pizza (product) to their cart.
* User is able to add a la carte toppings to their pizza, each of which increases the price slightly.

I'm assuming some combination of price modifiers would do the trick, but I'm not sure if you are able to add multiple modifiers to a single product?

Any thoughts or suggestions would be helpful, thanks!

# Answer
> 1 votes
You can definitely add multiple modifiers to each product. The customer will have to select one option from each group before they can add the product to their cart. That will work fine for things like the base, and you can have yes/no options for each custom topping.

It's hard to anticipate in advance what you need though, so it's probably best if you have a go at setting it up and let us know if and where you get stuck.

# Answer
> 0 votes
I’m pretty sure you can only use one modifier for a product when adding it to your Store. You can add multiple modifiers in the back end, but only pick one from a select type menu on the front end. This is because modifiers are generally colour or size related.

I would investigate adding each topping as a product of it’s own, then either creating relationships or category groups for finer control over which toppings go with which pizza, if necessary. Then you can add small prices to toppings and apply discounts at volume.

Obviously you’re going to have to be canny when a pizza is selected. But there’s nothing stopping you from displaying the chosen pizza at the checkout and displaying the related topping products immediately underneath so the customer can build their pizza.

Hope that’s useful.

---
Tags: expresso-store, ecommerce
---


# Question
Title: Protocol agnostic server paths and facebook images in links
I had a fun time tracking this down. Every time I would copy/paste a link from a site's blog, the title would display, the link would display, but the images would return nothing. The link was correct and clicking the link would take me to the correct post. I went through my settings in NSM Better Meta and included all of the recommended OG meta tags, but still, nothing.

What I found was that by changing my URL of Upload Directory from just "//" to "http://" fixed the issue. That's all fine and dandy, but it doesn't help me keep relative protocols for images. I have both http and https on this site in different locations. It also depends on where they are coming from and if that section of the site has a link that was entered as https. (Not under my control)

Is there any way to set a relative path in the URL of Upload Directory field and have the templates render the path with the protocol from the address bar used?

EXAMPLE:

This renders as:

Which is correct. I can switch from http: to https: without issues of mixed content.

When I copy the link and paste it in FB, the issue is seen:

***NOW...*** Change over to the http: or https: in the settings...

This renders as:

Which is correct, but not what I want...

When I copy and paste this link into FB, I am given the images...

THIS is why I am confused....

# Answer
We forked and modified Bjørn Børresen's SEO Lite module to support basic OG meta tags. The module setting default image still requires an absolute URL; however, for the publish tab and per entry meta, we employed a file upload capability that taps into the native EE file manager and will add a full url dynamically based on file upload settings.

Our changes are open source. Not sure this is the answer you are looking for, but thought I'd share. https://github.com/Minds-On-Design-Lab/modl\_meta.ee\_addon
> 1 votes

# Answer
You can use relative URL paths for you upload directories. Say you images are located at http://example.com/assets/uploads/images/image.jpg you can set your upload url to be relative by entering /assets/uploads/images/ for the uploaded destination url.

Alternatively if you are using something like FocusLab's Master Config file you can use the upload config overrides to set the URL dynamically based upon which protocol/url the user is accessing the site. In your config file you

```
$protocol                     = (isset($_SERVER['HTTPS']) &&$_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
$base_url                     = $protocol . $_SERVER['HTTP_HOST'];
$base_path                    = $_SERVER['DOCUMENT_ROOT'];
$system_folder                = APPPATH . '../';
$uploads_folder            = 'assets/uploads/';

$env_config['upload_preferences'] = array(
 1 => array(
     'name'        => 'Main Uploads',
     'server_path' => $base_path . '/' . $uploads_folder . 'images/',
     'url'         => $base_url  . '/' . $uploads_folder . 'images/'
 )
);

```

You would need to repeat that for each upload directories that you have.
> 1 votes

---
Tags: file-uploads, file-manager, facebook, image-path
---


# Question
Title: Advice on organizing events using Calendar module
I'm looking for some general advice and best practices on organizing/architecting a calendar using the Solspace Calendar module. We are redesigning the Special Olympics of VA website. This group has a ton of events which are organizing by local "Areas" that include counties and cities. These Areas are further grouped by Region (like Southwest, East, etc).

The Areas manage events, so individuals there will need to be able to post their events. For that reason, it seems sensible to create calendars for each Area – about 31 total. However, the audience for this site frequently needs to view events by regions – essentially a collection of Areas. To further complicate things, there are a few types of events, such as Sports or Fundraising.

I'd like to maximize the built-in features of Calendar where possible, adapting the demo templates and so on so that we can do as much as possible for the organization with the budget we have.

It seems to me that the best way may be to simply use Categories for both Regions and types of events. That's not native to the Calendar module, but seem like it wouldn't take much to filter by a category url title.

Would love anyone's thoughts on this. You can check out their current calendar here.

# Answer
> It seems to me that the best way may be to simply use Categories for both Regions and types of events. That's not native to the Calendar module, but seem like it wouldn't take much to filter by a category url title.

That is the direction I would go. Two category groups -- Region and Type -- with Areas being subcategories for the Regions. You'd want to make sure that you set Auto-Assign Parent Categories (Admin → Channel Administration → Global Preferences) to yes.
> 1 votes

---
Tags: solspace, solspace-calendar, calendar, bestpractice
---


title: Database Error "Error Number: 1054"

text:
# Question
Title: Database Error "Error Number: 1054"
I have a fairly fresh install of ExpressionEngine 2.7.2 and am having tons of problems with either Assets or Matrix upon saving an entry. I'm receiving the following error:

```
A Database Error Occurred
Error Number: 1054
Unknown column 'content_type' in 'where clause'
DELETE FROM `exp_assets_selections` WHERE `col_id` = '1' AND `row_id` = 10 AND `content_type` = 'matrix' AND `entry_id` = '4' AND `field_id` = '6'
Filename: third_party/assets/ft.assets.php
Line Number: 1232

```

Both add-ons were freshly installed (no upgrades) and we're using EngineHosting if that matters

Any help would be great! Brian

# Answer
> 2 votes
Ninjaroll,

yeah, until we get Assets 2.2.2 out the door, which should happen any day now, there's an issue with fresh installs of Assets 2.2. If you run the following query, your issue should be fixed.

ALTER TABLE exp\_assets\_selections ADD COLUMN `content_type` VARCHAR(255) NULL AFTER `element_id`

---
Tags: matrix, assets
---


title: Relationships tag not parsed

text:
# Question
Title: Relationships tag not parsed
I have the following code:

```
{exp:channel:entries uri_page="{last_segment}"}
<!--Set some stash variables here, then:-->
    {exp:stash:set name="content"}
    <!--Some markup here, then:-->
          <section class="container">
            <h3>
              Related Articles
            </h3>
            <ul>
              {related_articles}
                <li>
                  <h4>{related_articles:title}</h4>
                  <p>
                    {related_articles:excerpt}
                    <a class="action" href="#">Continue reading</a>
                  </p>
                </li>
              {/related_articles}
            </ul>
          </section>
    <!--Some more markup.-->
    {/exp:stash:set}
{/exp:channel:entries}

```

Yet the relationship tags aren’t parsed at all. The output is:

```
  <section class="container">
    <h3>
      Related Articles
    </h3>
    <ul>
      {related_articles}
        <li>
          <h4>{related_articles:title}</h4>
          <p>
            {related_articles:excerpt}
            <a class="action" href="#">Continue reading</a>
          </p>
        </li>
      {/related_articles}
    </ul>
  </section>

```

I’ve made sure that the relationship field is named correctly (`{related_articles}`) and that the related articles are saved to the entry. All the other fields in the entry are parsed correctly in my template; only the relationships don’t get parsed.

I tried adding `channel="channel_name"` to the `exp:channel:entries` tag, thinking maybe EE needs to have a specific channel set in order for Relationships to work, but to no avail. I’ve also confirmed that the Relationships field type is installed (which is confirmed by the fact that I was able to create the field in the first place, but I’m grasping at straws here).

I’ve searched far and wide, and have been unable to find a solution to this, nor anybody reporting the same issue. Any help will be greatly appreciated!

# Answer
> 2 votes
`uri_page="{last_segment}"` is not a valid parameter for channel entries. You're looking for `url_title` I imagine :)

```
{exp:channel:entries url_title="{last_segment}"}
  {exp:stash:set_list name="related_articles"}
    {related_articles}
      {stash:rel_title}{related_articles:title}{/stash:rel_title}
      {stash:rel_excerpt}{related_articles:excerpt}{/stash:rel_excerpt}
    {/related_articles}
  {/exp:stash:set_list}
{/exp:channel:entries}

{!-- in the same template --}
{exp:stash:get_list name="related_articles" process="end"}
  {rel_title}
{/exp:stash:get_list}

{!-- in an EE or Stash embed --}
{exp:stash:get_list name="related_articles"}
  {rel_title}
{/exp:stash:get_list}

```

Module tags in EE templates are parsed recursively from the outside in, like the layers of an onion, and that's why you need to use `process="end"` to access variables set inside a tag pair but accessed from the outer root layer of the template. See my slides here for a demonstration of what this means in practice: https://speakerdeck.com/croxton/stash-core-principles?slide=18

# Answer
> 1 votes
In your Stash tag, you probably need to add the `parse_tags="yes"` parameter.

```
{exp:channel:entries uri_page="{last_segment}"}
<!--Set some stash variables here, then:-->
    {exp:stash:set name="content" parse_tags="yes"}
    ....

```

**UPDATE**

Separate your queries from your markup.

```
{exp:channel:entries uri_page="{last_segment}"}
  {exp:stash:set}
    {stash:title}{title}{/stash:title}
    {stash:custom_field_1}{my_custom_field}{/stash:custom_field_1}
    {!-- do this for all of the fields you'll need --}
  {/exp:stash:set}

  {exp:stash:set_list name="related_articles" parse_tags="yes"}
    {related_articles}
      {stash:rel_title}{related_articles:title}{/stash:rel_title}
      {stash:rel_excerpt}{related_articles:excerpt}{/stash:rel_excerpt}
    {/related_articles}
  {/exp:stash:set_list}
{/exp:channel:entries}

```

Then apply the Stash fields to the markup below on the same template or Stash embed:

```
<h1>{stash:title}</h1>
{stash:custom_field_1}
<section class="container">
    <h3>
      Related Articles
    </h3>
    <ul>
      {exp:stash:get_list name="related_articles"}
        <li>
          <h4>{rel_title}</h4>
          <p>
            {rel_excerpt}
            <a class="action" href="#">Continue reading</a>
          </p>
        </li>
      {/exp:stash:get_list}
    </ul>
  </section>

```

---
Tags: templates, stash, relationships, tags, parse
---


# Question
Title: Expresso Store: Larger, expandable text fields for modifiers
I'd like to make the custom text fields for the product modifiers in Exp:resso Store larger on the front end and user-expandable since they will need to type large amounts of text. Right now they are only one line high which makes it difficult to write a paragraph easily.

# Answer
You can change any of the inputs to be textareas oppose to text inputs by doing something along the lines of:

```
{modifiers}
    <p>
      <label>{modifier_name}</label><br />
      {if modifier_instructions}<small>{modifier_instructions}</small><br />{/if}
      {if modifier_type == 'var' OR modifier_type == 'var_single_sku'}
        <select name="{modifier_input_name}">
          {modifier_options}
            <option value="{option_id}">
              {option_name}
              {if price_mod_val} ({price_mod}) {/if}
            </option>
          {/modifier_options}
        </select>
      {if:else}
        <textarea name="{modifier_input_name}"></textarea>
      {/if}
    </p>
  {/modifiers}

```
> 3 votes

---
Tags: expresso-store, textarea, price-modifier
---


# Question
Title: Tell WYGWAM not to wrap certain text in a <p> tag
I've built in a shortcode-like method using mx\_jumper that works well, for the most part. I have Matrix field called `blog_images` where the user can upload up to 10 images for a post. Then they include the images in the post's WYGWAM field wherever they want by placing a shortcode referencing the image's ID in the Matrix field, like so:

`{image_2}`

In the template for a blog post I cycle through all images in that Matrix field like this:

```
{blog_images}
    {exp:mx_jumper:put name="image_{row_count}"}
        <figure class="{placement} {size} {css_classes}">
            {image_standard}
                <img src="{url}" alt="{alt_text}" width="{width}" height="{height}">
                {exp:stash:set name="image_width" parse_tags="yes"}{width}{/exp:stash:set}
            {/image_standard}
            {if caption}
                <figcaption style="width: {exp:stash:get name='image_width'}px;"{if "{caption-placement}" == "sidebar"} class="sidebar"{/if}>
                    {caption}
                </figcaption>
            {/if}
        </figure>
    {/exp:mx_jumper:put}
{/blog_images}

```

Then I do the replacing in the content like so:

```
{exp:mx_jumper:out_global}
    {blog_post_content}
{/exp:mx_jumper:out_global}

```

This works really well with one exception:

For formatting purposes I need to have the shortcode on it's own line in WYGWAM. Problem is WYGWAM wants to wrap it in a `<p>` tag, like this:

```
<p>
<figure>…</figure>
</p>

```

… which is improper markup. The browsers try to be helpful and "correct" it by making it this:

```
<p></p>
<figure>…</figure>
<p></p>

```

… leaving space before and after the `<figure>` tags. Yuck!

Can I tell WYGWAM *not* to wrap text that starts and ends with `{}` in a paragraph tag? If not, other suggestions??

# Answer
> Can I tell WYGWAM not to wrap text that starts and ends with {} in a paragraph tag? If not, other suggestions??

For WYGWAM, I don't think you can do that specifically, but you might be able to modify how it responds to paragraph tags by adjusting the Advanced Settings for your configuration.

If that doesn't work, you could try Streeng to kill the empty `<p></p>` pair via find and replace:

```
{exp:streeng find="<p></p>" replace=""}
 {blog_images}
   ...
 {/blog_images}
{/exp:streeng}

```

UPDATE:

```
{exp:streeng find="<p><figure>" replace="<figure>" trim="both"}
 {blog_images}
   ...
 {/blog_images}
{/exp:streeng}

```

OR you can try get really hack-a-licious:

```
{exp:streeng trim="both"}
{exp:replace_plus}
  {replace_area find="<p><figure>" replace="<figure>"}
  {replace_area find="</figure></p>" replace="</figure>"}
    {blog_images}
      ...
    {/blog_images}
  {/replace_area}
  {/replace_area}
 {/exp:replace_plus}
 {/exp:streeng}

```
> 3 votes

---
Tags: pixelandtonic, wygwam, mx-jumper
---


# Question
Title: How to get corect CP thumbnail paths using master config and MSM
I'm using a master config file based on this one, in an MSM install of EE2 (2.5.5).

In the config file, I set the base path and url like so:

```
$base_url = $protocol . "://" . $_SERVER['HTTP_HOST'];
$base_path = $_SERVER['DOCUMENT_ROOT'];

```

This works a treat, but, I exclusively access the CP via my default site /admin - e.g. https://www.default\_site.com/admin/

When I switch MSM sites in the CP, the thumbnails in my **matrix file type** custom fields break, because they are looking for the files in the default site rather than the MSM site I have just switched to.

**Apart from accessing the CP via my other MSM site url**, is there a way to get thumbnails working in this scenario? (I cannot find any config overrides specific to thumbnails, apart from the prefix value).

Note: All other file paths, file upload prefs, and front-end files work correctly - it's just the thumbnails in the CP, for the 2nd MSM site, that are broken.

# Answer
> 1 votes
Since you are editing site\_2 from the domain of site\_1/default\_site, you'll need to better define your sites' url and paths with config settings.

```
$env_config['default_site_path']        = '/path/to/default_site/root';
$env_config['default_site_url']         = 'http://www.default_site.com';

$env_config['site_2_path']          = '/path/to/site_2/root';
$env_config['site_2_url']           = 'http://www.site_2.com';

$env_config['upload_preferences'] = array(
        1 => array(
            'name'        => 'Images for Default Site',
            'server_path' => $env_config['default_site_path'] . '/assets/images/',
            'url'         => $env_config['default_url']  . '/assets/images/'
        ),
        2 => array(
            'name'        => 'Images for Site 2',
            'server_path' => $env_config['site_2_path'] . '/assets/images/',
            'url'         => $env_config['site_2_url']  . '/assets/images/'
        ),
        3 => array(
            'name'        => 'Mug Shots for Site 2',
            'server_path' => $env_config['site_2_path'] . '/assets/images/mugshots/',
            'url'         => $env_config['site_2_url']  . '/assets/images/mugshots/'
        )
    );

```

Two notes:

1. File upload directories for all MSM sites have a unique id to use in the SAME array.
2. If you are using multiple environments where the path and url configs will change, then add this to your config.local.php, config.prod.php, config.dev.php, etc, with the appropriate settings for that environment.

# Answer
> 0 votes
I use a custom `config.php` and one of the things I set up in mine (which it looks like the one you are using hasn't) is upload destinations:

```
// -------------------------------------
// Custom upload directory paths
// -------------------------------------

$env_config['upload_preferences'] = array(
    1 => array(
        'name'        => 'Images',
        'server_path' => $base_path . 'uploads/images/',
        'url'         => $base_url  . 'uploads/images/'
    ),
    2 => array(
        'name'        => 'Videos',
        'server_path' => $base_path . '/uploads/videos',
        'url'         => $base_url  . '/uploads/videos/'
    )
    // ...
);
```

**Note:** The array keys relate to the ID of the upload destination, which must be created via the control panel otherwise this will have no effect.

---
Tags: add-on, matrix, control-panel, multi-site-manager, thumbnails
---


# Question
Title: Expresso Store: When are member accounts created?
I have a new site coming online and looking at Store as it's worked well for me in the past. The client wants to have the following:

When clicking on Checkout, you log in, or guest checkout (with the option to create an account).

We would be using paypal website payments pro so the customer could pay by card on-site, or go off to paypal to pay via their paypal account.

So...

How does the Paypal flow work? Presumably if I login I get everything in my order history, but if I choose to create an account, and select Paypal as the checkout, what happens? Does store go off-site and then on return, create a new account, or does it create first and then go off-site? If it's the former, how does it handle the situation where an account already exists with the email address used?

Just need to make sure I'm completely clear on everything so I can advise the designers.

Thanks!

# Answer
> 4 votes
If you choose to create an account during checkout with Store, the customer's account is created when the order is "completed". That is, the account is created when the customer returns from PayPal (or any other off-site payment gateway).

Either way, if the `register_member` field is enabled/checked during checkout, the `order_email` field is validated to ensure it does not clash with any existing member accounts. This validation happens automatically, and only happens if `register_member` is enabled.

So, to answer your question: The situation where the customer already has an account will be handled before they are redirected to PayPal, but the account won't actually be created until payment is complete.

---
Tags: expresso-store
---


title: channel form not working on index

text:
# Question
Title: channel form not working on index
this is my form:

```
{exp:channel:form channel="contactform" return="contact/dank" include_jquery="no"  include_assets="no"}
<div class="span6">
    <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33"  name="firstname" id="firstname" placeholder="Name">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="lastname" id="lastname" placeholder="Surname">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="title" id="title" placeholder="Company">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="function" id="function" placeholder="Function">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="zip" id="zip" placeholder="Zip code">
        </div>
</div>
<div class="span6 last notopspace">
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="city" id="city" placeholder="City">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="country" id="country" placeholder="Country">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="email" id="email" placeholder="E-mail">
        </div>
        <div class="field mandatory">
            <input type="text" class="text-input mandatory" size="33" name="tel" id="tel" placeholder="Tel">
        </div>
</div>
<div class="span12">
            <textarea cols="78" rows="5" name="question" id="question" placeholder="Insert free text"></textarea>
            <div class="actionbuttons">
                <input type="submit" value="Submit" class="submit" id="formsubmit">
            </div>
</div>
{/exp:channel:form}

```

CHANNEL FORM SETTINGS: contactform\> allow guest posts: Yes

i include the form as a snippet and i had to disable jquery as it gave conflicts.

the forms works via /home or /contact, but not via index

# Answer
the action on the form points to http://syntetik.be/artilium-ee instead of http://syntetik.be/artilium-ee/ like the url
> 2 votes

---
Tags: channel-form
---


# Question
Title: What can I further do to test these Expresso Store hooks that appear to be not happening?
EE 2.7.2 Store 2.0.3

It doesn't look like the hook (store\_order\_recalculate\_end) is happening as advertised. Works fine when adding the first item to the cart. But upon cart update or adding more items, not happening.

Here is a dead simple test in my extension. (via template logging)

```
...
'hook' => 'store_order_recalculate_end',
'method' => 'barfoo',
...

public function barfoo(){

    $this->EE->load->library('Template', null, 'TMPL');
    $this->EE->TMPL->log_item("Hello World");

    }

```

What else can I be doing? Where should I be looking? This method definitely does not happen after the first item is added to the cart.

Thanks for the help.

# Answer
It looks like the hooks were running, but it was more a case of the logged messages not appearing.

Store uses the Post-Redirect-Get pattern, which means that the cart is updated (and hooks run) during an HTTP POST request. When the cart has finished updating (unless there were any errors), it redirects the customer's browser back to the checkout page using a GET request (this prevents them from accidentally resubmitting the form when hitting refresh etc).

Therefore in your case the messages logged in the template library were lost when the customer's browser was redirected, hence why they weren't displayed.
> 3 votes

---
Tags: expresso-store, hook
---


# Question
Title: Why can't I call {event_summary}, but I can call every other event property? (Solspace Calendar)
Here's my template file:

```
{embed="_includes/header"
    entry_title="{exp:channel:entries status="Open|Closed" channel="settings" disable="categories|category_fields|member_data|trackbacks"}{title}{/exp:channel:entries}"
    entry_id="{exp:channel:entries status="Open|Closed" disable="categories|category_fields|member_data|trackbacks"}{entry_id}{/exp:channel:entries}"}

{exp:channel:entries channel="events"}
<section id="page" class="{segment_2} {segment_3} standard {if page_has_long_menu}long-menu{/if}">
    <div class="bg-left"> </div>
    <div class="bg"> </div>

    <div class="wrapper">
        <header>
            <nav id="sub-menu">
                <!--{embed="navigations/{segment_2}"}-->
                {exp:structure:nav start_from="/en/{segment_2}/" max_depth="1" current_class="active"}
            </nav>

            <img src="{events_page_header}" alt="{events_page_title}" width="1020" height="240" />
            <h2>{events_page_title}</h2>
        </header>
    </div>

    <div class="content events-content">
        <div class="wrapper">
            {if title}<h2>{calendar_title}</h2>{/if}

            {calendar_description}

            <div class="calendar">
                <div id="events-cal">
                    {exp:calendar:mini
                        calendar_name="events"
                        enable="pagination"
                        date_range_start="2013-10-01"}
                    {/exp:calendar:mini}
                </div>

                <ul id="events-summaries">
                {exp:calendar:events}
                    <li>
                        {if event_all_day}
                            {event_start_date format="%F %j, %Y"}
                        {if:else}
                            {event_start_date format="%F %j, %Y"} - {event_end_date format="%F %j, %Y"}
                        {/if}
                        <br />
                        <a href="{path='calender/event'}/{event_id}/">
                            {event_title} ||
                        </a>
                        {event_id} ||
                        {event_author} ||
                        {event_summary}
                        <p>{location}</p>
                    </li>

                    {if no_results}
                    <li>No Results</li>
                    {/if}
                {/exp:calendar:events}
                </ul>
            </div>
        </div>
    </div>

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

{embed="_includes/footer"}

```

About 3/4 of the way down you can see me attempting to call {event\_title} and {event\_summary}, as per the documentation here.

And the output....

output http://puu.sh/4Teja.png

It doesn't output summary, **but it IS outputting title, ID, etc...**. Why can I call every property of the event BUT the summary?

Investigating further, I went into PHPMyAdmin, into the `exp_calendar_events` table -- and found out that there is no field for event summary.

Why is this? Is my installation bugged or am I missing something?

(I created `Test Event Numba One` by going `Content -> Publish -> Calender: Events` in the CMS)

# Answer
Any event data outside of the variables listed here is up to you to create via standard custom Channel fields.

So `{event_summary}` will only parse if you've created your own custom field called `event_summary`.

Also, side note - what you're doing at the top of your template is a little loopy - two Channel Entries calls just to get the title and entry id! At the very least you should disable `custom_fields` on those (as you're not using them) - but without knowing why they're there in the first place it's hard for me to advise a better way.
> 2 votes

---
Tags: solspace, solspace-calendar
---


title: Old ExpressionEngine builds

text:
# Question
Title: Old ExpressionEngine builds
Is there an official resource for downloading previous EE builds for add-on development/testing.

I have recently started archiving all versions of EE and add-ons that I install, however I have only started this recently (EE 2.7.0+). It would be awesome if there was somewhere I could access older versions of EE for supporting my add-ons, as well as making sure new add-ons are backwards compatible.

# Answer
> 2 votes
Try contacting EllisLab directly and ask them. I think they were in the process of finding some way to make older versions of the software available to licence holders.

---
Tags: add-on, add-on-development, meta
---


title: Version market share

text:
# Question
Title: Version market share
I don't know how one would track such things, but does something exist/can something be built that tracks an estimation of the market share for each version of EE?

The reason I ask, is that if such a resource existed it would be massively beneficial to add-on developers in making informed decisions when to stop supporting older EE builds.

# Answer
I don't recall seeing anything in EE core code that sent this data, but some of the larger add-on developers include stat tracking within their code that reports version numbers, etc. Possibly they may be willing to share the information, but that will only be a small selection and example of users who use that add-on, not EE in general.

The only reliable way would be if it was built into EE and sent anonymous stats back to Ellis Labs - but I doubt they'll want to share that data with the community.

So the only reliable way would be to include tracking in your add-on that regularly (e.g. once a month) when accessed (either frontend or control panel) triggered a cURL that posted data data to your website carrying that information (PHP version & EE version). As long as it was clearly stated in the T&Cs or documentation, or you offer it as turnable off in the settings (but then you won't be accurately tracking all your user base).
> 1 votes

---
Tags: add-on, add-on-development, meta
---


# Question
Title: Invalid EE Conditional when testing stash variable
In my stash partial, I have:

```
{!-- Custom Sidebar? --}
{if "{exp:stash:get name='custom_sidebar_text'}"}
  <section class="container">
    {if "{exp:stash:get name='custom_sidebar_title'}"}
      <h3>
        {exp:stash:get name='custom_sidebar_title'}
      </h3>
    {/if}
    {exp:stash:get name='custom_sidebar_text' random}
  </section>
{/if}
{!-- /Custom Sidebar --}

```

In my template I have this:

```
{embed="layouts/.landing_page"}
{exp:channel:entries}
  {exp:stash:set parse_tags="yes" parse_conditionals="yes"}
    {!-- Several other stash variables --}
    {stash:custom_sidebar_title}{custom_sidebar_title}{/stash:custom_sidebar_title}
    {stash:custom_sidebar_text}{custom_sidebar_text}{/stash:custom_sidebar_text}
  {/exp:stash:set}
{/exp:channel:entries}

```

I’m getting a warning saying:

> A PHP Error was encountered
> Severity: User Warning
> Message: Invalid EE
> Conditional Variable: {if "
> A PHP Error was encountered
> Severity: Warning
> Message: Cannot modify header information - headers already sent by (output started at /Users/agarzola/git/wfgc/system/codeigniter/system/core/Exceptions.php:170)
> Filename: core/Common.php
> Line Number: 412

If I remove the outermost conditional tags in the partial (`{if "{exp:stash:get name='custom_sidebar_text'}"}` and '{/if}'), the markup is rendered perfectly, with the stash variables parsed as expected.

**edited to add:** This only happens when the `custom_sidebar_text` field contains a link (generated via Wygwam in this case). Take away the link on the edit entry form, save the page, and the error goes away.

# Answer
> 1 votes
This is because the hyperlink in your stashed variable likely contains double quotes, which is also the delimiter you're using to contain the conditional. So you're basically saying:

```
{if "<p>Here is my test <a href="http://url.com">with a link</a>.</p>"}

```

As you can see, this will lead to problems due to unescaped quotes.

Instead, use `:not_empty` (docs).

```
{if {exp:stash:not_empty name="custom_sidebar_text"}}

```

---
Tags: stash, conditionals
---


# Question
Title: How do you pass a Matrix or Playa field to a Stash Embed?
This should be easy, but, I haven't been able to find an example anywhere.

I need to display {example\_matrix\_a} and {example\_matrix\_b} (both of which contain columns with the same names) via a Stash embed. I've tried the following, but, the Matrix fields aren't parsing. What step am I missing?

**templates/default\_site/example.group/layout\_example.html:**

```
{embed="wrappers/_interior"}

{exp:channel:entries limit="1"}
    {exp:stash:set name='title'}{title}{/exp:stash:set}
    {exp:stash:set name='maincontent'}
      {stash:embed:matrix_markup
        stash:matrix_field = "{example_matrix_a}"
        process="start"
      }
      {stash:embed:matrix_markup
        stash:matrix_field = "{example_matrix_b}"
        process="start"
      }

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

```

**stash\_templates/matrix\_markup.html**

```
{stash:matrix_field}
   {matrix_col_1} - {matrix_col_2}<br>
{/stash:matrix_field}

```

# Answer
Here's another solution, per suggestions via Twitter by Stash's author:

**templates/default\_site/example.group/layout\_example.html:**

```
{embed="wrappers/_interior"}

{exp:channel:entries limit="1"}
    {exp:stash:set name='title'}{title}{/exp:stash:set}
    {exp:stash:set name='maincontent'}
      {stash:embed:matrix_markup
        stash:matrix_field = "example_matrix_a"
        process="start"
      }
      {stash:embed:matrix_markup
        stash:matrix_field = "example_matrix_b"
        process="start"
      }

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

```

**stash\_templates/matrix\_markup.html**

```
{{stash:matrix_field}}
   {matrix_col_1} - {matrix_col_2}<br>
{/{stash:matrix_field}}

```

This method (passing the name of the variable) works with Playa as well, and, I'd guess with just about any other field type that uses tag pairs.
> 1 votes

# Answer
First, check this out: https://github.com/croxton/Stash/wiki/%7Bexp%3Astash%3Aset\_list%7D#capturing-and-caching-playa--matrix-tag-pairs

Second, unless you're reusing the **matrix\_markup** Stash template, just keep it all together.

**templates/default\_site/example.group/layout\_example.html:**

```
{exp:channel:entries ...}
    {exp:stash:set_list name="matrix_a" parse_tags="yes" save="yes" scope="site"}
        {example_matrix_a}
            {stash:item_title}{title}{/stash:item_title}
            {!-- new stash tags for your columns --}
        {/example_matrix_a}
    {/exp:stash:set_list}

    {exp:stash:set name="title"}{title}{/exp:stash:set}
{/exp:channel:entries}

```

---

If, however, you are reusing the **matrix\_markup** template, then you can do this.

**templates/default\_site/example.group/layout\_example.html:**

```
{exp:channel:entries ...}
    {exp:stash:set_list name="matrix_a" parse_tags="yes" save="yes" scope="site"}
        {stash:embed:partials:matrix_markup process="both"} {!-- or process="end" --}
    {/exp:stash:set_list}

    {exp:stash:set name="title"}{title}{/exp:stash:set}
{/exp:channel:entries}

```

**stash\_templates/partials/matrix\_markup.html** ← NOTE THE ADDITION OF THE 'PARTIALS' DIRECTORY

```
{example_matrix_a}
  {stash:item_title}{title}{/stash:item_title}
  {!-- new stash tags for your columns --}
{/example_matrix_a}

```

The Stash embed is assuming you have your config setup properly.
> 1 votes

---
Tags: matrix, stash, embeds
---


# Question
Title: upgrading EE1 to EE2 but seeing new installation message
Just come across ExpressionEngine Answers, and am hoping you can set my mind at rest.

I'm just starting to upgrade an EE1.7.3 site to EE2.7.2 I've done the backup aand stages 1 to 6 of the Ellislabs procedure.

I've just run the admin.php \[I have updated the system directory name\] and it comes back with a 'click here to install a brand new copy of ExpressionEngine'

Is this the message I should expect, given I'm doing an update and not a brand new installation!

As you can imagine I really really don't want to go wrong at this stage!

BTW I've just spotted this question\- sadly no solution there either :-(

# Answer
> 1 votes
No, that is not the message you should expect.

You should see "Click here to update ExpressionEngine to Version \__."

What version of EE are you starting with?

Do you have a license entered into the system?

Also, if you have all of your original files and database backed up AND you're doing the upgrade on a copy of the live the site, you should have nothing to worry about.

---
Tags: upgrade, ee2-upgrades
---


# Question
Title: Low Variables & Grid outputting raw code
I'm working with the grid fieldtype for the first time and attempting to build out a home page slider the same way I would typically do with matrix and low variables.

I have triple checked cell names (and copy/pasted to template code) yet the slider is not displaying the images as expected. My code is here:

```
{exp:low_variables:pair var="lv-home-slider"}
  <img src="{slide}" alt="{caption}"/>
{/exp:low_variables:pair}

```

But on the front end it outputs the following.

```
<img src="{slide}" alt="{caption}" >

<img src="{slide}" alt="{caption}" >

```

I've tried setting this variable to early parsing which as expected didn't change a thing. Have attached a screenshot of the grid settings in Low Variables.

# Answer
> 6 votes
The variables inside the field need to be prefixed with the Grid variable name, like this:

```
{lv-home-slider:slide}
{lv-home-slider:caption}

```

---
Tags: low-variables, grid, template-scripting
---


# Question
Title: Problem using Stash in conditional structure
I posted this in the Stash support forum on Devot-ee, but there's more activity over here so I thought I'd try my luck in both locations. Not sure about the etiquette of posting in two forums, so apologies if it bends any noses. Here's my situation:

I have a site in which the user can turn various sections (Books, Screenwriting, News, Events etc) on or off depending on whether they are relevant to them. Whether a specific section is on or off is recorded in a Global Variable—eg. **gv\_include\_books\_section** (value=\[y/n\]).

On the homepage I have a few columns, each of which I want to display recent entries from one section or another. The catch of course is that I don’t know in advance which sections will be on or off, AND I don’t want to use entries from the same section in more than one column. My solution is to only show entries from a section if a) it is switched ‘on’ AND b) it hasn’t been used earlier in the template. (a) is easy to check as it’s already stored in a Global Variable, and I’m using Stash to set a flag to record whether a specific section has already been shown.

I’m also using IfElse since these conditionals necessarily consist of if/else chains (Switchee got too complex as all the branchings required multiple nested Switchee tags). As far as I can see the code I have should work, but it doesn’t. I presume the issue is parse order but I'm unsure how to rectify it.

In addition to the template code; the global variables in play are:

```
gv_include_books_section = “n”
gv_include_screenwriting_section = “y”
gv_include_journalism_section = “y”

```

The template code is:

```
{exp:stash:set_value name="books_used" value="0" type="snippet"}
{exp:stash:set_value name="screen_used" value="0" type="snippet"}
{exp:stash:set_value name="journalism_used" value="0" type="snippet"}

{!-- column_1 --}
{exp:ifelse parse="inward"}
    {if gv_include_books_section == "y"}
        {exp:stash:set_value name="books_used" value="1" type="snippet" replace="yes"}
        {snp_home_books}
    {if:elseif gv_include_screenwriting_section == "y"}
        {exp:stash:set_value name="screen_used" value="1" type="snippet" replace="yes"}
        {snp_home_screen}
    {if:else}
        <section>Oops</section>
    {/if}
{/exp:ifelse}

{!--  columm-2 --}
{exp:ifelse parse="inward"}
    {if gv_include_screenwriting_section == "y" && screen_used == "0"}
        {exp:stash:set_value name="screen_used" value="1" type="snippet" replace="yes"}
        {snp_home_screen}
    {if:elseif gv_include_journalism_section == "y" && journalism_used == "0"}
        {exp:stash:set_value name="journalism_used" value="1" type="snippet" replace="yes"}
        {snp_home_journo}
    {if:else}
        <section>Oops</section>
    {/if}
{/exp:ifelse}

```

By my reckoning column\_1 should display content from the screenwriting section (because the Books section is turned off), and column\_2 should show the journalism section (because the Screenwriting section has already been used in Column 1). What’s actually happening, however, is that both columns are showing screenwriting content.

Um… help please? Thanks.

# Answer
> 1 votes
I'm no Mark Croxton, but I'd bet this has to do with the parsing order of the Stash variable you are setting inside the column 1 advanced conditionals. You need to make sure that column 2 isn't parsed until column 1 is fully parsed, so that those variables are set prior to column 2's IfElse running. In my understanding, the best way to do that would be make column 2 a Stash embed set to `process="end"`.

Try this:

```
{!-- column_1 --}
{exp:ifelse parse="inward"}
    {if gv_include_books_section == "y"}
        {exp:stash:set_value name="books_used" value="1" type="snippet" replace="yes"}
        {snp_home_books}
    {if:elseif gv_include_screenwriting_section == "y"}
        {exp:stash:set_value name="screen_used" value="1" type="snippet" replace="yes"}
        {snp_home_screen}
    {if:else}
        <section>Oops</section>
    {/if}
{/exp:ifelse}

{stash:embed:partials:column_2 process="end"}

```

Then, in your (newly created) **/stash\_templates/partials/column\_2.html** file:

```
{!--  columm-2 --}
{exp:ifelse parse="inward"}
    {if gv_include_screenwriting_section == "y" && screen_used == "0"}
        {exp:stash:set_value name="screen_used" value="1" type="snippet" replace="yes"}
        {snp_home_screen}
    {if:elseif gv_include_journalism_section == "y" && journalism_used == "0"}
        {exp:stash:set_value name="journalism_used" value="1" type="snippet" replace="yes"}
        {snp_home_journo}
    {if:else}
        <section>Oops</section>
    {/if}
{/exp:ifelse}

```

I haven't tested that, but that's where I'd begin.

---
Tags: stash, advanced-conditionals
---


# Question
Title: Database Error Occurred Error Number: 1146
I’m working on a new site, using a fresh install of 2.7.2. Everything’s been going swimmingly (sort of), until now I went to edit some custom fields. When I click on a field name to do an edit, I get the following:

> A Database Error Occurred Error Number: 1146 Table 'my\_database\_name.exp\_grid\_columns' doesn't exist
>
> SELECT * FROM (`exp_grid_columns`) WHERE `field_id` IN (11) AND `content_type` = 'channel' ORDER BY `col_order` Filename: models/grid\_model.php
>
> Line Number: 631

Using phpmyadmin, I see that there is in fact no “exp\_grid\_columns” table in the database. So what does that mean? Should I just create a table with that name? Not actually sure what’s involved with that….

I saw a bunch of 1146 error codes relating to the Comment module in the EE Forums, but this doesn’t seem to have anything to do with that (I even tried installing the Comment module).

I’m not really a MySQL person, so I’m not sure where to go from here. Any ideas?

Thanks in advance!

# Answer
> 1 votes
You should have that table in your database. Here's what it should look like.

\[image removed by user\]

You may need to (re)install the Grid fieldtype under Add-ons \> Fiedtypes. If it's already installed, uninstall it and install it again.

**Update**

In your database, check the `exp_fieldtypes` table. If you have a row for `grid`, delete it. Delete the new `exp_grid_columns` table you tried to manually add.

---
Tags: error, database, grid
---


title: safecracker file field_type download

text:
# Question
Title: safecracker file field_type download
It seems is no longer available for download? Since I have EE 2.7 installed I'm limited to using the FILE fieldtype, which doesn't seem to work when I try to upload a file logged in as a member of the "Guest" Membergroup. Anybody with similar experience?

# Answer
> 2 votes
Safecracker (and Safecracker File fieldtype) is deprecated for EE 2.7+. Read about it here: http://ellislab.com/blog/entry/expressionengine-2.7.0-released

You have to use the native File fieldtype (instead of Safecracker File fieldtype) with the new native Channel Form module.

Then, you need to make sure your Guest member group has permission to post/edit in the channel you are trying to upload files to. Members \> Member Groups \> Edit Group (select your group) \> Channel Assignment

---
Tags: safecracker, ee2-upgrades, safecracker-file
---


# Question
Title: Member group can´t edit comments in CP, but has rights to do so in EE 2.7.0
I set up a member group called editors. Editors can

1. log in to the CP
2. See the link "Pending comments" in the box "Modify or delete".

When an Editor clicks on this link he´ll get a message, saying, that he has no rights to visit the comments section in order to moderate comments. But they should have those rights and I have set up the member group to refelct that.

I set the member group permissions as such:

**Comment Posting Privileges**

Can submit comments Yes
Exclude member from comment moderation No

**Control Panel Access Preferences**

Can access the control panel? Yes
Can access CONTENT section Yes
Can access CONTENT: Publish Yes
Can access CONTENT: Edit Yes
Can access CONTENT: File Manager Yes

**Comment Administration**

Can Moderate Comments Yes
Can view comments in channel entries authored by others Yes
Can edit comments in their own channel entries Yes
Can delete comments in their own channel entries Yes
Can edit comments in ANY channel entries Yes
Can delete comments in ANY channel entries Yes

**Module Access Privileges Preferences**

Can access module: Comment Yes

To me this looks all good. I also included the Editors in the PUBLISH page multi-author list?

What did I miss?

# Answer
You also need these...

**Control Panel Access Preferences**

* Can access ADD-ONS section: Yes
* Can access ADD-ONS: Modules: Yes
> 1 votes

---
Tags: control-panel, comments, member-management, administration
---


title: EE comments stopped working

text:
# Question
Title: EE comments stopped working
Using EE 2.5.2

I'm not aware of any changes that I would have caused this, however, I'm getting a javascript error.

```
Resource interpreted as Script but transferred with MIME type text/html: "mysite.com/?ACT=comment_editor". mypage:59
Uncaught TypeError: Object [object Object] has no method 'CommentEditor'

```

My comment fields are being rendered in the source code (with the correct brackets of course):

```
[script type="text/javascript" charset="utf-8" src="http://mysite.com/?ACT=jquery"][/script]
[script type="text/javascript" charset="utf-8" src="http://mysite.com/?ACT=comment_editor">[/script]

```

Any thoughts?

# Answer
What if you just drop the `type` parameter?

```
<script src="http://mysite.com/?ACT=jquery"></script>
<script src="http://mysite.com/?ACT=comment_editor"></script>

```
> 1 votes

---
Tags: error, javascript, comments
---


title: 404 on Every Template and TPL group

text:
# Question
Title: 404 on Every Template and TPL group
Trying to setup a sub-directory with a separate EE installation. All is well with the installation, I got a few templates and tpl groups setup.

Whenever I try and view the template (Template manager -\> TPL Group -\> view) I always get a 404.

For a better understanding here is my site: http://warpedcoders.com/ here is the subdomain: http://warpedcoders.com/charlie/ and here is the 404 http://warpedcoders.com/charlie/news/page\_content

My .htaccess currently looks like so:

```
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /charlie/
        # Removes index.php from ExpressionEngine URLs
        RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ $1 [L]
</IfModule>

```

Could anybody help me out?

# Answer
> 3 votes
It looks like your 404'd page works with index.php: http://warpedcoders.com/charlie/index.php/news/page\_content

So, try this for your .htaccess rewrite:

```
<IfModule mod_rewrite.c>
  Options +FollowSymlinks
  RewriteEngine On

  ## Removes index.php
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  # RewriteRule ^(.*)$ /index.php?$1 [L]
  # IF YOU HAVE WEBSITE IN A SUB FOLDER: comment out above line, uncomment below line, & replace 'SUBFOLDERNAME'
  RewriteRule ^(.*)$ /charlie/index.php/$1 [L]
</IfModule>

```

And make sure your **/expressionengine/config/config.php** file has this for your Index File setting:

```
$config['index_page'] = "";

```

---
Tags: ee2, htaccess, 404
---


# Question
Title: Edit a Channel Form with super admin as author
After upgrading to EE 2.7.1 ...

I can't edit any channel entries that have the Super Admin as the author, and get this error "The selected author is invalid." (am logged in as a non-super member).

Only happens when using the Channel Form (used to be Safecracker), it's OK in the CP.

All my settings are correct e.g. "Can edit entries authored by others".

# Answer
Pre-2.7, with Safecracker, you were able to go to the Safecracker settings via Add-ons \> Modules \> Safecracker

It doesn't appear you can do this with the new Form element of the Channel module. I'd hit up EE support directly for this.
> 1 votes

---
Tags: safecracker, channel-form
---


# Question
Title: Categories - Hiding Children based on login
Lets say I have The Parent Category which is GEORGE. George has 2 child categories Susie and Mike. If the user is on the website and is not logged in, they should only see Susie. If they are logged in they should see Mike and Susie. Problem.

GEORGE has to be selected to see Mike and Susie inside the same channel, how do we exclude Mike if the user is not logged in.

What I have tried.

```
{if member_group == "10"}
  {exp:channel:entries channel="products" dynamic="yes"}
    {if last_segment == "Mike" }
      {redirect="products"}
    {if:else}

```

Which works, but if im not logged in and are on Susies directory I see the product from Mike, I realize segmenting will not work for this particular issue. That the content needs to be filtered. Any suggestions.

# Answer
> 1 votes
Cam, you've not provided a lot of detail, but, hopefully, this will help get you in the right direction. If you provide more info, we can guide you better.

```
{if logged_out}
  {exp:channel:entries channel="products" category="not 2"}
{/if}
{if logged_in}
  {exp:channel:entries channel="products"}
{/if}

```

---
Tags: categories, content
---


# Question
Title: Wygwam upload directory to with MSM problems
I have a site that seems to be having problems with the Wygwam upload directory. It is a MSM site so there are about 4 sites total. Each site has it's own upload directory on the server.

The problem is when I change the upload directory on one site it changes the main sites upload directory. This is the first time that I have ran into this problem. Has anyone else ran into this problem? Also how do I fix it?

The version of Expression Engine for the site is 2.5.2 and the Wygwam version is 2.7.

# Answer
> 1 votes
When you say, "when I change the upload directory on one site it changes the main site's upload directory," are you referring to the upload directory setting in the Wygwam editor configurations (see image)?

If so, you should then just **create a unique editor configuration for each site** so that you can assign a different upload directory for each.

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