# Question
Title: Expresso Store + outputting store variables using PHP in XML. " and / are blowing up the whole operation
Alright so let me first say that this particular project is very odd and it has snowballed considerably in the past few months.

I am not a master PHP programmer. What I am is a web developer with three years of experience who had only himself as a resource for the overwhelming majority of this project. Feel free to completely criticize what I have done here, I'm open to it. I'm looking for solutions.

Using:

Expression Engine 2.9.0

Expresso Store 2.3.1

Streeng

The client wanted a pseudo ecommerce solution that would sit on a server + CMS. However, they wanted this platform to be managed and fed by their AS400 Mainframe while also being completely PCI compliant. Expression Engine was a natural fit for most of these demands, and I also chose Expresso because of how easily it integrates with EE. It's a single ecosystem.

So when a customer goes to 'check out' an external file must be generated (in real time) with all of that customers information that he entered. His billing and shipping information + everything he ordered.

I use the hash to create a unique file name on the server.

The problem comes up when a customer puts " or / into one of the form fields. No matter what regex I use, the whole thing explodes the second the process template loads up. I've used various regex for this, but

> ~\[\\\/'\<\>|\]~

is the most generally effective. I had a different version that was wrapped in single quotes and targeted " as well, but it failed. That's why you do not see it included in the code below.

I've also tried the nuclear approach with the following regex (just for testing purposes), but it still results in the same error each time:

```
~['\\\"\^\&\*\(\)\%\$\#\@\!\>\<,\.\/]+~

```

Eliminating these characters is important, because it will mess with the XML file creation process.. And I had to map that out in detail because they instructed me as to how the output should look (must look) for them to interpret the data.

Below is the 'process' template code, which is the final step in the checkout. This goes unseen to the customer except for a spinning processing wheel gif.

```
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Checkout Processing</title>
</head>
<body>
<div style="float: left; position: relative;left: 45%;">
   <div class="float: left; position: relative; left: -45%; height:50px; width:50px;">
   <img height="100" width="100" src="http://www.asus.com/support/images/support-loading.gif"/>
   </div>
</div>
{exp:store:checkout
    return="/checkout/thank_you"
}
    {if no_items}
        {redirect="/products/"}
    {/if}

    {if shipping_name =="" OR billing_name =="" OR billing_address1 =="" OR shipping_address1 =="" OR order_email =="" OR billing_phone =="" OR shipping_phone =="" OR billing_postcode =="" OR shipping_postcode =="" OR billing_country =="" OR shipping_country =="" OR shipping_city =="" OR billing_city ==""}
        {redirect="/checkout/shipping_details"}
    {/if}
<?php exportSQL2(); ?>

<?php
//This function triggers automatically when the page is loaded. It exports the order data into an xml file so that the Mainframe maybe pick it up and process.

   function exportSQL2()
   {

   $EE =& get_instance();
      $fnameData = $EE->db->query("SELECT billing_first_name, billing_last_name, shipping_first_name, shipping_last_name FROM exp_store_orders WHERE order_hash = '{order_hash}'")->row_array();

      $MainframeAccountName = "";

      if ('{member_id}' !="") {
      $MainframeAccountNameQuery = $EE->db->query("SELECT Mainframe_account_number FROM exp_members WHERE member_id = '{member_id}'")->row_array();
      $MainframeAccountName = $MainframeAccountNameQuery['Mainframe_account_number'];
      }

      $billing_first_name= "{billing_first_name}";

      $billing_first_name= preg_replace("~[\\\\/'<>|]~", "", $billing_first_name);
      $billing_first_name= preg_replace('/[^\w ]/', '', $billing_first_name);

      {!--$billing_first_name= htmlspecialchars($billing_first_name, ENT_QUOTES); --}

      $billing_last_name= "{billing_last_name}";
      $billing_last_name= preg_replace("~[\\\\/'<>|]~", "", $billing_last_name);
      $billing_last_name= preg_replace('/[^\w ]/', '', $billing_last_name);

      $billing_address1= "{billing_address1}";
      $billing_address1= preg_replace("~[\\\\/'<>|]~", "", $billing_address1);
      $billing_address1= preg_replace('/[^\w ]/', '', $billing_address1);

      $billing_address2= "{billing_address2}";
      $billing_address2= preg_replace("~[\\\\/'<>|]~", "", $billing_address2);
      $billing_address2= preg_replace('/[^\w ]/', '', $billing_address2);

      $billing_city= "{billing_city}";
      $billing_city= preg_replace("~[\\\\/'<>|]~", "", $billing_city);
      $billing_city= preg_replace('/[^\w ]/', '', $billing_city);

      $billing_postcode= "{billing_postcode}";
      $billing_postcode= preg_replace("~[\\\\/'<>|]~", "", $billing_postcode);
      $billing_postcode= preg_replace('/[^\w ]/', '', $billing_postcode);

      $billing_phone= "{billing_phone}";
      $billing_phone= preg_replace("~[\\\\/'<>|]~", "", $billing_phone);
      $billing_phone= preg_replace('/[^\w ]/', '', $billing_phone);

      $shipping_first_name= "{shipping_first_name}";
      $shipping_first_name= preg_replace("~[\\\\/'<>|]~", "", $shipping_first_name);
      $shipping_first_name= preg_replace('/[^\w ]/', '', $shipping_first_name);

      $shipping_last_name= "{shipping_last_name}";
      $shipping_last_name= preg_replace("~[\\\\/'<>|]~", "", $shipping_last_name);
      $shipping_last_name= preg_replace('/[^\w ]/', '', $shipping_last_name);

      $shipping_address1= "{shipping_address1}";
      $shipping_address1= preg_replace("~[\\\\/'<>|]~", "", $shipping_address1);
      $shipping_address1= preg_replace('/[^\w ]/', '', $shipping_address1);

      $shipping_address2= "{shipping_address2}";
      $shipping_address2= preg_replace("~[\\\\/'<>|]~", "", $shipping_address2);
      $shipping_address2= preg_replace('/[^\w ]/', '', $shipping_address2);

      $shipping_city= "{shipping_city}";
      $shipping_city= preg_replace("~[\\\\/'<>|]~", "", $shipping_city);
      $shipping_city= preg_replace('/[^\w ]/', '', $shipping_city);

      $shipping_postcode= "{shipping_postcode}";
      $shipping_postcode= preg_replace("~[\\\\/'<>|]~", "", $shipping_postcode);
      $shipping_postcode= preg_replace('/[^\w ]/', '', $shipping_postcode);

      $shipping_phone= "{shipping_phone}";
      $project= preg_replace("~[\\\\/'<>|]~", "", $shipping_phone);
      $shipping_phone= preg_replace('/[^\w ]/', '', $shipping_phone);

      $project= "{order_custom4}";
      $project= preg_replace("~[\\\\/'<>|]~", "", $project);
      $project= preg_replace('/[^\w ]/', '', $project);
      {!-- $project= preg_replace('/[^\w ]/', '', '{order_custom4}'); --}
      {!-- $project= htmlspecialchars($project, ENT_QUOTES); --}

      $shipping_account= "{order_custom2}";
      $shipping_account= preg_replace("~[\\\\/'<>|]~", "", $shipping_account);
      $shipping_account= preg_replace('/[^\w ]/', '', $shipping_account);

      $shipping_carrier= "{order_custom3}";
      $shipping_carrier= preg_replace("~[\\\\/'<>|]~", "", $shipping_carrier);
      $shipping_carrier= preg_replace('/[^\w ]/', '', $shipping_carrier);

      $instruction= "{order_custom1}";
      $instruction= preg_replace("~[\\\\/'<>|]~", "", $instruction);
      $instruction= preg_replace('/[^\w ]/', '', $instruction);

      if ('{shipping_method}'=="FREE - FedEx Ground") {
      $shipping_account="";
      $shipping_carrier="";
      }

      $dir = '/home/example/example.com/transfer/out';

{exp:streeng  find="'" replace=""}
      $info ="
<order>
   <order_id>{order_id}</order_id>
   <member_id>{member_id}</member_id>
   <customer_number>".$MainframeAccountName."</customer_number>
   <hash>{order_hash}</hash>
   <date>{current_time format="%Y%m%d"}</date>
   <time>{current_time format="%H%i%s"}</time>
   <action>add</action>
   <email>{order_email}</email>
   <billing_first_name>".$billing_first_name."</billing_first_name>
   <billing_last_name>".$billing_last_name."</billing_last_name>
   <billing_company></billing_company>
   <billing_address1>".$billing_address1."</billing_address1>
   <billing_address2>".$billing_address2."</billing_address2>
   <billing_city>".$billing_city."</billing_city>
   <billing_state>{billing_state_name}</billing_state>
   <billing_postal>".$billing_postcode."</billing_postal>
   <billing_country>{billing_country_name}</billing_country>
   <billing_phone>".$billing_phone."</billing_phone>
   <shipping_first_name>".$shipping_first_name."</shipping_first_name>
   <shipping_last_name>".$shipping_last_name."</shipping_last_name>
   <shipping_company></shipping_company>
   <shipping_address1>".$shipping_address1."</shipping_address1>
   <shipping_address2>".$shipping_address2."</shipping_address2>
   <shipping_city>".$shipping_city."</shipping_city>
   <shipping_state>{shipping_state_name}</shipping_state>
   <shipping_postal>".$shipping_postcode."</shipping_postal>
   <shipping_country>{shipping_country_name}</shipping_country>
   <shipping_phone>".$shipping_phone."</shipping_phone>
   <shipping_account>".$shipping_account."</shipping_account>
   <shipping_carrier>".$shipping_carrier."</shipping_carrier>
   <shipping_method>{shipping_method}</shipping_method>
   <project>".$project."</project>
   <instruction>".$instruction."</instruction>{items}{exp:gwcode_categories entry_id="{entry_id}" excl_cat_id="28|29|30|31|32|33|34|35|36|37|43|40|38|2|27|3|50|51|52|53|48"  style="linear" limit="1"}
   <sample>
      <pattern>{cat_name}</pattern>
      <color>{title}</color>
      <quantity>{item_qty}</quantity>
   </sample>{/exp:gwcode_categories}{/items}
</order>

      ";
{/exp:streeng}

      $file = $dir . '/{order_hash}.xml';
      file_put_contents($file, $info);

      //Creates a backup of the file and stores it in the outArchive folder.
      copy('/home/example/example.com/transfer/out/{order_hash}.xml', '/home/example/example.com/transfer/backup/{order_hash}.xml');
     }
   ?>

    <div class="form-actions">
        <input type="submit" name="submit" value="Place Order" id="submit" class="btn btn-success" style="display:none !important;"  />
    </div>

<script type="text/javascript">
    window.onload = function submit()
    {
        document.getElementById("submit").click(); // Simulates button click
    }
</script>

{/exp:store:checkout}
</body>
</html>

```

The error:

```
Parse error: syntax error, unexpected '"' in /chroot/home/example/example.com/html/system/expressionengine/libraries/Functions.php(688) : eval()'d code on line 70

```

# Answer
It is in general not a great idea to use PHP straight in the template, but that's a story for another day. It would be best to use Expresso Store's developer hooks like the "store\_order\_complete\_end" hook to create and process the XML file on success.

Going with your example: Check the string you are building up in particular at the tag.

`".$instruction."{items}{exp:gwcode_categories entry_id="{entry_id}" excl_cat_id="28|29|30|31|32|33|34|35|36|37|43|40|38|2|27|3|50|51|52|53|48" style="linear" limit="1"}`

You are using double quotes inside double quotes without escaping it. Rather use single quotes around {entry\_id} and the rest of your parameters, like entry\_id='{entry\_id}'.

Does that help?
> 1 votes

---
Tags: expresso-store, php, variable, xml
---


title: Live Look Template

text:
# Question
Title: Live Look Template
This is probably really simple - but I can't find the answer...

We have set up a "Live Look Template" so that editors can preview an entry.

**QUESTION**

*When an editor is logged in to the backend - Is there a way we can make the link going to this Live Look Template open in a new window?*

I have circled the link I'm talking about...

# Answer
> 3 votes
I think the add-on Zenbu will open the live-look previews in a lightbox style modal if you wanted to use that. It's pretty good and gives you the ability to create custom views for entry lists.

However, you could create an accessory which hooked into the live-look links and used Javascript to open them in a new window. The difficulty is in hooking into the links since they don't have any kind of class on them.

You could look for the word "View" in a link or count which column the link is in and target that. Neither way is going to be bulletproof but it might work for your circumstances.

**UPDATE:** Just made an accessory for you. Download accessory to open Live Look links in a new window Unzip it into your expressionengine/third\_party folder and install it from Add-ons-\>Accessories. This just looks for links with the word "View" so it's far from robust but it should do the job in a basic way.

---
Tags: templates
---


# Question
Title: What determines an 'Abandoned cart' in CartThrob and PostMaster?
I'm using Postmaster to send notifications on a 'Cartthrob Abandonded Cart' however I have no idea how to trigger an abandoned cart to test it.

Does anyone know what steps are involved? Or what tables are checked etc?

# Answer
You can set this up in Postmaster -\> Notifications. Ensure that you choose the CartThrob Abandoned Cart notification type.

Just add something to the cart, but don't checkout. Ensure that the time interval is set for your notification. For testing i just added 15 into the minutes column to send me an email after 15 minutes.
> 1 votes

---
Tags: cartthrob, postmaster
---


title: Template Route Already in use

text:
# Question
Title: Template Route Already in use
EE 2.9.0

I'm attempting to set up a template route for a new section of the site I'm working on. However when I do I get the error: **Template Route Already in use**

I've set up a route for the blog/single template which works `/blog/{blog-post:alpha_dash}`

However when I try to set one of up for about/single `/about/news/{news-post:alpha_dash}` The CP highlights both the blog and about/single template and says Route Already in use. Also won't let me set segment required on the about route.

When I refresh the page the blog route is there, but the about route is gone. See attached screenshot.

# Answer
> 4 votes
The problem is having no rule and having `alpha_dash` are exactly the same thing, so the error message is correct, those are duplicate routes. If you added the `:pagination` rule to the `{pagination}` variable, then it should work:

```
/about/news/{pagination:pagination}

```

Also, you'll need to have the `{pagination:pagination}` rule first, since `alpha_dash` would catch any pagination.

# Answer
> 2 votes
Well, Sean. Now, we have a problem. I already had this discussion with EllisLab, but I believe you should too. Their answer was to use something like:

```
/about/news/{news-post:alpha_dash}/{pagination}

```

And to set required segments to no. This way, the route will match:

```
/about/news/{news-post:alpha_dash}/{pagination}
/about/news/{news-post:alpha_dash}
/about/news/{pagination}

```

For me, this makes no sense. In my opinion, the previous segment should always be required because we don't use URLs like `/about/news//something`.

I prefer to be able to use something like:

```
/about/news/{news-post:alpha_dash}|{pagination}

```

By the way, `alpha_dash` will match pagination too.

---
Tags: templates, routing, template-routes
---


title: Accessing P&T Assets files from WYGWAM

text:
# Question
Title: Accessing P&T Assets files from WYGWAM
I just uploaded P&T Assets. Shouldn't I be able to access my Assets directories from a WYGWAM? I don't have any folder listed in the WYGWAM settings. What am I doing wrong?

# Answer
Go into Add-Ons -\> Fieldtypes and click on Settings next to your WYGWAM fieldtype. In there, click on the Settings button. There's a setting called "File Browser". Choose Assets instead of the EE File Manager. Click Submit.

Now, when you're in a WYGWAM field, click on the image icon like usual to add an image, then click "Browse Server". This will bring up the Assets panel.
> 1 votes

---
Tags: assets, wygwam
---


# Question
Title: Channel Forms Upload Image missing directory info
I have a channel form I am trying to get working. There is a file upload which looks like this.

```
<div class="form-group">
  <label for="story_image">Upload a picture</label>
  <div id="story_image" class="btn btn-gray-light btn-file">
    <span class="feedback">Choose a file: </span>
    <span class="glyphicon glyphicon-upload"></span>
    <input type="file" class="form-control" name="story_image">
  </div>

  <input type="hidden" name="story_image_directory" value="13">
  <input type="hidden" id="story_image_hidden_file" name="story_image_hidden_file" value="">

  <p class="help-block">Image size should be no larger than 800px square and no larger than 2mb.</p>
</div>

```

Then when I check the entry I see the following.

```
{filedir_13}tumblr_n4z1wlApId1sljr6oo1_500.jpg

```

I can use the {field:story\_image} and the upload will work correctly, but for some reason when I strip out all the extra markup it's broken. Any thoughts?

# Answer
From memory, I think you have to add square brackets after the file field like this

```
<input type="file" name="my_field_name[]" />

```

**UPDATE:** Also the docs say to format the hidden file like this:

```
<input type="hidden" name="my_field_name_hidden_file" value="{my_field_name}{file_name}{/my_field_name}" />

```
> 0 votes

# Answer
The problem was with a jQuery conflict. I had 1.9.x and that was causing an error. Once I put the jQuery in the header and included it in the script it works fine. It's disappointing that this has to be set up this way given that most people put JS in their footer and jQuery 1.8.3 is ancient.

Oh, well. At least I got it working.
> 0 votes

---
Tags: safecracker, file-uploads
---


title: Zoo Triggers, Structure & MSM Issue

text:
# Question
Title: Zoo Triggers, Structure & MSM Issue
I have MSM setup for 2 sites. One site uses Structure and I have implemented Zoo Triggers for category functionality for a blog. All is working as it should.

The second site does not use MSM but has a blog that uses categories.

I am unable to get categories working in the second site using regular EE categories or Zoo Triggers.

Any help is appreciated.

# Answer
There is a new version of Zoo Triggers (1.2.5) on devot:ee which should fix this issue.
> 0 votes

---
Tags: multi-site-manager, structure, zoo-triggers
---


# Question
Title: No segment variables - Zoo Triggers and MSM
We running a site which uses MSM and Structure. To get around the 'category' issue in Structure, we've added Zoo triggers, which works great on the `default_site` but not so well in the MSM sites.

In the MSM sites, we're pulling team entries from the master site, but in doing so, we seem to have lost all segment variables.

I've tried `{segment_4}`, `{triggers:cat_name_1}`, `{segment_4_category_id}` (Low seg2cat), `{last_segment_category_id}` (seg2cat), `{triggers:cat_id_1}` and `{triggers:cat_id_last}` and none of them return a value.

The triggers variables just output the tag to screen, but I would have expected the native tag to work in this case, or seg2cat. My guess is the parse order gets borked by the structure/triggers combination, but without segment variables, we're pretty limited in terms of what we can do on the page.

We're running 2.9.0 with the latest version of structure and triggers.

Anyone any thoughts?

# Answer
> 0 votes
The latest update for Zoo Triggers (1.2.5) released today fixed this issue :-)

# Answer
> 0 votes
I don't believe you can access site URLs from another site using MSM. I think it's an EE limitation.

---
Tags: multi-site-manager, structure, segments, zoo-triggers
---


# Question
Title: How to get the Channel Form » Grid » Relations options?
I'm doing a customized Channel Form but I'm having trouble getting the options in the relations within my grid...

MENU (title) » DISH (text on grid) » » INGREDIENT (relationships on grid)

But in my Channel Form I have tried to load ingredients with exp:channel:entries - but it only gets the entry\_id / title from the entry being updated in the form.

I can't figure out how the tag is build...

ex.:

```
    < select multiple name="field_id_12[rows][new_row_0][col_id_4][data][]">
        {dishes}
             {ingredients:entry_id} +
        {/dishes}
    < /select>

```

Anyone who has the knowledge? :-)

THX

# Answer
Ha, not sure if this is exactly what you want, but I was able to once map out how to tie relationships to a grid for our company. I hope this helps:

```
{field group:field label}
      {field group:field label: grid field name 1} --> one item
      {field group:field label: grid field name 2} --> another item
{/field group:field label}

```
> 1 votes

---
Tags: channel-entries, safecracker, relationships, grid
---


# Question
Title: CSRF Conflict Creating Form and Logout Errors
The contact form on a site I am currently developing was displaying an error when trying to submit and says the *form has expired*.

Based on feedback I found in various forums, the workaround I have found was to turn off CSRF protection through the config file using this code:

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

```

This fixes the form, but creates another bug that prevents users from being able to log out, causing this error: *You are not authorized to perform this action.*

Does anyone have a solution that will fix both problems?

# Answer
I found an answer that seems to be working. Here are the details in case anyone else is having a similar issue.

I kept the code in the config.php file that turns off CSRF protection:

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

```

Then to fix the issue with logout failing, I implemented an edit suggested by Robin Sowell on the Ellis Lab forum. The edit is in the file "system/expressionengine/modules/member/mod.member\_auth.php":

Find this code in that file:

```
if ($token != CSRF_TOKEN)
{

```

and change to:

```
if ( ! bool_config_item('disable_csrf_protection') && $token != CSRF_TOKEN)
{

```
> 0 votes

---
Tags: error, logout, csrf
---


# Question
Title: Solspace Calendar filter by days, not by dates
I'm using Solspace calendar and I'm wondering is it possible to filter the events by weekdays? For example, I'd like to show events that only occur on Monday to Friday, I can't really see any way of doing it in the documentation.

# Answer
> 1 votes
You can do this using conditionals.

If you're **looping through each day**, you can filter by a day, eg. Sunday, this way:

```
{exp:calendar:cal date_range_start="today" date_range_end="+6 months" pad_short_weeks="n"}
  {display_each_day}
    {if '{day format="%D"}' == 'Sun'}
      <p>{day format="%Y.%m.%d"} is on a Sunday. Here are the events on this day:</p>
      <ul>
      {events}
        <li>{event_title}</li>
      {/events}
      </ul>
    {/if}
  {/display_each_day}
{/exp:calendar:cal}

```

Alternatively, if you're **looping through events**, you could use `{event_start_date}` to build a similar filtering conditional:

```
{exp:calendar:cal date_range_start="today" date_range_end="+6 months" pad_short_weeks="n"}
  {events}
    {if '{event_start_date format="%D"}' == 'Sun'}
      <p>The following event is on a Sunday:</p>
      <ul>
        <li>{event_title}, starts on {event_start_date format="%Y.%m.%d"}</li>
      </ul>
    {/if}
  {/events}
{/exp:calendar:cal}

```

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


# Question
Title: Best way to edit all custom variable values and re-import
running ExpressionEngine with Cartthrob - we've come up against a situation where the client has requested to remove a global Tax setting, so that they can have all prices on the site already inclusive of VAT.

The price is currently set as a custom variable, alongside some other custom variables for previous price settings and others (we inherited this site from another dev team). Our problem is that we now need to add 20% to all prices, to bring them in line with correct pricing now there is no global tax in effect.

What is the best way of achieving this, in a way that doesn't involve manually changing each product entry? My initial thought was to perform an export of the dataset (CSV or otherwise) for products, create a calculation in the resulting file to generate new prices, and then reimport into EE. I tried exporting by creating a custom export template with download csv headers, but it resulted in an empty export. I also tried looking to the database for manipulating via sql, but of course the custom variables are not stored within a flat table structure.

Any advice would be greatly appreciated - worth noting I do need to be able to import this back in at the end of the process too! Thanks in advance,

Ben

# Answer
How were the actual variables being declared or set to begin with? Were they being set in the CP or a master configuration file?
> 0 votes

---
Tags: channel-entries, cartthrob, custom-fields, import, export
---


title: how to limit field pack list

text:
# Question
Title: how to limit field pack list
How do I limit the number of displayed list items? I tried {list\_name limit='2'} which didn't work. Also is there anyway to select which list items to be displayed?

# Answer
> 0 votes
You cannot limit how many entries are returning from a Field Pack List field.

To filter the items displayed, you could do a conditional check on each item:

```
{list_name}
    {if item != "foo"}{item}{/if}
{/list_name}

```

---
Tags: field-pack
---


# Question
Title: Excluding entries based on Date Field Type
Im wondering if anyone can help me figure out if this is possible.

I have entries that have a Date Field Type and I want to hide entries that have expired passed the date set in the Date Field Type not the entry-date.

Thanks

# Answer
> 1 votes
can't you just use expire date field under the date tab? and show\_expired="no"

# Answer
> 0 votes
You can use my EEvent Helper extension to do this - it allows you to select "start" and "end" dates for entries, and clone those custom field dates to the Entry Date and Expiration Date respectively.

---
Tags: date, date-field-filter
---


title: Move playa field within a Matrix field

text:
# Question
Title: Move playa field within a Matrix field
So our current setup has a channel with a playa field. This worked well so far BUT now we need to store specific values for each relationship (eg: The related field will need a catalogue number, specific price etc so each child relationship can have unique values as well).

From the top of my head this could be achieved by creating a new matrix/grid field in the same channel with all those unique columns (playa relationship field, catalogue number, price, etc).

My questions is, would that be the best solution for this issue? If so, I'm guessing that a MySQL query with the right format should do the job?

Cheers, Alberto

# Answer
> 1 votes
Correct - it'll have to be a Matrix field, as I believe that Playa is not compatible with the Grid.

You'll have to:

* find all of the entries in `exp_playa_relationships` which use the old `parent_field_id`
* change each row to the new `parent_field_id`
* insert a new entry in `exp_matrix_data` with the correct `entry_id` and `field_id`
* add the new `parent_col_id` and `parent_row_id` (which will be `0`) to your existing `exp_playa_relationships` row

---
Tags: matrix, playa
---


# Question
Title: focuslab config - ip address for host not working
I've got the focuslab config set up and everything works fine on localhost. However my staging server it doesn't work. I've determined that it's likely due to using an ipaddress in the host for config.env.php

```
    case '111.222.333.444' :
        define('ENV', 'stage');
        define('ENV_FULL', 'Staging');
        define('ENV_DEBUG', FALSE);
    break;

    default :
        define('ENV', 'local');
        define('ENV_FULL', 'Local');
        define('ENV_DEBUG', TRUE);
    break;

```

If I take one of my domains and use it as a pointer domain on the same server and change the ip to the domain it works. Unfortunately I can't keep that domain pointed there as I did that just for testing.

So the non work is `http://111.222.333.444/~username` but if I point a domain to the same host it works.

Is there some way to get master config to work with an ip address instead of a domain?

# Answer
That's because the config file is checking the value of `$_SERVER['HTTP_HOST']`. What you need to check is `$_SERVER['SERVER_ADDR']`.

try this:

```
if(!empty($_SERVER['HTTP_HOST']))
{
    switch (strtolower($_SERVER['HTTP_HOST'])) {
        // Standard case statements here
    }
}
else
{
    if($_SERVER['SERVER_ADDR'] == '111.222.333.444')
    {
        define('ENV', 'stage');
        define('ENV_FULL', 'Staging');
        define('ENV_DEBUG', FALSE);
    }
}

```
> 3 votes

---
Tags: focus-lab-master-config
---


# Question
Title: Structure & Channel Forms not playing nicely
I'm using a new installation of EE (2.8.1) with the latest Structure version.

I have a channel which allows entries to be submitted by the front-end user. However, when an entry is submitted via the front-end, it throws these errors:

```
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Channel_form_lib::$EE

Filename: structure/ext.structure.php

Line Number: 651

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: structure/ext.structure.php

Line Number: 651

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: structure/ext.structure.php

Line Number: 651

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Channel_form_lib::$EE

Filename: structure/ext.structure.php

Line Number: 669

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: structure/ext.structure.php

Line Number: 669

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: structure/ext.structure.php

Line Number: 669

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Channel_form_lib::$EE

Filename: structure/ext.structure.php

Line Number: 683

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: structure/ext.structure.php

Line Number: 683

A PHP Error was encountered

Severity: Notice

Message: Trying to get property of non-object

Filename: structure/ext.structure.php

Line Number: 683

A PHP Error was encountered

Severity: Notice

Message: Undefined variable: hidden

Filename: structure/ext.structure.php

Line Number: 730

A PHP Error was encountered

Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /nfs/c08/h01/mnt/148871/domains/slddev.sarahlynndesign.com/html/ac/system/codeigniter/system/core/Exceptions.php:170)

Filename: libraries/Functions.php

Line Number: 447

```

The entry is submitted, but it will not take me to the required location after submission, or will it send out an email notification.

# Answer
I've just had this issue too but managed to fix it by doing the following:

* Go to Addons \> Modules \> Structure
* Click Module Settings in the top right
* On this screen click the `convert to using the 2.7 hooks` link (bottom option) and then press Save Module Settings

This worked fine for me however I'm not sure of any implications it may have?
> 1 votes

# Answer
Are you using the suggested code? http://buildwithstructure.com/documentation/safecracker/
> 0 votes

---
Tags: channel, channel-form, module, structure, php-errors
---


# Question
Title: Sublime text edit and ExpressionEngine Syntax - Not highlighting
Has anyone successfully gotten EE tags to properly highlight in Sublime Text 2? I tried installing the default ExpressionEngine package available from the package installer and it doesn't do anything. I also tried this one https://github.com/mrw/ExpressionEngine2-Sublime-Text-Bundle and it throws errors when I launch it. Any suggestions?

I am running OSX 10.8.2 and Sublime Text 2.0.1 (trial)

# Answer
I don't know if you're using the Monokai colour scheme, but if you are you'll need to hack it to make the EE tags go purple - just add the word 'constant' on line 96 of ~/Application Supprt/Sublime Text 2/Packages/Color Scheme - Default/Monokai.tmTheme like this:

The end result should look like this:

Edit to add that I'm now using the Spacegray Eighties theme which I prefer a bit. However by default the EE tags will be a very similar orangey red colour to any HTML markup. To improve that and turn the EE tags blue you need to edit line 240 of `base16-eighties.dark.tmTheme` to change the color of the 'Constants' entry to #6699cc - The end result would then look like this:

Further edit to add that in ST3, the path to the file you need to change is now ~/Library/Application Support/Sublime Text 3/Packages/Theme - Spacegray/base16-eighties.dark.tmTheme ... Alternatively you can install Package Resource Viewer to get there directly in ST: https://github.com/skuroda/PackageResourceViewer
> 9 votes

# Answer
All of the ExpressionEngine tmbundle's derived from Tim Kelty, including the repo linked to in the question should contain the scope `text.html.ee` which can be targeted by adding a node inside the theme array:

```
    <dict>
        <key>name</key>
        <string>Expression Engine</string>
        <key>scope</key>
        <string>text.html.ee</string>
        <key>settings</key>
        <dict>
            <key>fontStyle</key>
            <string />
            <key>foreground</key>
            <string>#c6b1ed</string>
        </dict>
    </dict>

```

Optionally, you can add a background key/pair and/or target specific scopes. Additional scopes are found as string values in https://github.com/mrw/ExpressionEngine2-Sublime-Text-Bundle/blob/master/Syntaxes/ExpressionEngine.tmLanguage

I also find the sublime plugins ColorPicker and ColorSchemeEditor helpful in editing themes.
> 0 votes

---
Tags: syntax, editor
---


# Question
Title: Does CartThrob 2 use SSLv3 in it's Authorize.net payment gateway?
Due to the POODLE vulnerability in SSLv3, Authorize.net is shutting down their support for SSLv3 on Nov 4, 2014. Here's a excerpt from the notice:

> To that end, on November 4, 2014, we will be disabling the use of SSLv3 within our systems. This means that if your website or shopping cart solution uses SSLv3 to send transactions to Authorize.Net, you will no longer be able to process transactions. You will also no longer be able to access any secure Authorize.Net pages from IE6.

http://www.authorize.net/blog/?page\_id=5561617

Do the Authorize.net payment gateway plugins in CartThrob 1 or 2 use SSLv3? How can I check to make sure?

# Answer
> 1 votes
From what I understand, CartThrob's Authorize.net gateway plugin uses curl to communicate with Authorize.net. What kind of SSL connection curl uses depends on your server's configuration, not CartThrob.

To test wether your server has SSL 3 enabled, you can use Qualys' SSL Server Test: https://www.ssllabs.com/ssltest/

This is also an excellent article about how to test for the POODLE vulnerability, disable SSLv3 support on your server, and protect yourself by disabling SSLv3 support in your browser.

**SSL V3 GOES TO THE DOGS - POODLE KILLS OFF PROTOCOL**
https://scotthelme.co.uk/sslv3-goes-to-the-dogs-poodle-kills-off-protocol/

---
Tags: cartthrob, payment-gateway, ssl, mightybigrobot
---


title: 404 on some files

text:
# Question
Title: 404 on some files
**Is there anything in EE that would cause some files under web root to be accessible while others return a 404?**

For example, I have a `/js/` with about 10 JS files. About 8 of them are accessible, but the other 2 returns a 404 error (I have verified that the files do exist on the server). Same with my `/cache/` folder (where Minimee files are saved); the generated files are returning 404.

**UPDATE 1:**

Here's the screen shot of the error I am getting:

It's an EE error page, so this has to do with EE somehow, right?

**UPDATE 2:** Directory listing of `/js/`

As I am just clicking on these links that are produced as a result of Apache's directory listing, I am not inclined to believe that I am running into any case sensitivity issues. The two unvisited links are the ones returning 404s.

# Answer
First thing to check is your .htaccess file.

Remove everything in it and use the code sample provided by EllisLab in the docs for removing index.php: https://ellislab.com/expressionengine/user-guide/urls/remove\_index.php.html

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

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

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

```
> 3 votes

# Answer
First, look at your htaccess file. It looks like you're able to access other files with a .js extension, so your javascript folder is probably ok. You might just be setting your file path to a file that isn't case-sensitive correct.

Keep in mind that different operating systems handle case sensitivity differently. On OS X, files are case insensitive (same goes on Windows), while on Linux, files ARE case sensitive. So, filename.js and FileName.js are 2 different files on Linux.
> 0 votes

# Answer
I know you have your answer but it can be useful to ls -al and check permissions/ownership on the files too - if you're managing your own server it can be persissions/groups issues that cause these errors too. just adding this as another tool in the toolbox :)
> 0 votes

---
Tags: apache
---


title: Low Search Filter with require_all

text:
# Question
Title: Low Search Filter with require_all
I'm trying to show products that are in X and are also in Y categories. Not all products in X and all products in Y.

Low kindly replied suggesting adding "require\_all" to the results tag. This works a charm, but only seems to work a charm when there is more than 1 category in the search query.

Search form:

```
{exp:low_search:form
    query="{segment_3}"
    result_page="{prv_template_group}/filter"
    collection="entry_product"
}

    {exp:gwcode_categories
        channel="{prv_channels}"
        depth="1"
        style="linear"
    }

        {if group_start}
            <ul class="list-horizontal list-pill border pad mobile-no-display">
                <li class="title">
                    <h6>{cat_group_name}</h6>
                </li>
        {/if}

            <li>
                <a href="#" class="custom-checkbox{if "{cat_id}" IN ({low_search_category})} active{/if}" data-filter-desktop="filter-{cat_group_id}" data-value="{cat_id}">
                    {cat_name}
                    <input type="checkbox" name="category[]" value="{cat_id}"{if "{cat_id}" IN ({low_search_category})} checked="checked"{/if}>
                </a>

            </li>

        {if group_end}
            </ul>
        {/if}

    {/exp:gwcode_categories}

    <ul class="list-horizontal list-pill pad">
        <li class="title-offset">
            <input type="submit" class="button large" id="filter-button" value="Update Results">
        </li>
        <li>
            <a href="{site_url}index.php/{prv_template_group}" class="button grey adjust">Clear Filter</a>
        </li>
    </ul>

{/exp:low_search:form}

```

Filter template:

```
{exp:low_search:results
    query="{segment_3}"
    limit="12"
    result_page="{prv_channels}/filter"
    channel="entry_product"
    require_all="category"
}

    {if low_search_no_results}

        {lv_alert_search_null}

    {/if}

    {entry_id}

    {paginate}

        {pagination_links}

            <div class="section pad-b">

                <div class="section-container">

                    <div class="center">

                        {previous_page}
                            <a href="{pagination_url}" class="pagination-arrow prev"></a>
                        {/previous_page}

                        <ul id="pagination-numbers">
                            {page}
                                <li class="{if current_page}active{/if}">
                                    <a href="{pagination_url}">
                                        {pagination_page_number}
                                    </a>
                                </li>
                            {/page}
                        </ul>

                        {next_page}
                            <a href="{pagination_url}" class="pagination-arrow net"></a>
                        {/next_page}

                    </div>

                </div>

            </div>

        {/pagination_links}

    {/paginate}

{/exp:low_search:results}

```

Any ideas why this is happening?

# Answer
Took a look and saw you were using the same fields twice: once for mobile, once for desktop. One of those would be hidden based on User Agent, but the checkboxes would be checked anyway, as they were still in the DOM.

That means checking one checkbox would actually check 2, resulting in a parameter like `category="1&1"`, which triggered the No Results.

Removing the hidden fields from the DOM solved the issue.
> 1 votes

---
Tags: search, module, low-search, low
---


# Question
Title: CartThrob Gift Certificates Add to Cart form causing fatal error
I just purchased the Gift Certificates plugin yesterday and am setting up the Add to Cart form today. Here is the current version of the tag:

```
{exp:cartthrob_gift_certificates:add_to_cart_form return="shop/cart" on_the_fly="yes" allow_user_price="yes" shipping_exempt="yes"}
    <label for='price'>Price</label>
    <select name='price' id='price' />
        <option value="25">$25</option>
        <option value="50">$50</option>
        <option value="100">$100</option>
        <option value="250">$250</option>
        <option value="500">$500</option>
        <option value="1000">$1000</option>
    </select>

    <label for='gift_certificate_email_address'>Recipient Email Address</label>
    <input type="text" value="" name="gift_certificate_email_address" id="gift_certificate_email_address" />

    <label for='gift_certificate_note'>Note</label>
    <input type="text" value="" name="gift_certificate_note" id="gift_certificate_note" />

    <div class="control-group full">
        <div class="form-actions">
            <input class="add-cart" type="submit" value="Add to Cart">
        </div>
    </div>

{/exp:cartthrob_gift_certificates:add_to_cart_form}

```

This is currently causing the following fatal error:

There is an older forum post that lists another fatal error in a different file, but references sort of the same situation (I was looking for how to let the user choose the price for the gift certificate).

Does anyone know what is causing this error?

EE 2.8.0

CartThrob Pro 2.6

CartThrob Gift Certificates 1.25

I also have CartThrob Credits 1.21 installed if that plays a factor.

# Answer
Spoke to Mr. Barrett at CartThrob on a support call for a separate issue and I mentioned this problem I was having. He had me replace the gift certificates add to cart form tag

```
{exp:cartthrob_gift_certificates:add_to_cart_form}

```

with the standard cartthrob form tag, but adding in a `gift_certificate="yes"` parameter

```
{exp:cartthrob:add_to_cart_form gift_certificate="yes"}

```

This has resolved my issue.
> 0 votes

---
Tags: cartthrob, giftcertificates
---


# Question
Title: Where are relationship field data stored?
In the EE database, I see that `exp_channel_fields`.`field_id` = 4 refers to a relationship in my `Channel-A` (channel\_id = 1). I assume that channel data for that field should be stored in my `exp_channel_data`.`field_id_4`. Is this right? I do not see any data in that column, despite me going into Channel-A and making sure that I have selected a value from the relationship field.

I'm trying to build a query that gets a distinct list of url titles from the relationship field if that title was selected in Channel A.

# Answer
Relationships are stored in `exp_relationships` \- the `exp_channel_data` content for a relationship field is irrelevant.

So your query would need to do a join between `exp_channel_titles` and `exp_relationships`.
> 2 votes

---
Tags: database, fields
---


# Question
Title: Relationships to multiple channels: how to know which channel you're picking from?
I have a relationships field which pulls in from two channels: Posts and Programs. When the client is creating a page, this field enables them to manually relate the page to a number of blog posts and nonprofit programs, which appear in a "Related Content" section.

But EE 2.8's Relationships field only shows the title of an entry in the relationship picker. If a Post and a Program have similar titles or the same title, there seems to be no way for the client to know which is which.

Has anyone found a solution or workaround for this?

I've sort-of found a workaround using Playa, but it's not great. Playa is an addon for managing relationships. It allows relations to multiple channels and its related entry picker does let you *filter* by channel. Unfortunately...

1. It requires several clicks to start filtering by channel
2. While it lets you filter by one channel at a time, you have to keep switching the filter back and forth to select multiple entries from different channels.
3. Once you've picked relationships and they appear in the right column, there's no indication of which channel they came from.

I'm new to EE, but I could imagine creating an addon which simply overrides the output of the Relationships picker to show something like `<channel_name>: <title>` instead of `<title>`.

# Answer
> 0 votes
I ended up solving this with a small patch to two EE core files. First, I have the relationships fieldtype query select the name of the channel:

```
// system/expressionengine/fieldtypes/relationship/ft.relationship.php:339
// Old
->select('channel_titles.entry_id, channel_titles.title')
// New
->select('channel_titles.entry_id, channel_titles.title, channels.channel_title')
->join('channels', 'channel_titles.channel_id = channels.channel_id')

```

Then I output the channel title before each listing in the relationships picker:

```
<!-- system/expressionengine/fieldtypes/relationship/views/publish.php:34 -->
<!-- As the first line within the <label> -->
<?= $row['channel_title'] ?>:

```

Now, when an admin sees two entries both called "Something Awesome" in the relationship picker, they'll know which is which:

---
Tags: relationships
---


# Question
Title: How to include search params in plugin with TMPL->tagparams
I'm building a custom plugin tag pair which returns channel entries, following the excellent answer to this question. Almost everything seems to be working: I set the `TMPL->tagparams` array to my custom params, instantiate a `new Channel()`, and return its entries.

I'm searching a "classes" channel where entries have a "weekday" custom field with values like "Monday", "Tuesday", etc. In the case, I want to return the first 5 classes on Mondays.

```
$this->EE->TMPL->tagparams = array('channel'        => 'classes',
                                   'limit'          => '5',
                                   'search:weekday' => '=Monday');

if ( ! class_exists('Channel')) {
  require_once(APPPATH.'modules/channel/mod.channel.php');
}
$channel = new Channel();

return $channel->entries();

```

EE seems to be ignoring the `search:weekday` param. It's returning the right channel and enforcing the limit, but it's returning all results, not just results with "Monday" for their "weekday" custom field. How can I use search params in a plugin like this?

**Update:** to provide more use-case info and clarify that I'm searching a custom field with the search param.

# Answer
> 2 votes
The search parameters belong in a different property of the Template object: `ee()->TMPL->search_fields`

So use something like this:

```
ee()->TMPL->search_fields['weekday'] = '=Monday';

```

# Answer
> 0 votes
Ah - this is because the `search` parameter will only search custom fields - it won't search the `title` (or any other field which resides in `exp_channel_titles` as opposed to `exp_channel_data`).

What you'll have to do if you want to support this in your plugin is check to see if that parameter was passed, and if so, do a separate database query for all titles including that phrase. Then, concatenate the resulting Entry IDs into a pipe-delimited string, and feed that back as the `entry_id` parameter on `ee()->TMPL->tagparams`.

---
Tags: ee2, add-on-development, plugin
---


# Question
Title: Password Reset Error: This form has expired. Please refresh and try again
Running EE 2.9.0 and MSM and I am having trouble with the Reset Password function. When I enter my email and click submit I get the following error:

> **The following errors were encountered**
>
> This form has expired. Please refresh and try again.
>
> Return to Previous Page

Here is the code that I am using for the login form and the link to the password reset:

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

<p><label>Username</label><br />
<input class="text" type="text" name="username" value="" maxlength="32" class="input" size="25" /></p>

<p><label>Password</label><br />
<input class="text" type="password" name="password" value="" maxlength="32" class="input" size="25" /></p>

<p><input type="checkbox" name="auto_login" value="1"> Auto-login on future visits</p>

<p><input type="submit" name="submit" value="Submit" /></p>

<p><a href="http://www.sitexyz.org/member/forgot_password">Forgot your password?</a></p>
<p>Not registered yet? <a href="http://www.sitexyz.org/member/register">Register Now</a>.</p>

{/exp:member:login_form}

```

No amount of refreshing makes a difference. This affects users across browsers and locations.

Welcoming all guidance to a solution.

# Answer
> -1 votes
I found the solution to my problem. While the link above does indeed go to a password reset request form, the correct link should be:

```
http://www.sitexyz.org/admin.php?S=0&D=cp&C=login&M=forgotten_password_form

```

# Answer
> 2 votes
You need to include a CSRF token as a hidden field. You can generate one easily enough with

```
<input type="hidden" name="csrf_token" value="{csrf_token}">

```

Documentation here

---
Tags: error, forgot-password
---


title: Unable to use Assets in in HTTPS

text:
# Question
Title: Unable to use Assets in in HTTPS
Changed my Control Panel to https, but assets doesn't show images nor let me load. In http it works fine, but when i change the address to https, according to firebug, the address https://myurl.com/index.php gets redirected. I already have `$config['assets_site_url'] = "/index.php";` on my config file, so what am i missing?

# Answer
It's also worth noting that using protocol relative ( //domain.com ) will work in most situations. This allows you to not have to hardcode a protocol specific url. Helpful when you're using the same code on a live HTTPS site as well as a local, HTTP site.
> 2 votes

# Answer
Just make sure your site url and all of your url paths in your admin \> general configuration are https:// and also go to your content \> file \> file upload preferences and make sure that the url path there is https://. Also if you are hard coding the urls in your html head when attaching assets like css and js make sure those are https:// as well.
> 2 votes

---
Tags: assets, ssl
---


title: Date When A Channel Field Was Added

text:
# Question
Title: Date When A Channel Field Was Added
Looking at the database, is there anyway to find out when a particular Channel field was added to EE?

# Answer
It doesn't look like it. The only field that could hold that data is the field\_settings column, and that just has a few settings in an array that are serialized.

```
Array
(
[tagger] => Array
(
[show_most_used] => yes
[single_field] => no
)

[field_show_smileys] => n
[field_show_glossary] => n
[field_show_spellcheck] => n
[field_show_formatting_btns] => n
[field_show_file_selector] => n
[field_show_writemode] => n
)

```
> 2 votes

---
Tags: database
---


title: Edit History For A Channel Entry?

text:
# Question
Title: Edit History For A Channel Entry?
Is there a way to see what the edit history is of channel entry? I'm happy to look into the database, if needed.

# Answer
> 1 votes
According to the user guide, if you have Entry Versioning enabled in Admin ‣ Channel Administration ‣ Channels, a Revisions tab will appear on the entry publish/edit screen allowing you to see all of the revisions for the entry.

---
Tags: database
---


title: Stash regex query

text:
# Question
Title: Stash regex query
I'm using Stash to set and retrieve a list based on channel entries. I want to filter the list by a 'column' of data defined by a pipe-delimited set of values.

I'm having trouble though getting the regex to work. So, for example I have the following data in my list:

```
4|4|4|4|2|2
2|2|2|2
9|9|9|2|2
2|2|2
9|9|9|2
2|6|3|4|5|9|6|7|2

```

I'm using the following regex:

```
{exp:stash:get_list name="paper" parse="inward" match="#^((.*2).*)$#" against="parents"}

```

But only two of the above are being returned in the list:

```
4|4|4|4|2|2
2|6|3|4|5|9|6|7|2

```

If I test this pattern on Regex Tester it returns all results as expected.

Any thoughts on why this might be happening or how better to achieve this (so returns all data with 2)? I've tried simpler regex patterns (eg `#2#` or `#2+#`) with no success.

Thanks

Cole

# Answer
Surrounding each of the values with a separator, including the start and end of the index makes matching simple and ensures you match a '2' and not '22' or '212' (for example). I tend to use `@` or `/` rather than `|` so that I don't need to escape the pipe in the regex.

```
@4@4@4@4@2@2@
@9@9@9@2@2@
etc

```

Now you can easily match a specific number with:

```
{exp:stash:get_list name="paper" match="#@2@#" against="parents"}

```

Or either of two numbers:

```
{exp:stash:get_list name="paper" match="#@2@|@4@#" against="parents"}

```

Or require two numbers:

```
{exp:stash:get_list name="paper" match="#^(?=.*@2@)(?=.*@4@)#" against="parents"}

```

More on filtering with a custom index column here: https://github.com/croxton/Stash/wiki/Filtering%20lists%20with%20match%20against
> 1 votes

---
Tags: stash, regex, regular-expressions
---


title: Assets thumbs not being generated

text:
# Question
Title: Assets thumbs not being generated
All of a sudden, thumbs are not showing in Assets. The folders are being created in the cache/assets/thumbs folders when files are uploaded, but no image is generated.

The odd part is that in my dev environment the thumbs are being created.

2.8.1 EE 2.4 Assets

# Answer
> 1 votes
It turns out that the server image generation modules were uninstalled during a routine patch upgrade. The servers are managed on Rackspace. It took hours on the phone with RS to figure it out.

---
Tags: assets
---


# Question
Title: Low Events …. How do I set repeating events
How do I set repeating events. If I have a dance show and it plays for three consecutive nights, how do I display that. If I put end date in (:duration), its says 3 days and 1 hour.

I what it to wright it 3 times within one channel entry.

Example:

Event Title

November 4, 2014, 8pm
November 5, 2014, 8pm
November 6, 2014, 8pm

Event Description

---

I am stuck .... I got everything else figured out, first time user.

Best, Seeingis

# Answer
Robson is right: Low Events doesn't support recurring events.

Low Events uses this definition to determine what an 'event' is: **an event is a single entry with a single start date/time and optional end date/time**. According to that definition, you're actually looking at 3 events (with the same title).

There are 2 ways to get what you're describing. The simplest solution is to just mention the three different dates in the description field of a single entry. The single entry can then span 3 days.

The other solution is to use Relationships. Create 2 channels: Events and Occurrences. The Events channel contains event descriptions, without dates. The Occurrences channel contains the Low Events field and a relationships field where you can choose an Event. In your templates, you then list the Occurrences and display the event title and description using the relationship tags and vars.
> 3 votes

# Answer
Low Events doesn't support recurrence.

From its own website:

> Low Events \[...\] keeps things simple by not having repeatable events and their obtuse rules...
> 0 votes

---
Tags: low-events
---


title: EE Password Retrieval Email?

text:
# Question
Title: EE Password Retrieval Email?
I have a state-level site with members who are imported from a CSV file. Their passwords cannot be changed or edited on the front-end as said passwords are assigned by the national-level and passed down to the state-level.

Basically, I need a forgot password email that just sends their existing password (stored as a custom member field) to their email address. I've scoured devot-ee and this site, but cannot find a solution. I'm using Solspace User module to generate my password reset email, which ideally looks like this:

```
Hi {name},

Your login information for the {site_name} website is:

Email: {email}
Password: {password}

Thank You

{site_name}
{site_url}

```

Anyone got any ideas?

# Answer
Passwords in EE and also used by the Solspace User module (and Freemember - the free alternative to User) are all one-way encrypted. So when a user logs in, in encrypts their password and matches it to the encrypted version held in the database. This means the password is never and can never be decrypted - this provides the best security.

So the email template you're referring to in the User module isn't a password reminder, but a password reset (even though the documentation refers to it as reminder) - the documentation can be found here.

But as you mention, you're using a custom member field to store the unencrypted raw password - this is a **very bad idea** and has high security issues. Is this manually set?

The problem is one of two things...

1. I'd expect it's because you're using the field name "password" for the password, which will conflict with the real member field for password and problem Solspace User won't like it much. Try renaming to "raw\_password"
2. Possibly the email reminder/reset email doesn't allow for you to output custom member fields? Try testing it with other member fields (create one as a test).
> 2 votes

---
Tags: forgot-password
---


# Question
Title: How do I include three fields using search:?
I have a channel that displays artist information and they have an option to list their top three disciplines. Each discipline is listed in a separate field.

For example an artist could indicate the following disciplines:

1. Photography
2. Painting
3. Pottery

Related to this I have a page for each discipline to show the artists which have selected that discipline. Currently I have it set to filter entries as follows:

```
search:first_discipline="photography"

```

The only problem here is that it doesn't show those artists that may have selected photography as their second or third discipline.

I tried combining multiple fields in the search parameter like this:

```
search:first_discipline|second_discipline|third_discipline="photography"

```

That appears to cancel out the filtering and brings back all entries. Is there a way to search all three fields?

Thanks!

# Answer
> 0 votes
I'm pretty sure you can use multiple search parameters, so just add 3 separate ones.

Having said that, Robson makes a good point that these items really belong in a single field. You could use categories or a custom field for this, and either should work fine in Channel Form.

# Answer
> 0 votes
If you know the field id's for all three of your fields, you could do it the hard way and enable php on input

```
<?php
$ids = array();
$channels = ee()->db->select('entry_id')
        ->from('channel_data')
        ->where('field_id_1 = "photography" OR field_id_2 ="photography" OR field_id_3 = "photography" ')
        ->get();

if ($channels->num_rows() > 0)
{
    foreach($channels->result_array() as $row)
    {
        $ids[] = $row['entry_id'];
    }
}

$entry_ids = implode("|", $ids);
?>
{exp:channel:entries channel="foo" entry_id="<?php echo $entry_ids;?>"}
{title}<br/>
{/exp:channel:entries}

```

# Answer
> 0 votes
A 3rd Party addon like SpolSpace's SuperSearch allows you to weight the value of fields in search results. You can even use relevance multipliers for certain situations. You can craft your own method of displaying the results.

You could do something like:

relevance="first\_discipline=50+second\_discipline=25+third\_discipline=10"

Your first dicipline will be weighted first/heavier, but all 3 fields will be searched and results displayed.

http://www.solspace.com/docs/super\_search/relevance\_ordering/

---
Tags: channel-entries, parameters
---


# Question
Title: mySQL script to update non-unique URL titles
We need to update a set of url-titles that have some duplicate entries (migrated from a non-EE site). Because of the size of the database I would prefer to use direct mysql method, but I am open to any solutions out there.

If we have records:

```
a-stoney
a-stoney
ab-dille
ab-dille
ab-dille
ac-gifta
ae-jones
ae-jones

```

I want to be able to run against the exp\_channel\_titles table and end up with ONLY the duplicate entries updated as follows:

```
a-stoney
a-stoney-1
ab-dille
ab-dille-1
ab-dille-2
ac-gifta
ae-jones
ae-jones-1

```

Or some similar output, where non-duplicate url-titles are not edited, and any duplicates are applied a convention similar to the native EE behavior when attempting to create a new entry (with a title that already exists in the system)

Here is the SELECT I am using to display the duplicate entries, just having trouble applying the count and converting to an UPDATE Thanks!

# Answer
> 2 votes
How big is the database? Something like the below (untested) should do it with PHP

```
$sql = "SELECT * FROM exp_channel_titles";
$results = //execute query

$urls = array();
foreach($results as $result)
{
    $count = 1;
    $url = $result['url_title'];
    $entry_id = $result['entry_id'];

    while(isInArray($url, $urls))
    {
        $url = $result['url_title'] . '-' . $count;
        $count++;
    }
    $urls[] = $url;
    $sql = "UPDATE exp_channel_titles SET url_title = '$url' WHERE entry_id = $entry_id";
    //execute query;
}

function isInArray($string, $array)
{
    return in_array($string, $array);
}

```

---
Tags: mysql
---


title: Enable Memcached in EE 2.9.2: problems

text:
# Question
Title: Enable Memcached in EE 2.9.2: problems
I am trying to get Memcached working on my EE (2.9.2) website. I have `memcached` installed correctly (both Memcache and the PHP extension) and running as a daemon:

```
% ps -ef|grep memcache
user   pid   1  0  16:45 ?   00:00:00 memcached -d -p 11211 -u memcached -m 64 -c 1024 -P /path/to/memcached.pid

```

I have added the following code to my `config.php` file as per the docs:

```
$config['memcached'] = array(
    array(
        'host' => 'XX.XXX.XX.XXX',
        'port' => 11211,
        'weight' => 2,
    ),
);

```

However, when I try to select `Memcached` from the drop-down list of options under *CP Home \> Administration \> General Configuration* I see the following (in red):

```
Cannot connect to Memcached, using File driver instead

```

I cannot understand why this is happening and EE's logging of the problem is 100% non-existent (there is nothing in the Apache error log, EE Control Panel log). Any ideas? Thanks in advance.

# Answer
> 3 votes
Sorry for the trouble. This is an issue in EE 2.9 and will be fixed in the next release. For now, you can get around it by specifying the cache driver in your config.php:

```
$config['cache_driver'] = 'memcached';

```

---
Tags: ee2, config, cache, caching
---


# Question
Title: Expresso Store with Stripe Blank Checkout after Submit Order
I’m running into an issue with Store 1.6.5 (ugh, I know!) on EE 2.7.2 (ugh, again!) and Stripe. For the most part, things are working. However, we’re getting some feedback from some customers that in some cases clicking the Place Order button is simply refreshing the page with blank form fields. In some cases we’re seeing errors in Stripe log files that no card details are being sent. In other cases we’re seeing that tokens are created, but not used.

I’ve followed the advice offered at the end of this thread: Expresso Store with Stripe final checkout page reloads instead of submitting

It disables the check for multiple payment methods as Stripe is the only payment method.

I’ve also switched from using htts://js.stripe.com/v1 to htts://js.stripe.com/v2 thinking that may be an issue.

Unfortunately I am unable to reproduce the issue so it’s hard to troubleshoot.

Does anyone have experience with a similar issue that can offer some additional things to check? I'd be happy to post some code if necessary, or share access offline and report findings back here to keep the community informed.

Thanks in advance!

Greg

# Answer
> 0 votes
Usually when the payment form refreshes without advancing it is a result of an error with one of the forms without a templated error field.

First you would want to remove `error_handling="inline"` from the final page of your checkout template to evoke the default EE error page. Doing this should show you if a field is not being submitted properly.

Next you should add `{error:payment_method}` which will show any errors generated by Stripe while you are trying to submit an order.

You will also want to make sure that you have created a hidden input field for your token and that your JS is calling that hidden field to look for the token before the order is submitted. Since it seems that you are able to submit some orders without problem you shouldn't need to worry about your secret token and/or API keys being entered properly but it is always good to double check if you are not able to submit any orders.

If none of that works you should check your developer console to make sure that you are not experiencing any JS errors that might prevent the form from submitting.

---
Tags: expresso-store
---


title: Cannot get to CP - 404 Error

text:
# Question
Title: Cannot get to CP - 404 Error
Today a site I administer started getting a 404 error when trying to access the CP at www.thedomain.com/admin.php

It was working fine and as far as I know there have been no changes to the system by the client.

A user reported getting the error 'disallowed key characters' - though I have not seen this, for me it just redirects to the site 404 page.

The only thing that is different is that they sent an mail out earlier today (batched in 100s - approx 2000) that might result in high bandwidth/traffic in response, I am not sure if that would impact it though.

Can anyone help shed some light?

# Answer
> 2 votes
Firstly, can you confirm that the admin.php file actually still present on the server?

Secondly, you mentioned the disallowed key characters message.

Are you setting 2 lots of Google Analytics cookies? Third party services may also be setting Analytics cookies. I had this problem recently with an old Typekit kit which resulted in one of the cookies being renamed using a ~ character which fell foul of EE's allowed characters. In the case of Typekit they stopped doing this long ago but old kits need to be republished and for some reason it only recently became a problem.

I don't know why this would cause a 404 error though so it could well be unrelated.

# Answer
> 1 votes
This got solved by a dialogue with the hosts. They claim it was 'wrong permissions' on the admin.php file but I am not sure if this is the case. Especially as they advised me to change all FTP passwords and would not give further info when I requested their logs.

Anyway, it's working again now. Sorry I can't give further info on the fix for anyone in the same position.

---
Tags: control-panel, 404
---


title: Publisher phrases in html

text:
# Question
Title: Publisher phrases in html
Is there a way to enable a wysiwyg editor for editing phrases in Publisher?

I am aware that you could actually add html tags into phrases. But it would be a great addition, if there was an add-on that actually could convert some phrase input fields into a simple wysiwyg editors.

# Answer
> 0 votes
I currently don't have plans to implement a wysiwyg editor for the phrases.

Also, StackExchange is not my official support channel. Please use boldminded.com/support in the future.

---
Tags: wysiwyg, publisher
---


# Question
Title: Stash - 2 lists, match/against with a tag not outputting correctly
Somehow, I'm not able to get this to work. I am populating 2 lists at the top of a template.

```
{exp:stash:set_list name="favorites" replace="yes" parse_tags="yes"}
{exp:favorites:entries}
  {stash:item_channel_name}{channel}{/stash:item_channel_name}
  {stash:item_title}{title}{/stash:item_title}
{/exp:favorites:entries}
{/exp:stash:set_list}

{exp:stash:set_list name="all_channels" replace="yes" parse_tags="yes"}
{exp:stash:get_list name="favorites"}
  {stash:c_name}{item_channel_name}{/stash:c_name}
{/exp:stash:get_list}
{/exp:stash:set_list}

{exp:stash:get_list name="all_channels" unique="yes"}
  {c_name}
  {exp:stash:get_list name="favorites" match="#^{c_name}$#" against="item_channel_name"}
  -{item_title}
  {/exp:stash:get_list}
{/exp:stash:get_list}

```

I tried just using a static channel name in place of match="#Resources#" but it only outputs 1 item (the same item for each channel loop).

Here's the output thus far:

```
Channel Name: Benefits
Entry Title: 2015 Benefits Open Enrollment Information

Channel Name: Education
Entry Title: 2015 Benefits Open Enrollment Information

Channel Name: Forms
Entry Title: 2015 Benefits Open Enrollment Information

```

It's pretty much exactly like Mark's examples here https://gist.github.com/croxton/6219973 but I can't get it to work as intended. One thing though, when I manually limit the all\_channels list to 1 item, it outputs the correct items from the favorites list (I tested it against 4 different channels, one at a time = all correct. If more than 1 item in the all\_channels list, it does not work). To be certain it wasn't a server issue, I tried this on my local MAMP machine as well with the same results.

# Answer
Mark graciously pointed out that I was missing a nested tag in the get\_list portion. I also added the channel\_id in addition to the name so I didn't have to deal with needing to character escape names.

```
{stash:item_channel_id}{channel_id}{/stash:item_channel_id}

```

So, the get\_list became this:

```
{exp:stash:get_list name="favorites" unique="item_channel_id" orderby="item_channel_name"}
#{item_channel_name}#
 {exp:stash:get_list:nested name="favorites" match="#^{item_channel_id}$#" against="item_channel_id" prefix="nested"  orderby="item_title"}
    {nested:item_title}
 {/exp:stash:get_list:nested}
{/exp:stash:get_list}

```
> 0 votes

# Answer
Try adding another word to your nested stash:get\_list, a prefix parameter, and don't think you need parse='inward'. Something like:

```
{exp:stash:get_list
    name="all_channels"
}
    Channel Name: {item_channel_name}--

    {exp:stash:get_list:nested
        name="favorites"
        match="#^{item_channel_name}$#"
        against="item_channel"
        prefix="st_inner"
    }
        Entry Title: {st_inner:item_title}
    {/exp:stash:get_list:nested}

{/exp:stash:get_list}

```
> 0 votes

---
Tags: stash, regex
---


# Question
Title: Inline error handling in composer templating has invalid conditional
Versions: EE 2.9.0 & Freeform 4.2.0 Pro

Some help would be appreciated. :-)

I am trying to implement inline error handling in a Freeform Composer Template and it is throwing the error:

```
You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}. Parser State: Unexpected ‘:’ (MISC); expected RD in on line 17.

```

The line of code that throws the error is this

```
{if freeform:error:{composer:field_name}}

```

Which is copied from your documentation

If I hard code in the field name like this:

```
{if freeform:error:first_name}

```

It works, I think. But I get an error for every field, even those not required.

Here is my complete Composer Template code

```
{composer:page}
{composer:rows}
        <div class="row">
            {composer:columns}
                <div class="columns {if composer:column_total == 2}six{if:elseif composer:column_total == 3}four{if:elseif composer:column_total == 4}three{if:else}twelve{/if}">
                    {if composer:field_total == 0}

                    {/if}
                {composer:fields}
                    {if composer:field_label}
                        {if composer:field_type == 'nonfield_captcha'}
                            {if freeform:captcha}
                            <p>
                                <strong>{composer:field_label}</strong>
                            </p>
                            {/if}
                        {if:else}
                            <label class="field_label" {if composer:field_name != ''}for="freeform_{composer:field_name}"{/if}>
                                {composer:field_label}{if composer:field_required}<span class="required_item">*</span>{/if}
                            </label>
                        {/if}
                    {/if}
                    {if composer:field_output}
                        {if freeform:error:{composer:field_name}}
                            <strong>
                                Error: {freeform:error:{composer:field_name}}
                            </strong>
                        {/if}
                        {if composer:field_type == 'nonfield_title'}
                            <h2>{composer:field_output}</h2>
                        {if:elseif composer:field_type == 'nonfield_captcha'}
                            {if freeform:captcha}
                                    {freeform:captcha}<br />
                                    <input type="text" name="captcha" value=""
                                           size="20"   maxlength="20" style="width:140px;" />
                            {/if}
                        {if:else}
                            {composer:field_output}
                        {/if}
                    {/if}
                {/composer:fields}
                    </div><!-- end columns -->
            {/composer:columns}
        </div><!-- end row -->
{/composer:rows}
{/composer:page}

```

Thank you.

# Answer
> 3 votes
Change the lines

```
{if freeform:error:{composer:field_name}}
                        <strong>
                            Error: {freeform:error:{composer:field_name}}
                        </strong>{/if}

```

**TO**

```
{if "{freeform:error:{composer:field_name}}" != ""}
                        <strong>
                            Error: {freeform:error:{composer:field_name}}
                        </strong>{/if}

```

in the Template code. That should work.

# Answer
> 0 votes
Here is the code that is working for us, based on enj fix. Thank you!

```
{composer:rows}
        <div class="row">
            {composer:columns}
                <div class="columns {if composer:column_total == 2}six{if:elseif composer:column_total == 3}four{if:elseif composer:column_total == 4}three{if:else}twelve{/if}">
                    {if composer:field_total == 0}

                    {/if}
                {composer:fields}
                    {if "{freeform:error:{composer:field_name}}" != ""}<span class="error">{/if}
                    {if composer:field_label}
                        {if composer:field_type == 'nonfield_captcha'}
                            {if freeform:captcha}
                            <p>
                                <strong>{composer:field_label}</strong>
                            </p>
                            {/if}
                        {if:else}
                            <label class="field_label" {if composer:field_name != ''}for="freeform_{composer:field_name}"{/if}>
                                {composer:field_label}{if composer:field_required}<span class="required_item">*</span>{/if}
                            </label>
                        {/if}
                    {/if}
                    {if composer:field_output}

                        {if composer:field_type == 'nonfield_title'}
                            <h2>{composer:field_output}</h2>
                        {if:elseif composer:field_type == 'nonfield_captcha'}
                            {if freeform:captcha}
                                    {freeform:captcha}<br />
                                    <input type="text" name="captcha" value="" size="20" maxlength="20" style="width:140px;" />
                            {/if}
                        {if:else}
                            {composer:field_output}
                        {/if}
                    {/if}
                    {if "{freeform:error:{composer:field_name}}" != ""}</span>{/if}
                {/composer:fields}
                    </div><!-- end columns -->
            {/composer:columns}
        </div><!-- end row -->
{/composer:rows}

```

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


# Question
Title: Assets window brings up the front-end of the website
I've got a site running on a client's server and when we go to add a file, the Assets modal brings up the front-end of the website.

Not sure if this is due to us making index.html the default directory file prior to us making the site live.

# Answer
All sorted added the assets config overrides of

```
$config['assets_cp_path'] = "./system/";
$config['assets_site_url'] = "/index.php";

```

and we're good.
> 1 votes

# Answer
Thanks. My modal was empty, but adding

```
$config['assets_site_url'] = "/index.php";

```

Fixed it for me.

Assets 2.4 EE 2.7.3
> 0 votes

---
Tags: assets, pixelandtonic
---


# Question
Title: ExpressionEngine FreeMember conditional return=''
Attempting to return to different pages based on the success or failure of FreeMember Registration on Expression Engine.

The default attribute for the return URL is `return=''`, however I cannot seem to find any documentation relating to different return locations based on the successful or unsuccessful registering.

Through testing I have found that the URL within `return=''`will appear only on a successful completion of registration, however should you make an error within any part of the registration form then the URL goes back to `index.php` without any return path added.

**Q. Is there a specific custom attribute whereby you can define the URL for the unsuccessful completion of the register form?**

# Answer
Can you share your template code? As you mentioned, the `return` parameter only applies to a successful form submission. If the submission is unsuccessful (because of validation errors), you'll have to handle those. Are you using `error_handling="inline"`? If so, you'll need to actually include the error tags in the form (`{error:email}`). It would help to see your template code.
> 1 votes

---
Tags: conditionals, freemember
---


# Question
Title: How to enable conditional social meta information for blog posts
So I've got a fairly complex problem. Allow me to explain...

I've got an EE website where 80% of their traffic comes via social shares of their blog posts, so making sure the Twitter and Facebook meta data is perfect is key. FB and TW require the meta data that shows on a share card be placed within the tag of your website.

There's two different times people share the site

1.) blog posts
2.) global: any other page on the site that's not a blog post

I need the variables/values inside the meta tags, inside to change depending on whether or not the user is sharing a blog post or global page. and IF they are on a blog post, use the EE variables for that specific post.

This is my sloppy attempt at writing what I ultimately need using rough JS syntax:

```
<head>

if (is blog post) {

{exp:channel:entries channel="blog" limit="1"}

<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="@lorem"/>
<meta name="twitter:title" content="{title}"/>
<meta name="twitter:description" content="{excerpt}"/>
<meta name="twitter:image:src" content="{blog_thumbnail}"/>

{/exp:channel:entries}

} else {

<meta name="twitter:card" content="summary_large_image"/>
<meta name="twitter:site" content="@lorem"/>
<meta name="twitter:title" content="Lorem ipsum dolor"/>
<meta name="twitter:description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent tempus velit enim, sit amet pulvinar sapien blandit et. In facilisis tortor vitae quam venenatis euismod. Nunc auctor lorem porta mauris congue accumsan."/>
<meta name="twitter:image:src" content="lorem.com/_img/share.jpg"/>

}

</head>

```

I'm not sure what I should even be using for this? Is there some way to do this IF statement with EE's template code or is there some way to do this on page load with javascript and still get the EE variables?

# Answer
> 1 votes
```
<head>

  <meta name="twitter:card" content="summary_large_image"/>
  <meta name="twitter:site" content="@lorem"/>

  {exp:channel:entries channel="blog" limit="1"}
    {if no_results}
      <meta name="twitter:title" content="Lorem ipsum dolor"/>
      <meta name="twitter:description" content="Lorem ipsum dolor sit amet, consectetur adipiscing elit."/>
      <meta name="twitter:image:src" content="lorem.com/_img/share.jpg"/>
    {/if}
    <meta name="twitter:title" content="{title}"/>
    <meta name="twitter:description" content="{excerpt}"/>
    <meta name="twitter:image:src" content="{blog_thumbnail}"/>
  {/exp:channel:entries}

</head>

```

Note: Removed the duplicate content out of the tag code so there's no duplication.

---
Tags: javascript
---


# Question
Title: Sync a channel with google docs spreadsheet
Is there a way to sync a google docs spreadsheet to a certain channel in ExpressionEngine. I know this might be way advanced, and the main problem i see is maintaining unique entry\_id when a google row is updated or moved.

Has anyone worked on this, and can possibly share some tips, information or even code?

# Answer
> 1 votes
These links might help you:

Thanks,

# Answer
> 1 votes
With DataGrab, you can point to a URL to import from. I've successfully imported directly by using the following URL pattern

https://spreadsheets.google.com/feeds/download/spreadsheets/Export?key=1\_sgsUhvWxAQrJOYluVn3jxCEcBTZqhlVBiDAPlVLEb0&exportFormat=csv

With Datagrab you can use any column as a 'primary key' for updates. Ensure on your spreadsheet side you have a unique key in one of the columns and ensure you import this as well (e.g. ImportID).

# Answer
> 0 votes
I'd suggest exporting the data from Google as an CSV file and importing with the **Datagrab addons**.

> **Summary of features**
>
> ```
> Import data from RSS/ATOM feeds, CSV files and XML files. Other datatypes can be added.
> Map data values to a channel’s custom fields
> Assign categories to each entry
> Assign entries to an author
> Imports can be saved and re-run — ideal for a tumblelogr
> Entries can be updated if the source data changes — keep data synchronised
>
> ```

---
Tags: import, export, sync
---


title: Repeet add-on upgrade from EE1 to EE2

text:
# Question
Title: Repeet add-on upgrade from EE1 to EE2
I am looking after an EE1 site that uses the Repeet add-on by Studio625: Brent C. Wilson. It seems to only be compatible with EE1. I am in the process of upgrading the site to EE2 and copied the version of the EE1 plugin that I have to the third\_party folder anyway. I am now getting this error, which I assume is because the original add-on is not compatible with EE2.

```
Fatal error: Call to a member function fetch_param() on a non-object in \system\expressionengine\third_party\repeet\pi.repeet.php on line 91

```

What should I do to fix this? Could I install the Solspace Calendar add-on and would that work seamslessly?

# Answer
> 2 votes
I took a look on Repeet. It just repeats the event on the template. If this is enough for you, instead of use aaaaaaaaallllll the power of Solspace Calendar, you can try to convert the add-on by yourself. There are guidelines on EllisLab website.

Solspace Calendar is a monster of complexity. If you can stay away from it, you should.

# Answer
> 2 votes
If you need repeating events your best bet is indeed Solspace Calendar, Repeet is EE1 only and was never ported to EE2. A seamless update however it is not, you may have to rebuild your calender completely. (it's what I would do anyway, the solspace module does a lot more than just repeating events).

# Answer
> 1 votes
I'm not 100% sure I understand what Repeet does but it's unlikely that it would be worth trying to "fix" it to work with EE2 as it's most likely going to mean completely rewriting it.

If you are looking for a way to specify repeating events then you may want to look at Low Events.

---
Tags: add-on, solspace-calendar, ee1, upgrade, ee2-upgrades
---


# Question
Title: Exclude certain items on result page in LOW SEARCH
Does anyone know a way to exclude some results on the result page of LOW SEARCH? I have been looking everywhere but I cannot find the answer. I understand I must add a SEARCH form on the resultpage, but do not know what next to do.

My client wants to 'hold' certain results AFTER they made a search and then save the results for later use.

So filter in results, so to speak.

Thanks a lot for a hint.

# Answer
Although I fully accepted Low's answer I add another one.

This is how I filter now in search results, *(and it is actuelly just what I was looking for. Maybe I did not ask clear enough, sorry about that)*

I added to my seach:form

```
require_all="search:{url_title}"

```

made sure all channels have unique url\_titles by adding a prefix in the channel preferences,

and made a checkbox like this:

```
<label>
            <input type="checkbox" name="search:url_title[]" value="{url_title}"
            {if "{option:value}" IN ({low_search_search:url_title})} checked="checked"{/if} />
            Save
</label>

```

Now, when ticking some boxes in the searchform only those results return. I tested it, and it works well enough for me to filter in a simple way within search results.
> 0 votes

# Answer
To answer the first question in your post, about excluding entries from search results, I can say this: do it like you would with a regular channel:entries tag, so using a parameter like `entry_id="not 1|2|3"`, where 1, 2 and 3 are the entry IDs you want to exclude. You can do that using status, categories, or any parameter, as per the native EE parameters themselves.

If you want to make this dynamic, then you need to feed those entries to the entry\_id parameter in your form somehow, so you end up with a (hidden) input field that looks something like this:

```
<input type="hidden" name="entry_id" value="not 1|2|3">

```
> 1 votes

---
Tags: low-search
---


title: How to filter by status in a Plugin?

text:
# Question
Title: How to filter by status in a Plugin?
In a plugin, I have this as part of the SQL's WHERE clause:

```
$where_sql = "`store_table`.`channel_id` = {$this->channel_ids->stores}
                AND `regions`.{$this->field_column_names->region->region_name} IN ({$regions})
                AND `regions`.{$this->field_column_names->region->region_name} != ''
                AND `address_types`.{$this->field_column_names->address_type->address_type} = 'Physical'
                AND `store_address_data_grid_table`.{$this->grid_column_names->store_address_data->store_address_latitude} != ''
                AND `store_address_data_grid_table`.{$this->grid_column_names->store_address_data->store_address_longitude} != ''
        ";

```

I need this query to respect that entry's status (e.g. status = Open). How do I add that to this query?

**EDIT 1:**

It looks like the `status` value is saved in `exp_channel_titles` and actually stores the value values ("open", "closed") instead of an id. Anyway, I'm not sure how I'd add this to the WHERE clause.

# Answer
You would need to perform a JOIN on the entry id column in the two tables then set a WHERE clause for titles table. If you're unfamiliar with JOINs then if you can post the full query we may be able to work it out for you.
> 1 votes

---
Tags: database, plugin
---


# Question
Title: Are {layout:set} variables available to all extended layouts?
I'm trying to make sure I understand the scope of {layout:set} variables, compared to how embeds work.

Traditionally, variables set with an `{embed="template_group/template variable="foo"}` are only accessible one level deep, directly within the embedded template.

**Now let's talk layouts.**

We have at minimum 2 layout templates: `layouts/global` & `layouts/master`.

For the sake of this questions, let's say I have a `blog/index` template that extends `layouts/master` and `layouts/master` extends `layouts/global`

**blog/index:**

```
 {layout="layouts/master"}

 {layout:set name="title"}Blog Title | {site_name}{/layout:set}

    {exp:channel:entries channel="blog"}

        All the blog content here...

    {/exp:channel:entries}

```

**layouts/master:**

```
{layout="layouts/global"}

{embed="embeds/masthead"}

{layout:contents}

{embed="embeds/footer"}

```

**layouts/global:**

```
<html>
    <head>
        <title>{layout:title}</title>
    </head>

     <body>

         {layout:contents}

    </body>
</html>

```

The question I'd like clarity on (that my tests confirm) is this: Will the the {layout:title} variable be available within the `layouts/global` template regardless of where it's set, or do I have to redefine it within the `layouts/master` template, the way that you have to do if you were nesting embeds and passing variables?

# Answer
From my own testing, the value set for the `{layout:title}` variable will cascade back through the layout templates to the outermost layout. So if you set it in a nested template or a template that ultimately uses the global layout, then the value of the variable will be available to the global layout.

If you set the `{layout:title}` variable in a nested template (e.g. `blog/index` in your example) then redefine it in the `layouts/master` template, the value set in `layouts/master` template will be the one that is presented to the global layout.

Note that you can use this to extend the value of the variable like this:

**blog/index :**

```
{layout="layouts/master"}

{layout:set name="title"}Blog Title{/layout:set}

{exp:channel:entries channel="blog"}

    All the blog content here...

{/exp:channel:entries}

```

**layouts/master :**

```
{layout="layouts/global"}

{layout:set name="title"}{layout:title} | {site_name}{/layout:set}

{embed="embeds/masthead"}

{layout:contents}

{embed="embeds/footer"}

```

**layouts/global :**

```
<html>
  <head>
    <title>{layout:title}</title>
  </head>

   <body>

     {layout:contents}

  </body>
</html>

```

would result in the following:

```
    <title>Blog Title | Site Name</title>

```
> 2 votes

---
Tags: variable, template-layouts
---


# Question
Title: International Shipping conditional in Exp: Store
Is it possible to hide all other shipping options( only to show international shipping) in expresso store if the country code is not U.S or Canada?

Has anyone had experience with this?

# Answer
> 2 votes
To follow up on this using some of the logic Justin explains below I came up with a solution that also updates available shipping methods, shipping cost & order total when either shipping\_country or shipping\_method dropdowns are changed. http://bit.ly/16x5VOY

```

$(document).ready(function() {
    $("#shipping_country,#shipping_method").change(function() {
        var url = $(this.form).attr('action');
        var data = $(this.form).serialize();
        $.post(url, data, function() {
            /* Update Method */
            $('#shipping_method').load('/store_example/_update-form #shipping_method');
            /* Update Cost */
            $('.shipping-cost').load('/store_example/_update-form .shipping-cost');
            /* Update Total */
            $('.order-total').load('/store_example/_update-form .order-total');
        });
        return false;
    });
});

```

Having some trouble getting the AJAX posts to update properly, hopefully someone from store can chime in as there is very little documentation on a practical use of shipping methods. The main problem involves when switching dropdown shipping\_country from US \> France the shipping\_cost & order\_total values don't update. If then switch from France \> United Kingdom the values do change as expected. This may be more of syntax question, but will definitely help future store users trying to replicate the same functionality.

# Answer
> 1 votes
You can create a conditional to check the users shipping location and then show options available. Lets assume from the attached image

I wanted to have 1 for outside of the US, 5 for Australia and the rest for the US. I could template something along the lines of

```
<select name="shipping_method">
    <option value="">Select shipping method...</option>
 {if shipping_country != "us" OR shipping_country != "au"}
 <option value="1" selected="selected">World Shipping</option>
 {/if}
 {if shipping_country == "us"}
 <option value="6">FedEx Priority</option>
 <option value="7">UPS</option>
 <option value="8">USPS</option>
 <option value="9">FedEx Slow</option>
 <option value="10">More USPS</option>
 {/if}
 {if shipping_country == "au"}
 <option value="5" selected="selected">Australia Post</option>
 {/if}
</select>

```

This is something that is going to be addressed in an upcoming release so help streamline this for developers and being able to pull multiple shipping quotes with a single request.

# Answer
> 1 votes
When dealing with flat rate shipping for INTL orders, if only there was a select rule called "Any Country Besides \[\[country value\]\]". That way, no importing rules for every country.

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


# Question
Title: Stash and List Pagination - custom links?
In considering using a Stash list in order to get custom ordering of Previous/Next entries, I see that the docs provide only limited tags to use in the pagination function:

```
    {previous_page}
                <li><a href="{pagination_url}" class="page-previous">Previous Page</a></li>
    {/previous_page}

```

Are the other list variables available here as well? Previous entry title? etc..

# Answer
Thanks to Croxton for this answer on Twitter:

> no prev/next row vars but would be easy to get w/ simple plugin or maybe mx\_calc used to calculate get\_list offset param.
> 0 votes

---
Tags: stash, pagination, orderby
---


# Question
Title: Multiple groups of FieldTypes / Blocks of content
I'm looking for a flexible way to define very specific blocks of content which can be used multiple times within a page. Some examples of these blocks would be:

* An image with text to the left
* An image with text to the right
* A formatted quote
* A full width image
* Two columns of text
* Two columns of text with an image at the top of each column

Each one of these blocks of content would represent a row of content on a page. I'm after the ability to be able to add any number of these blocks to a page in any order.

The nearest add-on I can find is Content Elements by Krea, but it is limited to single fieldtypes, whereas some of mine would combine more than one fieldtype. Looking at the docs, you can extend it, but I'm unsure as to whether what I'm trying to do is achievable. I have contacted the Developer for some guidance, but as yet I haven't heard anything back and time's a ticking.

So in the meantime, I wondered if anyone else has either extended this Addon, or alternatively solved this type of problem in a different way?

# Answer
> 2 votes
You could do it with Matrix and create a column for every possible piece of content, although it could get unwieldy.

Or maybe Entry Widgets will do what you need.

# Answer
> 0 votes
This is exactly what Blocks is designed to do.

Your template would end up looking similar to:

```
{page_content}

    {image_with_left_text}
    <figure class="left">
        <img src="{image}">
        <figcaption>{text}</figcaption>
    </figure>
    {/image_with_left_text}

    {image_with_right_text}
    <figure class="right">
        <img src="{image}">
        <figcaption>{text}</figcaption>
    </figure>
    {/image_with_right_text}

    {pull_quote}
    <blockquote>
        {quote}
        {if citation}
        <cite>{citation}</cite>
        {/if}
    </blockquote>
    {/pull_quote}

    {full_width_image}
    <figure class="full">
        <img src="{image}">
    </figure>
    {/full_width_image}

    {two_column}
    <div class="twocolumn">
        <div>
        {if image1}
        <img src="{image1}">
        {/if}
        {content1}
        </div>

        <div>
        {if image2}
        <img src="{image2}">
        {/if}
        {content2}
        </div>
    </div>
    {/two_column}

{/page_content}

```

(Full disclosure: I wrote Blocks.)

---
Tags: fieldtype, content, content-elements
---


title: Use unique id for each entry

text:
# Question
Title: Use unique id for each entry
I'm looping matrix entries and I'm trying to give each image a unique id. I've tried using `{count}`, but it's just outputting same number for each entry? What's the best way to do this with either EE logic or PHP?

Here's my current code. Essentially just trying to increment mainImg1, mainImg2, mainImg3, etc...

```
    <div div class="machine_parts_container">
        <h3>{image_title}</h3>
        <div class="machine_parts_left">
            <div class="machine_parts_left_img">
                <a class="fancybox-effects-c" href="{image}" title="{image_title}"><img id="mainImg" src="{image}" alt="{image_title} Diagram" /></a>
                <p>Click To Zoom Image</p>
                <input type="button" value="Print Image"  onclick="printImg()" />
            </div>
        </div>

        <div class="machine_parts_right">
            <div class="machine_parts_right_int">
                <div class="parts_table">
                    {table}
                </div>
            </div>
        </div>
    </div>
    {/machine_support_landing_parts}

```

# Answer
> 2 votes
`{count}` probably belongs to the outer `{exp:channel:entries}` loop. You want either `{row_id}`, `{row_count}`, or `{row_index}`, which Matrix provides.

https://docs.pixelandtonic.com/matrix/templating/field.html

---
Tags: matrix, php, loop
---