# Question
Title: Stash set_list not displaying channel entry loop
I'm having trouble displaying a channel entry loop within my EE setup which uses the Stash and IfElse modules. First of all, see this screenshot of my file structure:

I'm using the 'partials approach' (heavily based on this article) and therefore have an index.html file which handles my routing.

**index.html:**

```
{!-- If we're on one of the main support pages --}
{if segment_2!="" AND segment_3==""}
{embed="support/main-landing"}

{!-- If we're on one of the Financial Support sub-pages --}
{if:elseif segment_2=="financial-support" AND segment_3!=""}
{embed="support/main-detail"}

{/if}

```

So if we look at the main-landing template file, you can see that I'm specifying the stash layout file to use and also setting some variables - one for the actual landing page itself and the other for the loop I am having trouble displaying.

**main-landing.html:**

```
{stash:embed:layouts:support-main-landing}

{!-- Set data for the landing page --}
    {exp:channel:entries channel="support" url_title="{segment_3}"}
        {exp:stash:set}
            {stash:url_title}{url_title}{/stash:url_title}
            {stash:title}{title}{/stash:title}
            {stash:page_content}{page_content}{/stash:page_content}
        {/exp:stash:set}
    {/exp:channel:entries}

      {!-- Set data for the financial support sub-pages --}
      {exp:stash:set_list name="financial_support_options" parse_tags="yes"}
      {exp:channel:entries channel="financial_support"}
                {stash:financial_url_title}{url_title}{/stash:financial_url_title}
                {stash:financial_title}{title}{/stash:financial_title}
                {stash:financial_page_content}{page_content}{/stash:financial_page_content}
                {stash:financial_summary}{summary}{/stash:financial_summary}
     {/exp:channel:entries}
     {/exp:stash:set_list}

```

The following layout file then gets the loop that we just set, using `get_list`.

**support-main-landing.html:**

```
{stash:embed:wrappers:main} {!-- Select the main wrapper template --}

{exp:stash:set name="content"} {!-- Set everything in between here as the content --}
    {stash:embed:partials:breadcrumb}
    <div class="efc internal main-content">
        <div class="container entry">
            <div class="col-md-8">
                <h4>{exp:stash:get name='title'}</h4>
                <div class="row financial-options">
                    {exp:stash:get_list name="financial_support_options"}
                        <div class="col-md-6">
                            <p><strong><a href="financial-support/{financial_url_title}">{financial_title}</a></strong></p>
                            <p>{financial_summary}</p>
                        </div>
                    {/exp:stash:get_list}
                </div>
            </div>
            <div class="col-md-4">
                {!-- If we're on the Financial Support page, show it's unique sidebar --}
                {if segment_2=="financial-support"}
                    {stash:embed:content:sidebar-financial-support}
                {/if}
            </div>
        </div>
    </div>
{/exp:stash:set}

```

**The Problem:**

Everything seems to be working except for the loop `financial_support_options`. When the page is rendered, it manages to display the surrounding `<div class="row financial-options">` but no data inside...so the problem must lie where I am actually setting the loop variable in **main-landing.html**.

FYI - The financial-support channel and support channel both use the same Channel Field Group

Do you absolutely HAVE to set the tags as stash variables in order to use them within the layout files in the stash folder?

Any help will be greatly appreciated!

# Answer
Are you sure your channel entries tag is actually outputting anything for Stash to capture? I would suggest adding `dynamic="no"`

```
{exp:stash:set_list name="financial_support_options" parse_tags="yes"}
    {exp:channel:entries channel="financial_support" dynamic="no"}
        {stash:financial_url_title}{url_title}{/stash:financial_url_title}
        {stash:financial_title}{title}{/stash:financial_title}
        {stash:financial_page_content}{page_content}{/stash:financial_page_content}
        {stash:financial_summary}{summary}{/stash:financial_summary}
     {/exp:channel:entries}
 {/exp:stash:set_list}

```

If you turn on the Template Debugger you will be able to see lines beginning `Stash:` Look for the variable `financial_support_options` in the debug output to see what value Stash says it is set to.

Besides that advice, I'd question why you need to split `main-landing` and `support-main-landing.html` into two files? Are you using `support-main-landing.html` elsewhere? If not, why not make them one to simplify things?

```
{stash:embed:wrappers:main}

{!-- Set data for the landing page --}
{exp:channel:entries channel="support" url_title="{segment_3}"}
    {exp:stash:set}
        {stash:url_title}{url_title}{/stash:url_title}
        {stash:title}{title}{/stash:title}
        {stash:page_content}{page_content}{/stash:page_content}
    {/exp:stash:set}
{/exp:channel:entries}

{!-- Set data for the financial support sub-pages --}
{exp:stash:set_list name="financial_support_options" parse_tags="yes"}
     {exp:channel:entries channel="financial_support" dynamic="no"}
         {stash:financial_url_title}{url_title} {/stash:financial_url_title}
         {stash:financial_title}{title}{/stash:financial_title}
         {stash:financial_page_content}{page_content}{/stash:financial_page_content}
         {stash:financial_summary}{summary}{/stash:financial_summary}
     {/exp:channel:entries}
{/exp:stash:set_list}

{!-- Set everything in between here as the content --}
{exp:stash:set name="content"}
{snippet:breadcrumb}
<div class="efc internal main-content">
    <div class="container entry">
        <div class="col-md-8">
            <h4>{exp:stash:get name='title'}</h4>
            <div class="row financial-options">
                {exp:stash:get_list name="financial_support_options"}
                    <div class="col-md-6">
                        <p><strong><a href="financial-support/{financial_url_title}">{financial_title}</a></strong></p>
                        <p>{financial_summary}</p>
                    </div>
                {/exp:stash:get_list}
            </div>
        </div>
        <div class="col-md-4">
            {!-- If we're on the Financial Support page, show it's unique sidebar --}
            {if segment_2=="financial-support"}
                {stash:embed:content:sidebar-financial-support}
            {/if}
        </div>
    </div>
</div>
{/exp:stash:set}

```
> 1 votes

# Answer
In **main-landing.html** wrap the stash:set pair around the entries tag pair.

```
{stash:embed:layouts:support-main-landing}

{!-- Set data for the landing page --}
{exp:stash:set parse_tags="yes"}
    {exp:channel:entries channel="support" url_title="{segment_3}"}
        {stash:url_title}{url_title}{/stash:url_title}
        {stash:title}{title}{/stash:title}
        {stash:page_content}{page_content}{/stash:page_content}
    {/exp:channel:entries}
{/exp:stash:set}

```
> 2 votes

---
Tags: channel-entries, templates, stash, channel, ifelse
---


# Question
Title: Related_categories_mode="yes" outputs all channel entires and isn't related to current entry
We're build a shop and want to output similar products using categories, everything is now working apart from the related products. It's currently just outputting the latest 5 products that have been added, they don't belong to the same category at all so i'm pretty confused as to why this would happen? We have the following code:

```
{exp:channel:entries related_categories_mode="yes" custom_fields="yes" limit="5"}
{if count == 1}
<div class="related-products">
  <h2>Related products</h2>
  <ul class="product-list">
{/if}
  <li>
    <article>
      <a href="/products/{url_title}">
        <span class="product-image">
          {product_image limit="1"}
            <img src="{image:medium}" alt="{title}" height="" width="" />
          {/product_image}
        </span>
        <span class="product-text">
          <h3>{title}</h3>
            {exp:store:product entry_id="{entry_id}" disable_form="yes" disable_javascript="yes"}
            {if on_sale}
              <div class="sale-label">Sale</div>
              {price}
              {if:else}
              {regular_price}
              {/if}
            {/exp:store:product}
        </span>
      </a>
    </article>
  </li>
  {if count == total_results}
    </ul>
  </div>
  {/if}
{/exp:channel:entries}

```

I've tried using dynamic="no" and url\_title="{segment\_2}" together but this brings up the no matches, any ideas would be appreciated.

# Answer
Turns out all products belongs to a tax category so it was thinking everything was related, had to disable that category from the output then all was fine!
> 1 votes

# Answer
You may need to add the `channel=""` parameter to your channel:entries tag.
> 2 votes

---
Tags: categories, related-entries
---


title: entry_submission_ready Hook Not Working

text:
# Question
Title: entry_submission_ready Hook Not Working
I have created an extension to manipulate saved data when an entry is saved. I can't get this to work using entry\_submission hooks, I cannot find that much information about this online. I believe I need to use entry\_submission\_ready.

Does anyone know why this does not work when I save an entry?

```
function entry_submission_ready($entry_id, $meta, $data)
{
    $data['field_id_123'] = 'Test';

    if(isset($this->EE->api_sc_channel_entries))
    {
        $this->EE->api_sc_channel_entries->data = $data;
    }
    else
    {
        $this->EE->api_channel_entries->data = $data;
    }
}

```

The hook IS being called because I can output $data to the screen (print\_r) and can see the value of the field I have set in the $data array. But this is not saved to the entry.

I have also tried $this-\>EE-\>api\_channel\_entries-\>data\['revision\_post'\] and entry\_submission\_ready. None work.

EE 2.7.2

Thanks

# Answer
I got it working.... silly, silly, silly me....

Initially I used entry\_submission\_end($entry\_id, $meta, $data), but realised I needed entry\_submission\_ready.

I overlooked the fact entry\_submission\_ready uses different arguments, its ($meta, $data, $autosave) and not ($entry\_id, $meta, $data)!

Now it works fine with the correct arguments. RTFM!
> 5 votes

---
Tags: hook
---


# Question
Title: I can log in to CP locally, but not on staging server? White screen of death
I've been chasing this for a full 8 hours now.

I'm using the Focus Lab Master Config.

All files on the front end - both locally and on my staging server - display perfectly fine.

I *can* log into CP locally.

I \*cannot log into CP on staging. I get the white screen of death.

I turned on debugging. When I access the CP, I get this error:

```
A Database Error Occurred Error
Number: 1054
Unknown column 'session_id' in 'field list'
INSERT INTO exp_security_hashes (date, hash, session_id) VALUES (1375809948,'fa2ebb013799a26b30d4acb1964d3156111bb5ff',0) Filename: core/EE_Security.php Line Number: 158

```

I've attempted as many solutions as I could dig up from Google. Does anything in this particular situation stand out as being the most likely culprit?

# Answer
> 2 votes
The error "Unknown column 'session\_id'" points to the session\_id column not being present in the "exp\_security\_hashes" table on your production server... Why it's missing is not clear to me but should be an easy fix.

First, compare the tables on both servers to see what's different.

Do you see the session\_id column in the exp\_security\_hashes table on production? If you do see it, I'd guess the exp\_security\_hashes table has crashed and needs to be repaired. You can run the repair in phpmyadmin or your DB tool of choice.

If you don't see the session\_id column in the exp\_security\_hashes table, you'll need to add it... Best way to do that is to export the table from your local DB, delete the table from production and import the sql to recreate the table... Or you can manually create it to match your local DB.

**NOTE: BACKUP YOUR PRODUCTION DATABASE before you start making changes.**

EDIT: **This SE answer has the SQL you can run to create the column in the DB**.

---
Tags: control-panel
---


title: Expresion Engine 1.X jquery

text:
# Question
Title: Expresion Engine 1.X jquery
I hoping someone has some experience with EE 1. I recently had to apply a secure cert to secure a site, front end and back end. Everything's fine, but EE is loading 2 jQuery files over http. The client is getting a message asking them if they want to load insecure elements on this page. Everything is fine when they click ok to this, but they'd rather not have to do it every time they want to update something. Does anybody know where EE 1 loads the files below? There at the top of the page if you view source on a control panel page.

script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"

script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/jquery-ui.min.js"

Thanks,

# Answer
Correct, just make the jQuery settings in the extension area to be a relative protocol:

```
//ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js

```
> 3 votes

---
Tags: ee1, jquery, ssl
---


title: Solspace Calendar out of range dates

text:
# Question
Title: Solspace Calendar out of range dates
I am using Solspace Calendar. I would like to know how to hide the out of range dates (last month and next month day cells) and only display the current month dates.

# Answer
> 1 votes
If you're using `date_range_start="year-month-01" date_range_end="year-month-last"` (to cover all days of the current month, for example), add **`pad_short_weeks="n"`** to avoid Calendar from including extra days part of a full week row. More details on this can be found here:

http://www.solspace.com/docs/calendar/calendar/#pad\_short\_weeks

Of course, this is for the `{exp:calendar:cal}` tag **only**.

---
Tags: solspace-calendar
---


title: Carthrob and Inventory Management

text:
# Question
Title: Carthrob and Inventory Management
hoping someone can help!

The site I am working on is for a performing arts dance and music studio where users can register online for classes by semester or quarter (two avail at a time).

I'm having some trouble wrapping my head around how I could make inventory work for their dance and drama classes. Classes are offered and available to sign up for by Semester or Quarter. What I need is for the inventory to adjust automatically according to what the user signed up for. So if they sign up for the whole semester, I need to make sure the inventory under quarter 1 and 2 both get deducted. That way if someone signs up for just one of the quarters, the class won't get over filled when a full semester is registered for. Likewise, the inventory will need to get deducted from the full semester sign-up option if one of the quarters is registered for (so that specific quarter, and the whole semester needs to get reduced by 1). But the other quarter available will still have a spot. Does that make sense?

If I can't get this to work right, I'm afraid it might be too big of a pain for my client to manage all these classes and will be more work than necessary - also could be tough to manually track the inventory for all their classes. Any insight or ideas into this greatly appreciated!

FWIW, I'm not a php programer by any means, but can work with basic existing scripts. I also have an intermediate knowledge and understanding of jquery and javascript if that might need to get used as a solution, however I can't and don't write my own scripts.

Thanks in advance! Valerie

# Answer
> 1 votes
I'd have each Semester (Quarter) as separate products, then use the multi add to cart tag so customer can select which ones they want to purchase.

---
Tags: cartthrob
---


# Question
Title: Counting the number of Parents related to a child entry
I am using the example Relationships code which works but what I would like to do instead of showing the names of the Pizza shops is just show how many shops the Pizza is available at.

```
{exp:channel:entries channel="pizzas"}
    <h2>{title}</h2>
    <p>{description}</p>
    <p>{ingredients}</p>
    <h3>Where can I find this pizza?</h3>
    {parents field="specialty_pizzas"}
            <strong>{parents:title}</strong>: <br />
            {parents:phone} <br />
            <p>{parents:address}</p>
    {/parents}

```

{/exp:channel:entries}

I have tried this, but it does not appear to work, any hints?

```
{exp:channel:entries channel="pizzas"}
    <h2>{title}</h2>
    <p>{description}</p>
    <p>{ingredients}</p>
    <h3>How many restaurants serve this pizza?</h3>
    {parents field="specialty_pizzas"}
            {parents:speciality_pizzas:total_results}
    {/parents}

```

{/exp:channel:entries}

# Answer
Try this...

```
{parents field="specialty_pizzas"}
{if parents:count == "1"}{parents:total_results}{/if}
{/parents}

```
> 3 votes

---
Tags: relationships
---


title: Updating from 1.6.8 to 2.7.2

text:
# Question
Title: Updating from 1.6.8 to 2.7.2
Does anyone have any experience updating EE with this big of a jump between versions? I need to update a huge website to 2.7.2 so that I can upgrade to PHP 5.3 on the hosting server. Being that it's such a big site and I don't really have any EE experience, I'm a bit gun shy. I've read and re-read the instructions for making a version update, and they do seem pretty straightforward. There aren't any add-ons that I need to worry about at least. Would trying this out on a local server first be an unnecessary hassle? Should I just make all my back ups and go for it?

# Answer
I agree with the above, my method goes like this:

1. Copy the site and database to a development environment, you can use your own computer running MAMP/WAMP, use a subdomain on the existing hosting account, or even an unused hosting account
2. Take a backup of site and database, you can usually do this via the hosting control panel
3. Upgrade EE1 addons/extensions/plugins to latest available
4. Upgrade EE to 1.7.1 and check it all works as expected
5. Take another backup
6. Download latest EE2, and all the addons you need to replace via Devot-ee.com, extract files ready to upload
7. Rename your /system /themes folders to /systemOLD and /themesOLD
8. Upload the EE2 /system and /themes folders, and also the /images folder
9. Upload addon files as per their instructions
10. Run the EE2 installer and follow the on screen instructions
11. When the installer is done login to the control panel and install addons
12. Check your new EE2 site out, depending what you had on the old site you may need to adjust some template tags or tweak to get working again - often some addons require template tweaks.
> 1 votes

# Answer
First you should update to EE 1.7.1 which would be updated to 2.7.2 without any problem.
> 0 votes

---
Tags: updating, 2.7.1, backup, 1.x
---


# Question
Title: Expression Engine (2.6.x) Email Form - Email missing certain fields
Creating a form for our a client and its refusing to send certain fields to the recipient. Consistently, (as of now) this includes: Name, Company and Email. Everything else sends.

Also, how does one have form validation in EE? I put name="required\[\]" and it didn't affect or change anything. Granted, I didn't have an initial name="required" without the "\[\]". So that perhaps screwed that up.

So what exactly is the problem here? Below is the code followed by the email:

```
  <div id="contactForm" class="appnitro">
  {exp:email:contact_form user_recipients="no" recipients="fakeemail@gmail.com" charset="utf-8"}
           <div class="form_description"></div>
     <ul >
  <li id="li_1" >
  <label class="description" for="element_1">Name </label>
  <span>
     <input id="element_1_1" name="name" class="element text" maxlength="255" size="25" value=""/>
  </span>
  <span>
  </span><p class="guidelines" id="guide_1"><small>Please provide your name.</small></p>
  </li>    <li id="li_2" >
  <label class="description" for="element_2">Company </label>
  <div>
     <input id="element_2" name="message" class="element text medium" type="text" maxlength="255" value=""/>
  </div><p class="guidelines" id="guide_2"><small>Please provide your company.</small></p>
  </li>    <li id="li_3" >
  <label class="description" for="element_3">Title </label>
  <div>
     <input id="element_3" name="message[]" class="element text medium" type="text" maxlength="255" value=""/>
  </div><p class="guidelines" id="guide_3"><small>Please provide your title. </small></p>
  </li>    <li id="li_5" >
  <label class="description" for="element_5">Email </label>
  <div>
     <input id="element_5" name="from" class="element text medium" type="text" maxlength="255" value=""/>
  </div><p class="guidelines" id="guide_5"><small>Please provide your email.</small></p>
  </li>    <li id="li_4" >
  <label class="description" for="element_4">Phone </label>
  <span>
     <input id="element_4_1" name="message[]" class="element text" size="3" maxlength="3" value="" type="text"> -
     <br>
     <label for="element_4_1">(###)</label>
  </span>
  <span>
     <input id="element_4_2" name="message[]" class="element text" size="3" maxlength="3" value="" type="text"> -
     <br>
     <label for="element_4_2">###</label>
  </span>
  <span>
     <input id="element_4_3" name="message[]" class="element text" size="4" maxlength="4" value="" type="text">
     <br>
     <label for="element_4_3">####</label>
  </span>
  <p class="guidelines" id="guide_4"><small>Please enter in your phone number with area code.</small></p>
  </li>    <li id="li_6" >
  <label class="description" for="element_6">Contact Preference </label>
  <span>
     <input id="element_6_1" name="message[]" class="element radio" type="radio" value="Email" />
     <label class="choice" for="element_6_1">Email</label>
     <input id="element_6_2" name="message[]" class="element radio" type="radio" value="Phone" />
     <label class="choice" for="element_6_2">Phone</label>

  </span><p class="guidelines" id="guide_6"><small>Please select your preference to be reached.</small></p>
  </li>    <li id="li_7" >
  <label class="description" for="element_7">Your Industry </label>
  <div>
  <select class="element select medium" id="element_7" name="message[]">
     <option value="" selected="selected"></option>
     <option value="Advertising and Marketing" >Advertising and Marketing</option>
     <option value="Airline" >Airline</option>
     <option value="Automotive" >Automotive</option>
     <option value="Catalog" >Catalog</option>
     <option value="Communications" >Communications</option>
     <option value="Consumer Package Goods" >Consumer Package Goods</option>
     <option value="Education" >Education</option>
     <option value="Energy" >Energy</option>
     <option value="Entertainment and Gaming" >Entertainment and Gaming</option>
     <option value="Financial Services" >Financial Services</option>
     <option value="Government" >Government</option>
     <option value="Healthcare/Pharma" >Healthcare/Pharma</option>
     <option value="Hospitality" >Hospitality</option>
     <option value="Insurance" >Insurance</option>
     <option value="Media" >Media</option>
     <option value="Non-Profit" >Non-Profit</option>
     <option value="Publishing" >Publishing</option>
     <option value="Real Estate" >Real Estate</option>
     <option value="Restaurants" >Restaurants</option>
     <option value="Retail and Catalog" >Retail and Catalog</option>
     <option value="Technology" >Technology</option>
     <option value="Telecommunications" >Telecommunications</option>
     <option value="Travel" >Travel</option>
     <option value="Utilities" >Utilities</option>
     <option value="Other" >Other</option>
  </select>
  </div><p class="guidelines" id="guide_7"><small>Please select your industry.</small></p>
  </li>    <li id="li_8" >
  <label class="description" for="element_8">What Solutions are you interested in? (Please select all that apply.) </label>
  <span>
     <input id="element_8_1" name="message[]" class="element checkbox" type="checkbox" value="Marketing Database Solutions" />
     <label class="choice" for="element_8_1">Marketing Database Solutions</label>
     <input id="element_8_2" name="message[]" class="element checkbox" type="checkbox" value="Integrated Database and Email Marketing Solutions" />
     <label class="choice" for="element_8_2">Integrated Database and Email Marketing Solutions</label>
     <input id="element_8_3" name="message[]" class="element checkbox" type="checkbox" value="Real-Time Interactive Marketing" />
     <label class="choice" for="element_8_3">Real-Time Interactive Marketing</label>
     <input id="element_8_4" name="message[]" class="element checkbox" type="checkbox" value="Mobile Marketing" />
     <label class="choice" for="element_8_4">Mobile Marketing</label>
     <input id="element_8_5" name="message[]" class="element checkbox" type="checkbox" value="Analytics and Modeling" />
     <label class="choice" for="element_8_5">Analytics and Modeling</label>
     <input id="element_8_6" name="message[]" class="element checkbox" type="checkbox" value="Strategic MArketing Insight" />
     <label class="choice" for="element_8_6">Strategic MArketing Insight</label>
     <input id="element_8_7" name="message[]" class="element checkbox" type="checkbox" value="Business Intelligence" />
     <label class="choice" for="element_8_7">Business Intelligence</label>
     <input id="element_8_8" name="message[]" class="element checkbox" type="checkbox" value="Data- Decision Points National Consumer Database" />
     <label class="choice" for="element_8_8">Data- Decision Points National Consumer Database</label>
     <input id="element_8_9" name="message[]" class="element checkbox" type="checkbox" value="Campaign Execution" />
     <label class="choice" for="element_8_9">Campaign Execution</label>
  </span><p class="guidelines" id="guide_8"><small>Select all solutions which interest you.</small></p>
  </li>
  <li id="li_9" ><textarea name="message[]" rows="10" cols="80"></textarea><p class="guidelines" id="guide_9"><small>Please enter your message here.</small></p></li>
  <li class="buttons">
         <input type="hidden" name="form_id" value="720615" />
         <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" />
  </li>
     </ul>
  {/exp:email:contact_form}
  </div>

```

Email:

```
Lord Admiral
302
423
2342
Email
Automotive
Real-Time Interactive Marketing
Mobile Marketing
dasdasd

```

So, name and company are missing from the above and then so is email. I have no idea why and I'm on a time limit here because this was thrown at me at the last second due to fantastic internal management.

Any help would be greatly appreciated.

Edit: Switched to **Devdemon Forms**, though now I'm not getting any emails at all..

# Answer
> 1 votes
Although you switched forms I'll still post an answer as it may help someone else.

The "required" parameter is a bit misleading, it doesn't actually validate the field, to quote the docs "This field allows you to have required information that is included at top of each email. Useful for support emails where the information can be readonly or hidden."

If you want item headings in the received email you can do this with a hidden field:

```
<label for="my_name_field">Name </label>
<input type="hidden" name="message[]" value="--Name--">
<input id="my_name_field" name="message[]" value=""/>

```

Then in the email message you'd get:

```
--Name--
Fred Bloggs

```

---
Tags: email, forms
---


# Question
Title: How to hide following part if age and cost not have any value?
i am using following code for display about section i want to hide above section from left navigation when age and cost does not have any value please guide me thank you

```
 <div class="filter-attribute">
  <h3>Filter By</h3>
</div>
<div class="attirbute-name">
  <h2>Age</h2>
  {exp:channel:entries channel="science_projects" search:age="1-20|21-40|41-60|61-80|81-100" limit="3" dynamic="off" sort="desc"}
  {if age != "Select Age Range"}
  <ul>
    <li><a href="#">{age}</a></li>
  </ul>
  {/if}
  {/exp:channel:entries} </div>
<div class="attirbute-name">
  <h2>Cost</h2>
  {exp:channel:entries channel="science_projects" search:cost="Low|Medium|High" limit="3" dynamic="off" sort="desc"}
  {if cost != "Select Cost Option"}
  <ul>
    <li><a href="#">{cost}</a></li>
  </ul>
  {/if}
  {/exp:channel:entries} </div>

```

# Answer
> 0 votes
Try something like this:

```
{exp:channel:entries channel="science_projects" search:age="1-20|21-40|41-60|61-80|81-100" limit="3" dynamic="off" sort="desc"}
{if age != "Select Age Range"}
  {if count == "1"}
    <div class="filter-attribute">
    <h3>Filter By</h3>
    </div>
    <div class="attirbute-name">
    <h2>Age</h2>
  {/if}
    <ul>
    <li><a href="#">{age}</a></li>
    </ul>
  {if count == total_results}
    </div>
  {/if}
{/if}
{/exp:channel:entries}

```

---
Tags: ee2, tags, entry, html
---


# Question
Title: Where do you put your third party themes folder? has a community consensus been discussed?
I've recently started to use PATH\_THIRD\_THEMES in my config file, but i was wondering if there was a community consensus on where this folder should live and be called?

/assets/third\_themes
/assets/addons
/third\_party\_themes
etc

# Answer
> 3 votes
I've not seen or heard any chatter about this, but I definitely prefer to keep all directories and files which shouldn't be replaced during an EE upgrade in my /assets directory like this.

**If I can place /system below root** I leave the system third\_party directory there for better security.

**If I can't place /system below the root...**

Third party /system files:

```
/assets/third_party/system/

```

**Always**

Third party /themes files:

```
/assets/third_party/themes/

```

Master config settings:

```
$env_config['path_third_themes']   = $base_path . '/assets/third_party/themes/';
$env_config['url_third_themes']    = $base_url . '/assets/third_party/themes/';
/* If system directory is not below root, uncomment and ensure directory exists */
// $env_config['third_party_path']    = $base_path . '/assets/third_party/system/';

```

# Answer
> 0 votes
At the moment there are too many 3rd party addons that seem to need their theme files to be in /themes/third\_party so using a custom location isn't fool proof. With that in mind I personally like to keep as many things as "default" as possible.

---
Tags: add-on, bestpractice, themes
---


# Question
Title: What is the best store solution for many items all at the same price?
This is a large gallery selling prints at A4 and A3 at a set price for both (but I don't know the prices yet) via paypal.

I don't think it needs a full store cart solution, almost an identical simple paypal button with dropdown for price modifier – but is it possible to pass a SKU to paypal in this way?

What might be a tidy solution for this?

Thanks Bruce.

# Answer
> 2 votes
If you don't need a large e-commerce add-on, you might want to try the native EE Simple Commerce module. It can be used to connect to PayPal easily.

If that doesn't work, try the newly released Simple Cart add-on.

# Answer
> 2 votes
It's actually quite easy to use the standard Paypal shopping cart with EE.

Use Paypal's cart/button generator to get the basic add to cart form code, you can add two product options fields using the generator, but it will actually support up to 10 option fields if you need more.

The next step is to add the form to your template and replace various values with EE custom field tags, example:

```
{exp:channel entries channel="products" limit="1"}
<h1>{title}</h1>

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post" >
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="{your_email_address}">
<input type="hidden" name="item_name" value="{title}">
<input type="hidden" name="button_subtype" value="products">
<input type="hidden" name="no_note" value="0">
<input type="hidden" name="add" value="1">
<input type="hidden" name="bn" value="PP-ShopCartBF:btn_cart_LG.gif:NonHostedGuest">
<input type="hidden" name="currency_code" value="GBP">

<!-- sku in hidden field -->
<input type="hidden" name="on1" value="SKU">
<input type="hidden" name="os1" value="{cf_product_sku}">

<!-- options -->
<input type="hidden" name="on0" value="Size">Size
<select name="os0">
    <option value="A4">A4</option>
    <option value="A3">A3</option>
</select>
<!-- options data hidden fields -->
<input type="hidden" name="option_select0" value="A4">
<input type="hidden" name="option_amount0" value="{cf_a4_price}">
<input type="hidden" name="option_select1" value="A3">
<input type="hidden" name="option_amount1" value="{cf_a3_price}">
<input type="hidden" name="option_index" value="0">

<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_cart_LG.gif" border="0" name="submit" alt="PayPal – The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
{/exp:channel entries}

```

For reference I added some sample channel fields, eg

```
{title}
{cf_product_sku} (your SKU code)
{cf_a4_price} (A4 price)
{cf_a3_price} (A3 price)

```

...obviously you'll want to tailor those as needed!

---
Tags: paypal, shopping-cart
---


# Question
Title: Need advice on setting up filter-able photo gallery
I would like to be able to setup a photo gallery on my site that can be filtered by category and subcategory.

I like the idea of using the Grid/Matrix fieldtype for each gallery so you can see all images in the gallery from the Control Panel at the same time. However, I don't see where to set a category/subcategory for every row in the Grid/Matrix field.

I thought about adding another column in the Grid/Matrix field where users could check off the appropriate categories and subcategories, but I feel like this could get really complicated/inefficient on the template side of things.

I was hoping to find a good tutorial on creating a filter-able photo gallery using ExpressionEngine but have not had any luck. I would greatly appreciate any advice on how to tackle this project!

# Answer
I think you're on the right track. I'd create a Matrix column that is a dropdown or multiselect. Then output those variables as CSS classes or data attributes and handle the sorting on the client side using something like this: http://mixitup.io/#Documentation.

```
<ul id="filters">
{your_matrix_field}
 <li data-filter="{matrix_select_col_name}>{matrix_select_col_label}</li>
{/your_matrix_field}
</ul>

{your_matrix_field}
 <div data-content='{matrix_select_col_name}'><img src="foo.jpg"></div>
{/your_matrix_field}

```
> 4 votes

# Answer
My recommendation would be Channel Images from dev demon which should achieve what your looking for.
> 1 votes

# Answer
If you want to keep "out of the box" there's no harm in using a gallery channel and have one image per entry.

This would then offer many ways to filter \- categories \- status \- author \- date (range) \- keyword search \- dynamic parameters \- segment values ... or a combination of any of the above.
> 0 votes

---
Tags: matrix, filter, categories, grid, image-galleries
---


# Question
Title: Using Pixel and Tonic Assets 2 for websites with lots of images
Simple question here! I'm using Assets on every site but I found the last version very slow when browsing files, creating folders etc. etc. so what do you use in large siteswith lots of images?

(also notice that I only use Mediatemple DV 1GB - one server for one website!)

Thanks! Francesco

# Answer
> 1 votes
I use Assets for most clients since it is so much easier for them to use. Some them have (what I would consider) a lot of images and I haven't heard of any issues.

---
Tags: assets, pixelandtonic
---


# Question
Title: Using stash:get_list as plugin parameter value
Can't seem to get this to work. See comments: https://gist.github.com/timkelty/6996339

```
{exp:gwcode_categories
  group_id="2"
  style="linear"
  show_empty="no"
  parse="inward"
  entry_id='{exp:stash:get_list name="resource" backspace="1"}{entry_id}|{/exp:stash:get_list}'
}
  {stash:cat_name}{cat_name}{/stash:cat_name}
  {stash:cat_id}{cat_id}{/stash:cat_id}
{/exp:gwcode_categories}

```

# Answer
> 1 votes
The issue is parse order. In your code {exp:stash:append\_list name="resource"... Is three levels deep. Think layers of an onion. Whereas your {exp:gwcode\_categories... is two levels deep but also requires the "resource" var which has not yet been parsed.

---
Tags: stash, parse-order, list
---


title: Editing for SSL - EE1

text:
# Question
Title: Editing for SSL - EE1
I am trying to force the EE1 control panel to my secure cert, with a bit of difficulty.

The problem is that not everything is delivered by a relative link, so some stuff, specifically custom fieldtypes import their js and css in http:// vs https://

The piece of code that is responsible is:

```
$this->include_css('styles/ngen_file_field.css');
$this->include_js('scripts/jquery.livequery.js');
$this->include_js('scripts/jquery.ngen_file_field.js');

```

etc, for a couple of fieldtypes in there. Each one starts with http://

So with all of this coming in as 'non-secure' the server rules blocks it, not allowing the admin panel to render.

So the question is, how do I override this behaviour? I don't mind circumventing the core stuff, as this site wont be updated ever, and if I have to hard-code something, so help me I will.

Any old EE1 devs have an idea?

# Answer
> 3 votes
You can try making the requests "schemeless"...

Instead of `http://www.example.com/styles/ngen_file_field.css` or `https://www.example.com/styles/ngen_file_field.css` simply edit to:

`//www.example.com/styles/ngen_file_field.css`

This will cause the resources to inherit the scheme of the page in which they are loaded.

# Answer
> 3 votes
The answer to getting the fieldtypes all under SSL is to make sure the fieldframe settings are set to https in the fieldtype path.

utilities -\> extensions manager -\> fieldframe -\> settings

.htaccess forces ssl by the below:

```
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

```

---

So to recap, converting an EE1 install to run on https (assuming the ssl cert is correct)

1. Force https via .htaccess
2. Change config file and general preferences to reflect the https:// protocol
3. Change fieldframe settings to the same protocol

The admin panel should all run on ssl now for EE1, for what it is worth this might save someone some time in the future.

---
Tags: control-panel, ee1, fieldtype, ssl
---


title: Supersearch not showing all results

text:
# Question
Title: Supersearch not showing all results
I have a site which is a directory of images, grouped by brand. Supersearch is hardcoded in to show a list of results on each page, depending on the brand page that you are on (using it a little like channel:entries).

The site appears to be working perfectly and displaying everything as required but I spoke to the client today who informed me that some images were not showing up in the main listings. Each image is it's own entry and has tags applied etc. and then assigned to a brand. He recreated one of the entries that wasn't showing up in the supersearch results using exactly the same image, information & tags and this time it appeared in the list.

Has anyone experienced Supersearch not showing all results, even though everything appears to be in order?

If it's any help, here is the line of code that calls the search.

{exp:super\_search:results parse="inward" redirect\_post="yes" search="keywords={exp:parameters:post name='keywords'}&channel=images&image\_brand-exact={exp:stash:get name='brand\_clean\_title'}&orderby=entry\_date+desc"}

# Answer
Turn on **Template Debugging** to see if your `{exp:parameters:post}` and `{exp:stash:get}` tags are parsed correctly and before {exp:super\_search:results}. If they aren't, then this might be why you're getting odd results.

Also test using hard-coded values in `{exp:super_search:results}`.

Other things you might want to check:

* Your entries have a status of "open"
* Your search keyword is found in your field within the entry, and that this field is set as **searchable**
* Try removing the `-exact` part of your search query, to open up the search to possibly more results. You can then compare data with the previous results.
* For images, and this is more general in EE, make sure the file was uploaded, the URL for your image field is correct, and the uploaded file can be accessed directly from a URL.
> 1 votes

# Answer
This was all down to EE limiting my results to 99 even though I was trying to pull in a variable to set a higher limit. I hard-coded the limit in and it worked fine.

Supersearch is in the clear here.
> 1 votes

---
Tags: solspace, supersearch
---


title: channel form date field customize

text:
# Question
Title: channel form date field customize
How should I use third party date picker? Because EE date field seem not user friendly.

1) If my date is to insert birth date, then it is hard to navigate thru years. 2) how should I take away time in EE date field,cause i just need the date.

# Answer
I would suggest you to use DropDate field type https://github.com/experience/dropdate.ee\_addon/wiki, http://devot-ee.com/add-ons/dropdate
> 3 votes

---
Tags: date, channel-form, date-format
---


# Question
Title: Is it possible to have category name instead of template_group in uri?
I would like to be able to have the url-structure like

> http://example.com/category\_name/entry\_url\_title

Now i know that the default structure in ExpressionEngine is `template_group/template_name`. The thing i would like to avoid is having to create an entire new Template Group when adding a page group. Also that would seem to make the creation of menus a lot simpler and dynamic.

Is this making any sense or am i going about this problem all wrong?

I'm happy to elaborate if you something is missing in this question. Any help/insights would be enormously appreciated!

Thanks.

# Answer
Yes, just have your index template in your default group catch it (strict 404's may interfere with this though).

Use Low Seg2Cat to identify the category, you'll need to check for none found, no\_results and utilise embeds to keep the template clean.

Using something like Template Routes means duplication in all the categories to catch them.
> 4 votes

# Answer
It depends how *dynamic* you want the URL to be along with the usage and setup of the site really. If it's just a simple blog/news site then you can set things up on the root URL like that but if there are other sections then you may want to consider including `/news/category/entry_url` where `news` is a template group of whatever your content consists of.

Generally though, if you looking to break free from EE's default template routing then your best bet would be to use a routing addon. There are a few which can help out here but my personal favourite is Template Routes. You then have much more customisation of your EE URLs.
> 4 votes

# Answer
It depends.

EECMS needs a category URL indicator if you want to use `category_name` instead of the ugly numeric indicator.

But you can use the really good Low Seg2cat and to put all the code on your index template.

```
{if "{segment_1_category_id}" == ""}
    {!-- your homepage code --}
{/if}
{if "{segment_1_category_id}"}
    {!-- your code to list all entries of this category --}
    {!-- your single entry code --}
{/if}

```

This sample doesn't deal with different codes for single entry and for list of entries. I don't know if you need this.
> 4 votes

# Answer
The **Freeway extension** should do the trick for you.

> A route looks like this:
>
> /blog/{{username}}/{{category}} =\> /blog/category/{{category}}
>
> In this case, a URL like "blog/davery/css" will be treated, in EE, as "blog/category/css". Several variables will be available in the template:
>
> {freeway\_username} - davery
> {freeway\_category} - css
> {freeway\_1} - blog {freeway\_2} - davery
> {freeway\_3} - css
> {freeway\_4+} - (blank)
> {freeway\_info} - debug info from Freeway
> 2 votes

# Answer
Without knowing exactly what your content is and therefore how the "sections" relate to the "pages" it's hard to give a good answer, however I would probably steer away from categories altogether for this.

An alternative solution might be to use two channels - one for parent sections, another for child pages, and use a relationship field in the section entries to specify which pages are part of that section.

To display these on the front end without using the template\_group in segment\_1, you'll need to use the Pages module to override the URL on each parent section. You won't need to do this on all the child entries, as your specified template can simply look at segment\_2 to fetch the right entry to display (using `url_title="{segment_2}"` and `dynamic="no"`). If you want to make this a bit smoother, there is an extension which automatically populates the Pages URI with the entry's url\_title on publish: http://devot-ee.com/add-ons/auto-pages-uri ... never tried it myself.
> 1 votes

# Answer
Another option would be to use Template Routes http://devot-ee.com/add-ons/template-routes
> 1 votes

---
Tags: categories, url
---


# Question
Title: What version of Expression Engine is required for the Discussion Forum module?
Can you please tell me if the Discussion Forum Module will run on Expression Engine version 2.3.0?

# Answer
Generally, EllisLab requires that each new release of their additional modules (MSM and Forum) be used only with the version of ExpressionEngine that was released at the same time - they don't maintain backwards-compatibility.

If you have a valid license for the Forum module, and cannot upgrade from EE 2.3.0, then I'd contact EllisLab directly, provide your license key, and ask if they can supply you with a compatible, older version of Forum.
> 2 votes

# Answer
As Derek stated above, this all depends on the version of the Forum module you are using. If you can update each accordingly, you should be just fine. When all else fails, you could research the change logs for the discussion module on EllisLab's site and see if it fits your licensed versions.
> 1 votes

---
Tags: forum, discussion
---


title: Prevent multiple add_to_head() calls

text:
# Question
Title: Prevent multiple add_to_head() calls
In `function display_field()`, if a fieldtype needs to use `ee()->cp->add_to_head('/path/to/foo.css')` and `ee()->cp->add_to_foot('/path/to/bar.js')`, how can I get it to do so only once, even when the Publish page may have multiple instances of that field?

# Answer
> 5 votes
Use the session cache:

```
if (ee()->session->cache(__CLASS__, __FUNCTION__) === FALSE)
{
  ee()->cp->add_to_head('/path/to/foo.css');

  ee()->session->set_cache(__CLASS__, __FUNCTION__, TRUE);
}

```

Your code will only run once per page load.

---
Tags: add-on-development, custom-fields, fieldtype
---


title: Channel form File Upload field

text:
# Question
Title: Channel form File Upload field
When I use channel form File Upload field, it come together with the "Select an existing file" select box. Possible to take it away?

1 of the way is javascript to hide it. but any better way to not generate the select box?

# Answer
> 2 votes
In the field settings for your file field simply uncheck the **Show Existing Files** checkbox.

---
Tags: file-uploads, channel-form
---


# Question
Title: Solspace Calendar - Ordering occurrences by time
I'm outputting occurrences using the `{occurrences}` variable pair within a `{exp:calendar:events}` tag for a single day and I'd like to sort these occurrences by time.

```
{exp:calendar:events calendar_id="22" date_range_start="2013-11-10" date_range_end="2013-11-10" sort="asc" show_years="9" pad_short_weeks="n"}

   {occurrences}
      {occurrence_start_date format="%D, %F %j %g:%i %a"}
   {/occurrences}

{/exp:calendar:events}

```

I tried using the `sort` parameter in the occurrences variable pair and but it didn't work. Any tips?

# Answer
I actually just ran into a similar issue with Solspace Calendar. The add-on is written so that ordering in this way is not possible (it has a built-in ordering process). You can't even use the `fixed_order=` parameter.

In the end, I had to **utilize Stash to first grab all the event occurrences and set them into a list, then grab that Stash list and sort using Stash**.

So, after you install Stash, try this:

```
{exp:stash:set_list name="event_occurrences" parse_tags="yes"}
  {exp:calendar:events calendar_id="22" date_range_start="2013-11-10" date_range_end="2013-11-10" show_years="9" pad_short_weeks="n"}
    {occurrences}
      {stash:occurrence_title}{title}{/stash:occurrence_title}
      {stash:occurrence_start_date_hour}{occurrence_start_date format="%D, %F %j %g:%i %a"}{/stash:occurrence_start_date_hour}
      {stash:occurrence_time_sort}{occurrence_start_date format="%Y%m%d%H%i"}{/stash:occurrence_time_sort}
    {/occurrences}
  {/exp:calendar:events}
{/exp:stash:set_list}

```

Then use Stash to display them in order by sorting according to `{stash:occurrence_time_sort}`

```
{exp:stash:get_list name="event_occurrences" orderby="occurrence_time_sort" sort="desc"}
  <h1>{occurrence_title}</h1>
  <h2>{occurrence_start_date_hour}</h2>
{/exp:stash:get_list}

```
> 1 votes

# Answer
If you're looking to order occurrences chronologically, you should be using `{exp:calendar:cal}`. This is the only tag that will order occurrences in true chronological order. Details on why/how can be found here: http://www.solspace.com/docs/calendar/getting\_started/
> 1 votes

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


title: Solspace calendar next/prev month path

text:
# Question
Title: Solspace calendar next/prev month path
I am using Solspace month calendar. The calendar is embeded in another template. when I click on the next/prev month links it takes me to different page. I would like it to change the month but stay in the same page. It seems that there is problem with the path but I don't know how to fix it. I am using the following path: **Previous Month**

# Answer
Depending on whether you're using the Calendar:Month tag or the Calendar:Cal tag in "Month" form, the adjustment will be different. If you're using the Calendar:Month tag, I would suggest switching to the Calendar:Cal approach, as it's far more flexible.

Have a look at the Advanced example: http://www.solspace.com/docs/calendar/month/#advanced

In the header, just adjust the URI paths ({path='calendar/month'}) to match your actual URI in the code below:

```
<thead>
    <tr id="month_year">
        <th colspan="2">«
            <a href="{path='calendar/month'}/{prev_month format="%Y/%m"}/">
                {prev_month format="%F"}
            </a>
        </th>
        <th colspan="3">{date format="%F %Y"}</th>
        <th colspan="2">
            <a href="{path='calendar/month'}/{next_month format="%Y/%m"}/">
                {next_month format="%F"}
            </a>
            »
        </th>
    </tr>
</thead>

```

Alternatively, if you wish to continue using the Calendar:Month tag approach, you can modify the source code (which will look VERY similar to the code above) here: /themes/third\_party/calendar/templates/month.html
> 1 votes

---
Tags: solspace-calendar
---


# Question
Title: Malformed href using {url} for slider link
I have a slider at the top of my page using this HTML:

```
<div id='top_slider'>
    {exp:channel:entries channel="home" limit="1"}
        <!-- <div class="arrow_left white" onclick="slide('left')"></div>
        <div class="arrow_right white" onclick="slide('right')"></div> -->
        {home_promo_slider}
            {if active == 'y'}
                {if row_count == 2}
                    <div class="arrow_left white" onclick="slide('right');stopAutoSlide();"></div>
                    <div class="arrow_right white" onclick="slide('left');stopAutoSlide();"></div>
                {/if}
                <div class='slide'>
                    {if url != ''}<a href="{url}">{/if}
                    <img class="fullscreen_img" src='{image}' />
                    {if url != ''}</a>{/if}
                </div>
            {/if}
        {/home_promo_slider}
</div>

```

I want to link the images to a URL specified in the Homepage Content using a channel field. The problem is that this only works for internal links currently. If I enter "store" into the URL field it correctly takes me to http://mywebsite.com/store, but if I enter an external link such as http://google.com, the href becomes malformed and spits out this:

```
<a href="<a href=" http:="" google.com"="">http://google.com</a>

```

Any ideas? Thanks in advance!

# Answer
Check the Channel Preferences for this Channel for the *Automatically turn URLs and email addresses into links* option. It sounds like you have it set to "Yes" and this is causing the malformed HTML.

Control Panel Location: Admin \> Channel Administration \> Channels \> Edit Preferences

Documentation
> 1 votes

---
Tags: channel, fields, links
---


title: XML children with parameters import

text:
# Question
Title: XML children with parameters import
I'm using **Solspace Importer** to create channel entries from external **XML**.

It works fine but only with first title/description element (*lang="**es**"*). How can I grab data from (*lang="**en**"*) children?

My XML structure is below & full huge file is here.

```
<root>
    <property>
        <descriptions>
            <title lang="es">
                <![CDATA[ Bungalow en Altea Hills ]]>
            </title>
            <title lang="en">
                <![CDATA[ Bungalow in Altea Hills ]]>
            </title>
            <description lang="es">
                <![CDATA[
                    Bonito bungalo en Altea Hills con vistas al mar.
                ]]>
            </description>
            <description lang="en">
                <![CDATA[
                    Lovely bungalow in Altea Hills with sea view.
                ]]>
            </description>
        </descriptions>
    </property>
</root>

```

# Answer
As of this writing, Importer does not read XML node attributes, such as lang="es" for example. Therefore, Importer will read only the first node of a series of nodes named exactly the same, `<description>` in this case.

I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. http://support.solspace.com/support/discussions

A workaround would be to use different node names for "en" and "es" nodes. For example:

```
<description_es>... data ...</description_en>
<description_en>... data ...</description_en>

```
> 1 votes

---
Tags: ee2, solspace, import, xml, solspace-importer
---


# Question
Title: Store error on return from gateway (eWay) after upgrade to ee2.7.2
I hope someone can help me. I've been working on a site using Exp:resso store 1.6.4 and EE 2.6.0. I've just finished the dev process, but while I've been busy doing that, EE has updated and so has Store. I thought I'd upgrade them both now before the site goes live, so I've just patched to Store 1.6.5 and EE 2.7.2. (I've got backups).

Everything seems to work ok until I return from eWay's shared payment page.

EE gives a vague error: `The action you have requested is invalid.`

This is when trying to process `index.php?ACT=34&H=e6afaea42c9d67163422a8e039274f83`.

From what I've read I believe could be a security issue? I've found nothing specificto help solve, however.

Note that at present I am running the dev server without an SSL, and this was not a problem until now. Store is set to NOT require SSL connection.

I also note that the payments are processed and completed at eWay, but the order is never recognised in Store, and my cart still contains the ordered items.

Here's my cart tag:

`{exp:store:checkout payment_method="eway_shared" return="checkout/confirm/ORDER_HASH" require="accept_terms" error_handling="inline" error_delimiters='<span class="error">|</span>'}`

Any help much appreciated.

# Answer
You need to disable secure forms (in the control panel under Admin \> Security & Privacy \> Security and Sessions, set "Process form data in Secure Mode?" to "No")

Some changes made in EE 2.7 have made the secure forms feature a nightmare to work with, and on most sites it causes more trouble than it is worth (for example, back button is totally broken with form submissions, AJAX submissions are overly difficult to work with, and requests from third party servers like eWay are blocked entirely). The easiest solution is just to disable secure forms for the time being. We're talking to Ellislab about this but it is unclear at this stage whether they will revert the change in a future version of EE.
> 3 votes

# Answer
Secure forms isn't protocol aware, so the SSL cert doesn't come into play. The role of secure forms is to check that the submission originated from a form on this site and no more than once.

Without setting up a test install it's hard to tell you exactly what would need to be changed in order to support secure forms. That said, there should be no issues with leaving it disabled until Adrian adds support to Store v1.
> 0 votes

---
Tags: expresso-store
---


# Question
Title: embed within loop always getting wrong variable
When I use an `embed` tag within either an `exp:query` or `exp:channel:categories` loop, the outcome is the same: the embedded template erroneously receives the same variable over and over.

Pretend we have three categories, with IDs of 1, 2, and 3.

**Example Embed Template (site/template)**

```
 The parent category ID is {embed:parent_category_id}.<br/>

```

**Example A**

```
 {exp:query sql="SELECT cat_id as category_id FROM exp_categories LIMIT 3"}
      {category_id} / {embed="site/template" parent_category_id="{category_id}"}
 {/exp:query}

```

*outputs...*

```
 1 / The parent category ID is 1.
 2 / The parent category ID is 1.
 3 / The parent category ID is 1.

```

**Example B**

```
 {exp:channel:categories style="linear" parent_only="yes"}
      {category_id} / {embed="site/template" parent_category_id="{category_id}"}
 {/exp:channel:categories}

```

*outputs the same thing...*

```
 1 / The parent category ID is 1.
 2 / The parent category ID is 1.
 3 / The parent category ID is 1.

```

Things I've tried (unsuccessfully):

* changing up variable names
* liberally applying `parse="inward"` in various combinations
* using a conditional like `{if count == 1}foo{if:else}bar{/if}` to see if I can get the printed value of `{embed:parent_category_id}` to change.

I've used embeds within loops many, many times without experiencing this issue, and it's driving me bonkers. There's no caching or additional fanciness in play that I can think of.

EE 2.7.2.

# Actual Templates

**costumes (approximated by example A)**

```
 {embed="site/.part-header" title="Costumes"}

 <h1>Costumes</h1>

 <div class="category-nav">
    <ul>
        <li class="previous-concept"><a href="" class="disabled">Previous Concept</a></li>
        <li class="back-to-grid"><a href="" class="disabled">Back to Grid</a></li>

        {exp:channel:categories channel="costumes" style="linear" parent_only="yes"}
            {if count == "1"}
            {exp:channel:entries category="{category_id}" orderby="title" sort="asc" limit="1"}
            <li class="next-concept"><a href="{site_url}costume-detail/{entry_id}/">Next Concept</a></li>
            {/exp:channel:entries}
            {/if}
        {/exp:channel:categories}
    </ul>
    <br class="clear" />
 </div>

 <div class="costume-grid">
 {exp:query sql="SELECT cat_name as parent_category_name, cat_id as parent_category_id
                FROM exp_categories
                WHERE group_id = 4
                AND parent_id = 0
                ORDER BY cat_order ASC"}
    <div class="costume-grid-row{if count == total_results} last{/if}">
        <div class="gridbox">
            <p class="costumecategory">{parent_category_name}</p>
        </div>

        {embed="site/.part-category-item" category_id="{parent_category_id}"  base_url="{site_url}costume-detail/"}

        <br class="clear" />
    </div>
 {/exp:query}
 </div>

 <div class="intros">
    <div class="graybox">
        {exp:channel:entries channel="static" entry_id="11" limit="1"}
            <h2>{title}</h2>
            {content-1}
        {/exp:channel:entries}

        <div class="right">
            {exp:channel:entries channel="costumes" dynamic="no" category="60" limit="1" sort="asc"}
                <a id="explore" class="text-button" href="{site_url}costume-detail/{url_title}/">Explore</a>
            {/exp:channel:entries}
        </div>
    </div>
 </div>

 {embed="site/.part-footer"}

```

**.part-category-item**

```
 {exp:query sql="SELECT c.cat_id, c.cat_url_title, c.cat_name
                FROM exp_channel_titles t
                LEFT JOIN exp_channel_data d ON t.entry_id = d.entry_id
                LEFT JOIN exp_category_posts cp ON t.entry_id = cp.entry_id
                LEFT JOIN exp_categories c ON cp.cat_id = c.cat_id
                WHERE c.parent_id = '{embed:category_id}'
                ORDER BY c.cat_order ASC"}
    {exp:channel:entries category="{cat_id}" orderby="title" sort="asc" dynamic="no"}
        <div class="gridbox" style="overflow: visible;">
            {categories show="not {embed:category_id}" limit="1"}
                <table cellspacing="0" cellpadding="0" style="overflow: visible;">
                    <tr style="overflow: visible;">
                        <td style="overflow: visible;">
                            <a href="{embed:base_url}{url_title}/" >
                                <img src="{category_image}" style="margin: 0; padding: 0;" title="{title}" />
                            </a>
                        </td>
                    </tr>
                </table>
                <p><a href="{embed:base_url}{url_title}/">{category_name}</a></p>
            {/categories}
        </div>
    {/exp:channel:entries}
 {/exp:query}

```

**.part-category-item-test (identical to previous, except for filename)**

```
 {exp:query sql="SELECT c.cat_id, c.cat_url_title, c.cat_name
                FROM exp_channel_titles t
                LEFT JOIN exp_channel_data d ON t.entry_id = d.entry_id
                LEFT JOIN exp_category_posts cp ON t.entry_id = cp.entry_id
                LEFT JOIN exp_categories c ON cp.cat_id = c.cat_id
                WHERE c.parent_id = '{embed:category_id}'
                ORDER BY c.cat_order ASC"}
    {exp:channel:entries category="{cat_id}" orderby="title" sort="asc" dynamic="no"}
        <div class="gridbox" style="overflow: visible;">
            {categories show="not {embed:category_id}" limit="1"}
                <table cellspacing="0" cellpadding="0" style="overflow: visible;">
                    <tr style="overflow: visible;">
                        <td style="overflow: visible;">
                            <a href="{embed:base_url}{url_title}/" >
                                <img src="{category_image}" style="margin: 0; padding: 0;" title="{title}" />
                            </a>
                        </td>
                    </tr>
                </table>
                <p><a href="{embed:base_url}{url_title}/">{category_name}</a></p>
            {/categories}
        </div>
    {/exp:channel:entries}
 {/exp:query}

```

**Update:** I've now added these templates just in case there's something else to be gleaned, but deleting the original .part-category-item and renaming the (identical) .part-category-item-test worked. At this point I assume it's impossible to narrow down to the answer without also sharing the database, asking the person who migrated the site exactly what he did, etc. I'll chalk it up to some kind of storage or encoding issue, but that's still just a guess.

I can't create and accept my own answer because I don't think this constitutes one – just a fix. I'm fine with Stack Overflow but end up in messy situations like this on the EE Stack Exchange. Open to suggestions!

# Answer
There has to be something else at play. Using your exact example A code in empty template + site/template embed code, I get as expected:

```
1 / The parent category ID is 1.
2 / The parent category ID is 2.
3 / The parent category ID is 3.

```

Try it yourself using empty templates.
> 1 votes

# Answer
Try

```
{embed="site/template" parent_category_id="{category_id}" random}

```

**random** is prevent modules tag caching (if you have multiple calls tags with identical parameters and tag data)
> 0 votes

---
Tags: embeds, loop
---


# Question
Title: Trying to upgrade PT Fieldpack in EE 2.7.2
I upgraded from EE2.5.2 to EE2.7.2. I had the old individual P&T Dive Bar fields installed. I'm trying to upgrade to the new Field pack as per the instructions, but I can't access the Add-ons \> Fieldtypes screen due to the following error:

> Fatal error: Class PT\_Fieldtype contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (EE\_Fieldtype::display\_field) in /var/www/vhosts/snip/subdomains/stage/system/expressionengine/third\_party/pt\_field\_pack/pt\_fieldtype.php on line 148

How can I bypass / fix this error so I can install the new fields?

Thanks in advance.

# Answer
This could arguably be a duplicate of this question, but it's a bit different because you're asking how to silence the error so you can finish the update per the P&T docs.

I just ran into this today myself and had the same question! The solution is courtesy of this answer.

Open up **pt\_fieldtype.php** and below the constructor (around line 29) add:

```
public function display_field($data)
{
    // This placeholder function will prevent the PHP error
}

```

This will prevent the error and allow you to get on with the upgrade.

---

**OR** as Andris pointed out below, you can simply delete the old pt\_fieldtype files and the error will go away so that you'll be able to install the new field pack.
> 5 votes

---
Tags: pixelandtonic, field-pack
---


# Question
Title: DB error when creating file upload location after 272 update
We recently updated a 255 install to 272. Things are working fine except we got an error when we first tried to add a new File Upload location under File Upload Preferences. The error was:

`A Database Error Occurred
Error Number: 1062`

`Duplicate entry '4-5' for key 'PRIMARY'

INSERT INTO `exp_upload_no_access` (`upload_id`, `upload_loc`, `member_group`) VALUES (4, 'cp', '5')

Filename: controllers/cp/content_files.php`

`Line Number: 2338`

Since that time, we have not been able to replicate this and it seems adding, editing and deleting locations is working ok. Is this something worth worrying about?

# Answer
> 1 votes
Sounds like an odd error to run into. I'd say it was one off with the key index for that table and you will be fine from now on.

If you are concerned however, you can rebuild the table index:

> To rebuild a table by dumping and reloading it, use mysqldump to create a dump file and mysql to reload the file:
>
> ```
> shell> mysqldump --all-databases > dump.sql
> shell> mysql db_name < dump.sql
>
> ```

If you don't have access to the shell to perform this, try the following from PhpMyAdmin (or other DB control panel).

```
ALTER TABLE exp_upload_no_access ENGINE = MyISAM;
```

---
Tags: file-uploads, database-error
---


# Question
Title: Conditional disables needed class on <li> tag
When I use this conditional it works great, it activates the active state when I am in segment 1, however, at the same time it disables the other class on the li 'dropdown'.

The 'dropdown' class is positioning relative, when its disabled the dropdown menu moves all the way to the right of the parent container.

Is their a different conditional which will allow me to NOT DISABLE the 2nd class (dropdown) on the il tag.

{if segment\_1 == "donate"} class="active"{/if} class="dropdown"\>Donate

# Answer
> 5 votes
Well, you're having an HTML issue, not an EECMS issue, because an element can't have more than one`class` attribute.

Use this:

```
<li class="{if segment_1 == "donate"}active {/if}dropdown">Donate</li>

```

Or you can simple remove the `dropdown` class and use a child selector or a descendant selector. Even for JavaScript, you don't need this class. You can do an Event delegation at its parentElement.

---
Tags: conditionals
---


title: how to solve following error of php?

text:
# Question
Title: how to solve following error of php?
Hello friends i am using magento and expression engine both in my site and for integration expression engine with magento i am using one module mage\_integratee in that php file i get following error so how i can solve this errors

```
1)
A PHP Error was encountered
Severity: Notice
Message: Undefined index: store
Filename: mage_integratee/ext.mage_integratee.php
Line Number: 138

2)
A PHP Error was encountered
Severity: Notice
Message: Undefined index: exclude
Filename: mage_integratee/ext.mage_integratee.php
Line Number: 153

3)
A PHP Error was encountered
Severity: Warning
Message: require_once(/home/hst/domains/hst.uldev.co/public_html/Mage.php): failed to open stream: No such file or directory
Filename: mage_integratee/ext.mage_integratee.php
Line Number: 177

4)
Fatal error: require_once(): Failed opening required '/home/hst/domains/hst.uldev.co/public_html/Mage.php' (include_path='.:/usr/local/lib/php') in /home/hst/domains/hst.uldev.co/public_html/a/system/expressionengine/third_party/mage_integratee/ext.mage_integratee.php on line 177

```

i am using following php code in mage\_integratee.php file

```
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Mage_integratee_ext {

    var $name       = 'Mage Integratee';
    var $version        = '2.0.3';
    var $description    = 'Integrate Magento Layouts into ExpressionEngine Pages';
    var $settings_exist = 'y';
    var $docs_url       = ''; // 'http://expressionengine.com/user_guide/';

    var $settings        = array();

    /**
     * Constructor
     *
     * @param   mixed   Settings array or empty string if none exist.
     */
    function __construct($settings='')
    {
        $this->settings = $settings;
    }
    // END

    /**
     * Activate Extension
     *
     * This function enters the extension into the exp_extensions table
     *
     * @see http://codeigniter.com/user_guide/database/index.html for
     * more information on the db class.
     *
     * @return void
     */
    function activate_extension()
    {
        $this->settings = array(
            'mage'   => $_SERVER['DOCUMENT_ROOT'],
            'head'  => 'y',
            'after_body_start'  => 'y',
            'global_notices'  => 'y',
            'header'  => 'y',
            'global_messages'  => 'y',
            'left'  => 'y',
            'right'  => 'y',
            'footer'  => 'y',
            'before_body_end'  => 'y'
        );

        $data = array(
            'class'     => __CLASS__,
            'method'    => 'init_layout',
            'hook'      => 'template_fetch_template',
            'settings'  => serialize($this->settings),
            'priority'  => 10,
            'version'   => $this->version,
            'enabled'   => 'y'
        );

        ee()->db->insert('extensions', $data);
    }
    // END

    /**
     * Update Extension
     *
     * This function performs any necessary db updates when the extension
     * page is visited
     *
     * @return  mixed   void on update / false if none
     */
    function update_extension($current = '')
    {
        if ($current == '' OR $current == $this->version)
        {
            return FALSE;
        }

        if ($current < '2.0.0')
        {
            // Update to version 1.0
        }

        ee()->db->where('class', __CLASS__);
        ee()->db->update(
                    'extensions',
                    array('version' => $this->version)
        );
    }
    // END

    /**
     * Disable Extension
     *
     * This method removes information from the exp_extensions table
     *
     * @return void
     */
    function disable_extension()
    {
        ee()->db->where('class', __CLASS__);
        ee()->db->delete('extensions');
    }
    // END

    // --------------------------------
    //  Settings
    // --------------------------------

    function settings()
    {
        $settings = array();

        $settings['mage']      = array('i', '', "");
        $settings['store']      = array('i', '', "");
        $settings['exclude']      = array('i', '', "");
        $settings['head']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['after_body_start']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['global_notices']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['header']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['global_messages']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['left']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['right']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['footer']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');
        $settings['before_body_end']      = array('r', array('y' => "Yes", 'n' => "No"), 'y');

        return $settings;
    }
    // END

    // --------------------------------
    //  Initialize Layout
    // --------------------------------

    function init_layout($row)
    {

        $mageRunCode = $this->settings['store'];
        $mageRunType = "store";

        if(isset( ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_CODE']))
        {
            $mageRunCode = ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_CODE'];
        }

        if(isset( ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_TYPE']))
        {
            $mageRunType = ee()->config->_global_vars['MAGE_INTEGRATEE_RUN_TYPE'];
        }

        //print_r(ee()->config);

        if($this->settings['exclude'] != "")
        {
            if (strpos($this->settings['exclude'], $row['group_name']) !== FALSE)
            {
                return $row;
            }
        }

        if ( ! ee()->session->cache(__CLASS__, 'mage'))
        {

            if($this->settings['mage'] === ""){
                return $row;
            } else {
              $mage = $this->settings['mage'];
            }

            if($mage[strlen($mage)-1] !== "/"){
                $mage .= "/Mage.php";
            } else {
                $mage .= "Mage.php";
            }

            //Initialize Magento
            require_once $mage;
            Mage::app($mageRunCode,$mageRunType);
            Mage::getSingleton('core/session', array('name'=>'frontend'));

            //Check if logged in
            if(Mage::getSingleton('customer/session')->IsLoggedIn()){
                //Load Layout Handles
                $layout = Mage::app()->getLayout();
                $layout->getUpdate()
                    ->addHandle('default')
                    ->addHandle('expressionengine_integratee')
                    ->addHandle('customer_logged_in')
                    ->load();
            }
            else
            {
                //Load Layout Handles
                $layout = Mage::app()->getLayout();
                $layout->getUpdate()
                    ->addHandle('default')
                    ->addHandle('expressionengine_integratee')
                    ->addHandle('customer_logged_out')
                    ->load();
            }

            //Generate Blocks
            $layout->generateXml()
                ->generateBlocks();

            ee()->session->set_cache(__CLASS__, 'mage', '1');

            //Load Block Output and Create Global Variables
            if($this->settings['head'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'head'))
                {
                    $head = $layout->getBlock('head')->setTitle("")->toHtml();
                    $head = str_replace('?___SID=U', '', $head);
                    ee()->config->_global_vars['mage:head'] = $head;
                    ee()->session->set_cache(__CLASS__, 'head', $head);
                } else {
                    $head = ee()->session->cache(__CLASS__, 'head');
                    ee()->config->_global_vars['mage:head'] = $head;
                }

            }
            if($this->settings['after_body_start'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'after_body_start'))
                {
                    $after_body_start = $layout->getBlock('after_body_start')->setTitle("")->toHtml();
                    $after_body_start = str_replace('?___SID=U', '', $after_body_start);
                    ee()->config->_global_vars['mage:after_body_start'] = $after_body_start;
                    ee()->session->set_cache(__CLASS__, 'after_body_start', $after_body_start);
                } else {
                    $after_body_start = ee()->session->cache(__CLASS__, 'after_body_start');
                    ee()->config->_global_vars['mage:after_body_start'] = $after_body_start;
                }

            }
            if($this->settings['global_notices'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_notices'))
                {
                    $global_notices = $layout->getBlock('global_notices')->setTitle("")->toHtml();
                    $global_notices = str_replace('?___SID=U', '', $global_notices);
                    ee()->config->_global_vars['mage:global_notices'] = $global_notices;
                    ee()->session->set_cache(__CLASS__, 'global_notices', $global_notices);
                } else {
                    $global_notices = ee()->session->cache(__CLASS__, 'global_notices');
                    ee()->config->_global_vars['mage:global_notices'] = $global_notices;
                }

            }
            if($this->settings['header'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'header'))
                {
                    $header = $layout->getBlock('header')->setTitle("")->toHtml();
                    $header = str_replace('?___SID=U', '', $header);
                    ee()->config->_global_vars['mage:header'] = $header;
                    ee()->session->set_cache(__CLASS__, 'header', $header);
                } else {
                    $header = ee()->session->cache(__CLASS__, 'header');
                    ee()->config->_global_vars['mage:header'] = $header;
                }

            }
            if($this->settings['global_messages'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_messages'))
                {
                    $global_messages = $layout->getBlock('global_messages')->setTitle("")->toHtml();
                    $global_messages = str_replace('?___SID=U', '', $global_messages);
                    ee()->config->_global_vars['mage:global_messages'] = $global_messages;
                    ee()->session->set_cache(__CLASS__, 'global_messages', $global_messages);
                } else {
                    $global_messages = ee()->session->cache(__CLASS__, 'global_messages');
                    ee()->config->_global_vars['mage:global_messages'] = $global_messages;
                }

            }
            if($this->settings['left'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'left'))
                {
                    $left = $layout->getBlock('left')->setTitle("")->toHtml();
                    $left = str_replace('?___SID=U', '', $left);
                    ee()->config->_global_vars['mage:left'] = $left;
                    ee()->session->set_cache(__CLASS__, 'left', $left);
                } else {
                    $left = ee()->session->cache(__CLASS__, 'left');
                    ee()->config->_global_vars['mage:left'] = $left;
                }

            }
            if($this->settings['right'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'right'))
                {
                    $right = $layout->getBlock('right')->setTitle("")->toHtml();
                    $right = str_replace('?___SID=U', '', $right);
                    ee()->config->_global_vars['mage:right'] = $right;
                    ee()->session->set_cache(__CLASS__, 'right', $right);
                } else {
                    $right = ee()->session->cache(__CLASS__, 'right');
                    ee()->config->_global_vars['mage:right'] = $right;
                }

            }
            if($this->settings['footer'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'footer'))
                {
                    $footer = $layout->getBlock('footer')->setTitle("")->toHtml();
                    $footer = str_replace('?___SID=U', '', $footer);
                    ee()->config->_global_vars['mage:footer'] = $footer;
                    ee()->session->set_cache(__CLASS__, 'footer', $footer);
                } else {
                    $footer = ee()->session->cache(__CLASS__, 'footer');
                    ee()->config->_global_vars['mage:footer'] = $footer;
                }

            }
            if($this->settings['before_body_end'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'before_body_end'))
                {
                    $before_body_end = $layout->getBlock('before_body_end')->setTitle("")->toHtml();
                    $before_body_end = str_replace('?___SID=U', '', $before_body_end);
                    ee()->config->_global_vars['mage:before_body_end'] = $before_body_end;
                    ee()->session->set_cache(__CLASS__, 'before_body_end', $before_body_end);
                } else {
                    $before_body_end = ee()->session->cache(__CLASS__, 'before_body_end');
                    ee()->config->_global_vars['mage:before_body_end'] = $before_body_end;
                }

            }

            return $row;

        } else {

            //Load Block Output and Create Global Variables
            if($this->settings['head'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'head'))
                {
                    $head = ee()->session->cache(__CLASS__, 'head');
                    ee()->config->_global_vars['mage:head'] = $head;
                }

            }
            if($this->settings['after_body_start'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'after_body_start'))
                {
                    $after_body_start = ee()->session->cache(__CLASS__, 'after_body_start');
                    ee()->config->_global_vars['mage:after_body_start'] = $after_body_start;
                }

            }
            if($this->settings['global_notices'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_notices'))
                {
                    $global_notices = ee()->session->cache(__CLASS__, 'global_notices');
                    ee()->config->_global_vars['mage:global_notices'] = $global_notices;
                }

            }
            if($this->settings['header'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'header'))
                {
                    $header = ee()->session->cache(__CLASS__, 'header');
                    ee()->config->_global_vars['mage:header'] = $header;
                }

            }
            if($this->settings['global_messages'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'global_messages'))
                {
                    $global_messages = ee()->session->cache(__CLASS__, 'global_messages');
                    ee()->config->_global_vars['mage:global_messages'] = $global_messages;
                }

            }
            if($this->settings['left'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'left'))
                {
                    $left = ee()->session->cache(__CLASS__, 'left');
                    ee()->config->_global_vars['mage:left'] = $left;
                }

            }
            if($this->settings['right'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'right'))
                {
                    $right = ee()->session->cache(__CLASS__, 'right');
                    ee()->config->_global_vars['mage:right'] = $right;
                }

            }
            if($this->settings['footer'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'footer'))
                {
                    $footer = ee()->session->cache(__CLASS__, 'footer');
                    ee()->config->_global_vars['mage:footer'] = $footer;
                }

            }
            if($this->settings['before_body_end'] === "y"){

                if ( ! ee()->session->cache(__CLASS__, 'before_body_end'))
                {
                    $before_body_end = ee()->session->cache(__CLASS__, 'before_body_end');
                    ee()->config->_global_vars['mage:before_body_end'] = $before_body_end;
                }

            }

            return $row;
        }
    }
    // END

}
// END CLASS

```

# Answer
> 2 votes
For the first two errors, you need open the extension's setting in the CP and setup all parameters.

For errors 3 & 4, check if your server path to Mage.php is correct.

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


# Question
Title: Low Replace inside Low search only finds first occurrence of query
i have a multi-language site setup with low search. every language has it's own collection - this works quite nice. Now i might have been a bit too excited about template partials and let the client fill in a lot of content in which he can insert all sorts of images and other stuff by doing for example "{image\_12}"... this tags are now in my search-excerpts as well and i want them gone.

i try to filter them out with low replace but it finds only the first occurrences of my query. my code looks something like this:

```
<ul>
{exp:low_search:results query="{segment_3}" status="not closed" limit="10" disable="member_data"}
        <li>
            <h3><a href="/{language_code}{page_uri}">{bbr-mls:title}</a></h3>
            {exp:low_replace find="\{.*?\}" replace="" regex="yes"}{low_search_excerpt}{/exp:low_replace}
        </li>
{/exp:low_search:results}
</ul>

```

any help much appreciate (and sorry low for bugging you on twitter - you are right, this is the place to ask.)

cheers, moritz

# Answer
Your example actually worked fine in a test I did. But it could be that the curly brackets are encoded to entities, so the regex doesn't actually match. You could try this:

```
{exp:low_replace find="(\{|{)[\w\-]+?(\}|})" regex="yes"}
    {low_search_excerpt}
{/exp:low_replace}

```

If you're just filtering out those image tags, you could also consider wrapping the Low Replace tag around the whole Low Search Results tag:

```
{exp:low_replace find="(\{|{)image_\d+(\}|})" regex="yes"}
    {exp:low_search:results ... }
        ...
    {/exp:low_search:results}
{/exp:low_replace}

```
> 2 votes

---
Tags: search, low-search, low-replace, regex
---


# Question
Title: if 2 channels on one page ie: if channel == "channel1"
I am trying to display one entry (most recent) on my home page from 2 different channels. So ChannelA and ChannelB.

```
{exp:weblog:entries weblog="weblogA|weblogB" limit="1" sort="asc" show_future_entries="yes"}
{if weblog == "weblogA"} display A {/if}
{if weblog == "weblogB"} display B {/if}
{/exp:weblog:entries}

```

The above worked on an EE1 site but but now on an EE2 site and channel does not work the same.

```
{exp:channel:entries channel="channelA|channelB" limit="1" sort="asc" show_future_entries="yes"}
{if channel == "channelA"} display A {/if}
{if channel == "channelB"} display B {/if}
{/exp:channel:entries}

```

Any advice?

# Answer
> 1 votes
You are looking for `channel_name`

```
{exp:channel:entries channel="channelA|channelB" limit="1" sort="asc" show_future_entries="yes"}
  {if channel_name == "channelA"} display A {/if}
  {if channel_name == "channelB"} display B {/if}
{/exp:channel:entries}

```

See first comment here: http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#comments

# Answer
> 1 votes
Assuming you are using EE1 you'll want to use `weblog_short_name` or `weblog_id` in your conditionals.

```
{if weblog_short_name == "some_weblog_name"}
    ...
{/if}

```

OR

```
{if weblog_id == "1"}
    ...
{/if}

```

As Robson pointed out **"weblog" is specific to EE1.** So if you are using EE2 just replace the word "weblog" with "channel."

---
Tags: conditionals, ifelse, multiple-channels
---


# Question
Title: How to redirect member login to previous page?
I am new to working with Expression Engine, so this might not be possible. The site I am working on has some pages that are private to members only. I'm assuming this is a built in feature of Expression Engine and not some type of add-on. When a member who is not logged in reaches a page which requires login, I would like them to be redirected back to the page they were on after they log in. Currently it is redirecting them to a specific member page (and I'm not sure where that is configured).

**Update:**

After further investigation, there are two "member" modules installed: `Freemember` and `Member`. There is a link to a custom login page and in the html there is a `{login_form}` tag. I can't find where or who defines this variable so I don't know what to do next.

**Update:**

I found the source of the `{login_form}` tag. This was being defined in a template using a plugin called `CE variables`. Here's a sample of the template:

```
{exp:ce_vars:set_content name="login_form"}
{exp:freemember:login form_id="login" return="/member-resources" error_handling="inline" error_delimiters='<small>|</small>'}
    ...some html...
{/exp:freemember:login}
{/exp:ce_vars:set_content}

```

Obviously, I found the source of the redirect (the `return` attribute). So now it is a matter of passing the "return to URL" in the link to the login form.

## Solution:

`Freemember` provides a `PREVIOUS_URL` constant that you can use instead:

```
{exp:freemember:login return="PREVIOUS_URL"}

```

# Answer
> 5 votes
Here's how I'm doing this using Profile:Edit, which is an add-on. I assume Zoo Visitor will support something similar.

If you visit one of my news article pages, because it was linked in an email, at the top of that template I have:

```
{if logged_out}{redirect='/members/login/{segment_1}/{segment_2}'}{/if}

```

You could add all your segments there. The point is, I'm dynamically passing the current URL to my member login form.

Within that login form template, I have my Profile:Edit tag:

```
{exp:profile:login return="/{if segment_3!=''}{segment_3}{/if}{if segment_4!=''}/{segment_4}{/if}{if segment_5!=''}/{segment_5}{/if}" class="nice"}

```

That will look at up to 5 segments to match the URL passed in, and redirect back to it.

You didn't say how you plan on protecting the pages that require login or if you did that already. I assume you're using a tag at the top of those templates to check logged-in/logged-out status and redirecting if the user is not logged in.

# Answer
> 8 votes
I know this is marked answered for 8 months, but here is an answer without any add-ons needed, which is in the original question.

1. Set template access for guests to off. Have it load a login template instead.
2. In the login template do this for the login form:

```
{exp:member:login_form return="{segment_1}/{segment_2}/{segment_3}"}

```

What I like about this solution is that you can send a link to someone through email for example. They get the URL, aren't really redirected, it's just a different template that shows up. When they submit the login form the page reloads with the right template. They never leave the URL they should be on.

# Answer
> 0 votes
Freemember provides a built in PREVIOUS\_URL constant that you can use to achieve this:

```
{exp:freemember:login return="PREVIOUS_URL"}

```

Note that this redirects the user to the page they were visiting *before* your login page. So say your customer is browsing `/blog/first-post`, then they click a login link and are taken to your `/account/login` page. This constant will redirect the user back to `/blog/first-post`.

If on the other hand, you have a login form in your header (or a popup lightbox), and want to redirect the user to the *current* page after login, you can simply omit the `return=""` parameter, as that behavior is the default:

```
{exp:freemember:login}

```

# Answer
> 0 votes
Without add-ons you can do this.

if logged\_in /blog/first-post /if

if logged\_out /account/login/blog/first-post /if

Then use segments 3 and 4 for the return parameter of exp:member:login\_form

---
Tags: members, login, freemember
---


# Question
Title: How do I troubleshoot a member who is unable to log in?
I have a member who can't log into my site via a log in form in a template (not accessing the control panel). He has tried two accounts off the same computer, I can access the site using his account. He doesn't get any feedback after logging in like he's using the wrong password, etc. The page just reloads like he did nothing. I'm not sure how to figure out what the problem is.

I've asked him to clear his cache and cookies and restart, which he has done. I've asked him to download and try using Firefox or Chrome instead of Safari to see if it's a problem with his browser, which I'm getting the feeling is asking too much of him. I have had no problems with the other 25 members who have accessed the site.

A little bit about the set up. I have all the access settings for most of the site set to "no access" for guests with my login page as the template that loads if the person is not logged in. So I think it's not finding anything wrong with his login credentials, hence no errors, but hitting some issue to logging him in and then loads the login page again.

Thanks for any suggestions.

# Answer
> 1 votes
I think his browser has to accept cookies.

Francois

# Answer
> 0 votes
What EE version are you running?
Earlier versions had a problem where if a user was on IPv6, they couldn't log in. This was fixed in later versions.

If he's on IPv6 and you are running an old EE install, you may need to update.

---
Tags: members, login
---


# Question
Title: Storing multiple variables from CE Image tag pair in Stash
I'm attempting to store several variables generated by CE Image's Pair tag, as follows:

```
{exp:stash:set parse_tags="yes" parse_depth="2"}
    {exp:ce_img:pair src="{source_image}"}
       {stash:ee_img_original_width'}{width_orig}{/stash:ee_img_original_width}
       {stash:ee_img_sized_src'}{made}{/stash:ee_img_sized_src}
       {stash:ee_img_sized_width'}{width}{/stash:ee_img_sized_width}
    {/exp:ce_img:pair}
{/exp:stash:set}

```

I've reviewed this post about getting a single var from CE Image, and this one, about grabbing multiple variables from a different tag pair, but I'm not getting anywhere. Thanks in advance!

**Corrected Syntax, Per Nate/Mark's Feedback**

```
<h2>Set Vars</h2>
{exp:stash:set parse_tags="yes" parse_depth="2"}
    {exp:ce_img:pair src="{source_image}"}
        {stash:ee_img_original_width}{width_orig}{/stash:ee_img_original_width}
        {stash:ee_img_sized_src}{made}{/stash:ee_img_sized_src}
        {stash:ee_img_sized_width}{width}{/stash:ee_img_sized_width}
    {/exp:ce_img:pair}
{/exp:stash:set}

<h2>Get Vars</h2>
<p>
    Original Width: {exp:stash:get name='ee_img_original_width'}<br>
    Path to New Image: {exp:stash:get name='ee_img_sized_src'}<br>
    New Image Width {exp:stash:get name='ee_img_sized_width'}
</p>

```

# Answer
You have an extraneous single quote ' in each of your opening tag pairs.

```
{stash:ee_img_original_width'}{width_orig}{/stash:ee_img_original_width}

```

Should be:

```
{stash:ee_img_original_width}{width_orig}{/stash:ee_img_original_width}

```
> 5 votes

---
Tags: stash, ce-image
---


# Question
Title: When member accounts are created in expresso store - group specification
When I have a form submitting to store on a purchase, can I set it so that the account that is created holds the correct member group information? I would like to set someone to pending status. This is my form, can I set it so they are assigned to group 10?

```
{exp:store:checkout form_class="form-horizontal" register_member="yes" return="shop/order/ORDER_HASH"'}

```

So something like this:

```
{exp:store:checkout form_class="form-horizontal" register_member="yes" return="shop/order/ORDER_HASH" group_id='10'}

```

Or will I need to have them fill this information in post-this form? If they don't have an account, does the form create a password for them or does that need to be included?

# Answer
> 3 votes
Store will create a member in the member group you have specified in Member \> Preferences which by default is set to "Members" or Group ID 5 unless you are requiring "manual activation" or "self activation by email" which would place the member in the pending group until they are activated then they will be moved to the default group. Store does not have a tag that would allow you to specify which member group they are assigned to at the template level. You would need to write an extension to allow something like this.

The allow a member to create an account you will need to use either `register_member=""` in the checkout tag or you can optionally allow a user to select a checkbox by adding `{field:register_member}` in your checkout template. Using the `{field:register_member}` and a bit of javascript you can show/hide the member fields that need to be collected. Store will use the `order_email` to create the member and you will only need to have `password` and `password_confirm` to actually create a member but you can also use `username` and `screen_name` both of which will default to the `order_email` if left blank or not included in the form. In addition if you have gone to Store \> Settings \> Member Fields and mapped any member fields those to will be transferred over to the members account after the order is completed.

Full documentation is available here.

---
Tags: expresso-store
---