# Question
Title: Include custom JavaScript in the control panel
I need to be able to add some javascript globally to the Admin section of my site, and i have been using the cp\_css\_js extension for this which has sort of worked. The thing is that it's super buggy ( running the js-code twice on some pages for instance, and don't get me started on the way you "add" the actual code ).

I have googled for the better part of this day for a nicer way to do this, without luck, but i feel there should be something like wordpress' `enqueue_script`-function. The only way i have been sort of successful is creating my own plugin, and using the `cp->load_package_js()` in my mcp.\* file, but that only runs when i'm on the actual plugin-page, not globally across the Admin-area.

Does anybody know of a nice way to do this?

Thank you,

/Anders

# Answer
The cleanest way is to create an accessory add-on that will add your js to all pages in the cp. Here's a basic example called "Default Value." Change the name and code as needed.

---

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

/**
 * ExpressionEngine Developer Accessory
 *
 * @package     Default Value
 * @category    Accessory
 * @description Sets Calendar Events Display Order field value to 100 automatically (if empty)
 * @author      Shoe Shine Design & Development
 * @link        http://www.shoeshinedesign.com
 */

class Default_value_acc
{
    var $name           = 'Default Value';
    var $id             = 'default_value';
    var $version        = '1.0';
    var $description    = 'Sets Calendar Events Display Order field value to 100 automatically (if empty)';
    var $sections       = array();

    // --------------------------------------------------------------------

    /**
     * Constructor
     */
    function __construct()
    {
        $this->EE =& get_instance();
    }

    // --------------------------------------------------------------------

    /**
    * Set Sections
    */
    function set_sections()
    {
        // hide accessory from footer tabs
        $this->sections[] = '<script type="text/javascript" charset="utf-8">$("#accessoryTabs a.default_value").parent().remove();</script>';

        // add css, js and html
        ee()->cp->add_to_foot('
        <script type="text/javascript">
            $(document).ready(function() {
                var value=$.trim($("#field_id_42").val());
                if(value.length<1) {
                    $("#field_id_42").val("100");
                }
            });
        </script>
        ');
    }

}
// END CLASS

/* End of file acc.default_value.php */
/* Location: ./system/expressionengine/third_party/default_value/acc.default_value.php */

```
> 4 votes

# Answer
I often use the `cp_menu_array` hook for this purpose. It runs on every CP request, and unlike cp\_js\_end, it doesn't run in a separate HTTP request. You just have to be careful to keep the $menu value, as other extensions might be using the same hook.

```
public function cp_menu_array($menu)
{
  ee()->javascript->output('$("#publishForm").css("background-color", "pink");');

  if (ee()->extensions->last_call !== FALSE)
  {
    $menu = ee()->extensions->last_call;
  }

  return $menu;
}

```
> 2 votes

---
Tags: control-panel, javascript
---


# Question
Title: How can I access Low Variables I've used on a previous site without having to input them all in again?
I want to use a common set of Low Variables I've used on another EE build but don't want to have to go through the configuration again. How can I do it?

# Answer
> 2 votes
Low Variables are stored in the exp\_low\_variables , exp\_low\_variable\_groups and exp\_global\_variables tables.

You can dump these tables from your previous build into your new project.

Note that it won't work for complex Low Variable types that store their data in their own database tables, like Matrix/Grid.

---
Tags: low-variables
---


title: GWCode Categories - Custom UL code

text:
# Question
Title: GWCode Categories - Custom UL code
I'm struggling with this question again: Classes on list items with GWCode CategoriesClasses on list items with GWCode Categories

I'm trying to generate an unordered list with custom classes on the list items (for expand/collapse hooks). The problem I'm having is when it goes from depth3 to depth1.

```
depth1 item
-- depth2 item
---- depth3 item
-- depth2 item (works fine!)
---- depth3 item
depth1 item (depth3_end can't just trigger one level of closing UL; how to back up without knowing next level?)

```

Has anyone worked this out? I'd just use nested output and avoid applying this logic to linear, but there are no "has-children" or "here" classes if it matches the current URL.

Thanks!

Mark

**UPDATE** This is where I started. I've been playing with depthX\_start and depthX\_end and am still seeing this spot where depth3\_ends and it doesn't back up to depth1. So my next depth1 category is at level 2 in the UL.

```
        <ul>
        {exp:gwcode_categories group_id="3" style="linear"}
            <li class="{if has_children}has-children{/if} {if cat_url_title=='{freebie_2}'}here{/if}"><a href="/{segment_1}/{cat_url_title}">{cat_name}</a>{if has_children}
                <ul>{/if}
                {if depth2_end OR depth3_end OR depth4_end}
            </li></ul>{/if}
            {if !has_children}</li>{/if}
        {/exp:gwcode_categories}
        </ul>

```

You'll see the classes I need to add there. We're using JavaSript to enable expand/collpase on a given item, and to trigger the left nav to open where .here is.

# Answer
> 4 votes
So it seems the logic works when the nesting drops back 1 parent, but breaks when the parents drop back two levels or more. After testing this on my end, it looks the `depthX_end` variables are all fired at the same time in the loop–so you will need a condition to test when the list drops back two parents or more.

```
<ul>
{exp:gwcode_categories group_id="3" style="linear"}
   <li class="{if has_children}has-children{/if} {if cat_url_title=='{freebie_2}'}here{/if}"><a href="/{segment_1}/{cat_url_title}">{cat_name} - {if depth1_end}1{/if}{if depth2_end}2{/if}{if depth3_end}3{/if} {if depth4_end}4{/if}</a>
   {if has_children}<ul>{/if}
   {if depth2_end OR depth3_end OR depth4_end}</li></ul>{/if}
   {if depth1_end AND depth2_end AND depth3_end}</li></ul>{/if}
   {if depth1_end AND depth2_end AND depth3_end AND depth4_end}</li></ul>{/if}
   {if !has_children}</li>{/if}
{/exp:gwcode_categories}
</ul>

```

---
Tags: gwcode-categories, nested-list, custom-classes
---


title: Migrations for ExpressionEngine

text:
# Question
Title: Migrations for ExpressionEngine
Is there an add-on that adds database migrations features ala Codeigniter or Laravel for ExpressionEngine?

It is really a pain when making a dev environment and having to recreate it on a production server.

# Answer
The true answer is unfortunately "no". There have been some attempts in this vain by EE addon developers and there may be some "creative" solutions out there but there is not anything that I'm aware of which makes this process easy.
> 1 votes

# Answer
The closest I have seen to something like this is detailed in a blog post: "Deploying ExpressionEngine based site" by Krasimir Tsonev.

He outlines steps to log all queries in an environment, writing them to files. The queries can then be run, as migrations, by executing the saved queries on your other environment's database. Scroll down to the "Database migration" heading where it says "My way" (right here).

I haven't tried it myself, but it looks like a promising approach and there are some good comments.
> 1 votes

---
Tags: database-migrations
---


title: data-src Attribute for jQuery

text:
# Question
Title: data-src Attribute for jQuery
I have noticed that the 'data-src' Attribute does not work within Expression Engine which makes using some jQuery plug-ins impossible. Does anyone know why this is and how it can be overcome?

# Answer
> 1 votes
'data-src' does work in EE templates. I used it on a recent project without issues.

---
Tags: jquery
---


# Question
Title: Channel entries tag not working on page using Page module
I've got a page that I've created using the Pages module, and inside the template for that page I'm trying to display a list of entries from 4 different channels on my site. But the {exp:channel:entries} tag returns nothing. Using the Template Debugging I can see that this tag is attempting to retrieve a list of entries, but then it says that 0 entries were returned?

What am I doing wrong?

**Answer**

The key is to use **dynamic=no** in the {exp:channel:entries} tag. So instead of:

```
{exp:channel:entries channel="channel1|channel2"}

```

Use

```
{exp:channel:entries dynamic="no" channel="channel1|channel2"}

```

Of course, if you're already using the

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

```

tag to access the page title, etc..., you can't embed another channel entries tag inside that tag, so you'll have to put your code into an embedded template.

So the end result would be something like:

```
{exp:channel:entries channel="pages"}
  <h1>{title}</h1>
 <!-- other page code stuff -->

   <!-- now embed your template that uses the channel entries with dynamic=no -->
   {embed="<yourtemplategroup>/<yourembeddedtemplate"}

{/exp:channel:entries}

```

# Answer
> 6 votes
Try adding `dynamic="no"` to your channel:entries tag, otherwise it will try to fetch entries based on the URL.

---
Tags: channel-entries, pages
---


# Question
Title: Showing one child page in main navigation
Is it possible to show one child page as a main navigation item? I tried the include parameter but it's not quite right.

> The parameter "include=" can be used to selectively show specific pages from the same level. http://buildwithstructure.com/tags/navigation/

It needs to be a child page but also be a main navigation link.

# Answer
> 1 votes
Here's another solution from their docs:
**Duplicate Pages In Navigation**.

> You can have pages live in more than one place in your navigation by creating a redirect to one “official” place the page lives.

# Answer
> 1 votes
My understanding is that this is not possible using Structure tags. The navigation works off the hierarchy.

Best option is to use jQuery to manually insert the navigation item. Here's a rough how-to:

Set your `{exp:structure:nav}` tag to use `add_unique_ids="yes"`. Let's say this outputs:

```
<ul>
    <li id="link1"></li>
    <li id="link2"></li>
    <li id="link3"></li>
</ul>

```

Then use jQuery to insert your new nav link where appropriate. Something like this:

```
$('#link1').after('<li id="inserted"></li>');

```

This will get you this:

```
<ul>
    <li id="link1"></li>
<li id="inserted"></li>
    <li id="link2"></li>
    <li id="link3"></li>
</ul>

```

There may be a jump in the nav list as the item is inserted so I'd suggest hiding the UL with CSS and then showing it after the insert with JS... something like:

```
ul {
    display: none;
}

$('ul').show();

```

You'll need to adjust the selectors to work with your code.

---
Tags: structure
---


# Question
Title: One alert when importing a production database
I now have a local copy of a live EE site. Front and backend are working with no problems.

However, when I imported the production database I got this one alert:

\[ERROR in query 912\] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1

Should I be worried?

These are the first lines in the sql file:

```
-- phpMyAdmin SQL Dump
-- version 4.0.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 29, 2013 at 07:18 PM
-- Server version: 5.5.29-MariaDB
-- PHP Version: 5.3.17

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

```

Any idea?

# Answer
> 1 votes
Sometimes these errors happen because of the connection or application used in exporting the db. I'd recommend using Sequel Pro to export the db with DROP tables syntax and gzipped. If you still see the alert/error, then there's really something wrong.

---
Tags: database, mysql, database-error
---


title: Relationship only displaying channel #

text:
# Question
Title: Relationship only displaying channel #
I am a somewhat newbie with Expression engine but I cant seem to find a solution to this problem. I have a simple relationship between two channels and for some reason the correct channel # is the only think that is displayed. (Code below) Link to view the public page. Any help would be appreciated.

http://staging.stitchmedia.ca/ee/index.php/bookcase/circus-of-mirrors

Seems to be happening in two spots

```
    {exp:channel:entries channel="adventure" url_title="{segment_2}" limit="1" require_entry="yes"}

```

.... SOME HTML CODE HERE .....

```
{related_authors}
    <h2>{related_authors:author_name}</h2>
    <p>{related_authors:author_bio}</p>
{/related_authors}

```

.... SOME MORE HTML CODE HERE .....

```
{related_chapters}
    <li>
        <img src="{related_chapters:chapter_thumbnail}" alt="{related_chapters:chapter_title} Thumbnail" class="th-chapter-icon">
        <h4 class="th-chapter-title">{related_chapters:chapter_position}:{related_chapters:chapter_title}</h4>
        <span class="th-chapter-more">+</span>
        <div class="th-chapter-content">
            <img src="{related_chapters:chapter_image}" alt="{related_chapters:chapter_title} Thumbnail" class="th-chapter-icon">
            <p>{related_chapters:chapter_description}</p>
        </div>
    </li>

```

{/related\_chapters}

# Answer
Per comments, this was due to using template tags for 2.6+ for an EE 2.5.5 site. Updating to EE 2.6+ or modifying templates tags for 2.5.5 fieldtypes fixes it.
> 1 votes

---
Tags: channel, relationships
---


# Question
Title: Channel > Entry > Relationship > Grid > Field
I have a channel called "videos" with a bunch of entries in it. One of the fields in this channel is a relationship to another channel called "person". The "person" channel has a field called "facts" which is a grid with one column called "fact".

When I render this template, I successfully get the name of each person as well as a node for each `<Fact>` in the "facts" grid.

```
<Videos>
{exp:channel:entries channel="videos"}
    <Video>
        <Subject>{person:title}</Subject>
        <Facts>
            {person:facts}
            <Fact></Fact>
            {/person:facts}
        </Facts>
    </Video>
{/exp:channel:entries}
</Videos>

```

However I can't figure out how to get the content of the grid to appear. I've tried:

```
<Fact>{fact}</Fact>
<Fact>{facts:fact}</Fact>
<Fact>{person:facts:fact}</Fact>

```

With the last two, I get an error:

```
Message: Undefined variable: field_ids
Filename: libraries/Grid_parser.php
Line Number: 103

```

I am running EE Core 2.7.2 (still evaluating it) under PHP 5.4.11.

# Answer
> 7 votes
Looks like you were missing the relationship tag pair for your `person` field. Try this:

```
<Videos>
{exp:channel:entries channel="videos"}
    {person}
    <Video>
        <Subject>{person:title}</Subject>
        <Facts>
            {person:facts}
            <Fact>{person:facts:fact}</Fact>
            {/person:facts}
        </Facts>
    </Video>
   {/person}
{/exp:channel:entries}
</Videos>

```

---
Tags: templates, relationships, grid
---


# Question
Title: Expresso Store: SagePay Server rejecting missing BillingSurname
I can't figure this one out. I just have a standard checkout form that is hooked up to SagePay Server.

In the Store settings there is no mapping of billing firstname and surname but in the gateway class I can see the values being requested. When i submit the form, I get the message saying "3107 : The BillingSurname field is required."

If I amend the gateway class to hardcode values in the field it goes through fine. What makes it even stranger is that on a live site using the same codebase and database, it all goes through to SagePay without any errors at all.

Any suggestions?

Thanks

# Answer
As mentioned in your comment - Store only supports a single billing "name" field. To separate these into first name and last name fields, there is an add-on on Devot:ee by Michael Rog which will let you use a custom field for this: Store: Firstname/Lastname. There is also a feature request for it, and it will most likely be addressed officially in a future version.

As some gateways require separate first name and last name fields, the name field is currently split after the first space when sent to the payment gateway. This is sufficient for 99% of cases, and mostly only leads to errors during testing when you don't put a real name in :)

**Update:** Store v2 has separate `first_name` and `last_name` fields.
> 2 votes

# Answer
If anyone else has this issue and wants a quick fix, I solved it by utilising JQuery validation and ensuring the field had 2 names separated by a space.

JavaScript:

```
$.validator.addMethod("fullname", function(value, element) {
   return /\w+\s+\w+/.test(value);
}, "Please specify firstname and lastname and separate with a space");

$(document).ready(function() {
    $("form#billing").validate({
        ignore: ""
    });
});

```

And in the template:

```
{exp:store:checkout next="/checkout/delivery" form_id="billing"
    require="name|order_email|address1|address3|postcode|country|phone"
    error_handling="inline" error_delimiters='<label class="error">|</label>'
    secure_action="yes" secure_return="yes"}

<input type="text" name="billing_name" value="{billing_name}"
    placeholder="John Doe" required class="fullname">
    {error:billing_name}

```

Note the `required` triggers the JQuery validator and the `class="fullname"` fires the custom method and validation for only that field.

I couldn't use the Store: Firstname/Lastname add-on as it requires custom1 and custom2 fields which I was already using, so would involve a lot of effort to update or a hack to the add-on.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: How to make singular instance of text editable in a template
Is there a good workflow for making a singular instance of text, like an intro paragraph, editable within a template?

I find this comes up a lot and the channel entry workflow is really built around multiples.

# Answer
For times where the Channel module is overkill, or the random bits of editable content don't really fit the Channel mould, Low Variables is really great.

It has a lot of added features beyond just making global variables easily (and safely) editable by end users. Some of the big benefits are text formatting options, custom content types for the global variable (this is huge!), early parsing, and save global variables as files.
> 5 votes

# Answer
For basic copy, you can accomplish this using native **Snippets**.

> Snippets are small bits of reusable template or tag parts. You could create a Snippet for any number of purposes, anywhere that you need to reuse a small portion of a template, including partial or complete tags, other variables, etc. Snippets add flexibility and reusability, while making it simple to make site-wide changes by editing the Snippet’s source instead of having to modify many templates.
> 2 votes

---
Tags: channel-entries, templates, custom-fields
---


# Question
Title: Remove single item from cart via checkbox completely empties cart?
When I select a checkbox for one product to remove it from the cart, it empties all products. Any ideas why? Here is the code I am using from inside the `{items}` tag. Thanks!

```
<input type="checkbox" class="cart_remove_check" name="remove_items[{key}]" value="1" />

```

Here is my full template code...

```
{embed="wrappers/_main"}
{exp:stash:set name="content" no_results_prefix="pfx"}
  <div class="row">
    <div class="small-12 columns">
      {exp:store:cart}{if no_items}{redirect="get-started"}{/if}{/exp:store:cart}
      <h1>Checkout</h1>
    </div>
  </div>
  {exp:store:checkout
    return="checkout/complete/ORDER_HASH"
    require="name|address1|address3|postcode"
    payment_method="stripe"
  }
  <div class="row">
    <div class="small-12 large-4 columns">
      <h3>Credit Card</h3>
      <p>
        <label>Card Number</label>
        <input type="text" id="payment_card_no" value="">
      </p>
      <p>
        <label>Name on Card</label>
        <input type="text" id="payment_name" value="">
      </p>
      <label>Expires</label>
      <div class="row">
        <div class="small-6 columns">
          <select id="payment_exp_month">
            <option value=""></option>
            {exp_month_options}
          </select>
        </div>
        <div class="small-6 columns">
          <select id="payment_exp_year">
            <option value=""></option>
            {exp_year_options}
          </select>
        </div>
      </div>
      <p>
        <label>Security Code</label>
        <input type="text" id="payment_card_csc" size="4" value="">
      </p>
      <h3>Billing Address</h3>
      <p>
        <label>Name</label>
        {field:billing_name}
      </p>
      <p>
        <label>Address</label>
        {field:billing_address1}
        {field:billing_address2}
      </p>
      <p>
        <label>City</label>
        {field:billing_address3}
      </p>
      <p>
        <label>State</label>
        {field:billing_region}
      </p>
      <p>
        <label>Zip</label>
        {field:billing_postcode}
      </p>
      <p>
        <label>Phone</label>
        {field:billing_phone}
      </p>
    </div>
    <div class="small-12 large-4 columns">
      <h3>Email Address</h3>
      <p>
        <label for="order_email">Email Address</label>
        {field:order_email}
      </p>
      <h3>Shipping Address</h3>
        <label for="shipping_same_as_billing">
          <input type="hidden" name="shipping_same_as_billing" value="0">
          <input type="checkbox" id="shipping_same_as_billing" name="shipping_same_as_billing" value="1">
          Same as Billing Details
        </label>
      <div id="shipping_details_drawer">
        <p>
          <label>Name</label>
          {field:shipping_name}
        </p>
        <p>
          <label>Address</label>
          {field:shipping_address1}
          {field:shipping_address2}
        </p>
        <p>
          <label>City</label>
          {field:shipping_address3}
        </p>
        <p>
          <label>State</label>
          {field:shipping_region}
        </p>
        <p>
          <label>Zip</label>
          {field:shipping_postcode}
        </p>
        <p>
          <label>Phone</label>
          {field:shipping_phone}
        </p>
      </div>
    </div>
    <div class="small-12 large-4 columns">
      <div class="row">
        <div class="small-8 columns">
          <h3>Items</h3>
        </div>
        <div class="small-4 columns">
          <input class="tiny button expand" type="submit" name="empty_cart" value="Empty Cart">
        </div>
      </div>
      <table width="100%">
        <thead>
          <tr>
            <th width="75%">Product</th>
            <th width="20%">Price</th>
            <th width="5%"><span id="remove_from_cart_label">x</span></th>
          </tr>
        </thead>
        <tbody>
          {items}
            {exp:channel:entries entry_id="{entry_id}"}
              <tr>
                <td>
                  {title}{if item_qty > 1} (x{item_qty}){/if}
                  {modifiers}
                    <br><span style="font-size: 11px;">Rear Wipers {modifier_value}</span>
                  {/modifiers}
                </td>
                <td>{price}</td>
                <td><input type="checkbox" class="cart_remove_check" name="remove_items[{key}]" value="1" /></td>
              </tr>
            {/exp:channel:entries}
          {/items}
        </tbody>
      </table>
      <div class="row">
        <div class="small-9 columns">
          <p style="text-align:right;">
            Subtotal:<br>
            Tax:<br>
            Shipping:<br>
            Total:
          </p>
        </div>
        <div class="small-3 columns">
          <p>
            {order_subtotal}<br>
            {order_tax}<br>
            {order_shipping}<br>
            {order_total}
          </p>
        </div>
      </div>
      <div class="row">
        <div class="small-12 large-5 columns">
          <input class="small button expand" type="submit" name="empty_cart" value="Update Cart">
        </div>
        <div class="small-12 large-7 columns">
          <a href="{path='get-started'}" class="small secondary button expand">Continue Shopping</a>
        </div>
      </div>
      <div class="row">
        <div class="small-12 columns">
          <input id="checkout_submit" class="large success button expand" type="submit" name="submit" value="Place Order">
        </div>
      </div>
    </div>
  </div>
  <input type="hidden" id="payment_token" name="payment[token]" value="" />
  {/exp:store:checkout}
{/exp:stash:set}

```

# Answer
> 3 votes
Your "Update Cart" button is named `empty_cart`. By calling it that you are telling Store it should empty the cart when you click it.

Try changing this line:

```
<input class="small button expand" type="submit" name="empty_cart" value="Update Cart">

```

To this:

```
<input class="small button expand" type="submit" value="Update Cart">

```

# Answer
> 0 votes
Try adding this also in the item loop:

```
<input type="hidden" name="items[{key}][item_qty]" value="{item_qty}" />

```

---
Tags: expresso-store
---


title: Delete from Store Cart

text:
# Question
Title: Delete from Store Cart
First time using store and have hit my first "WTF" moment.

**Add items to cart** \- DONE :)

**Checkout Page** \- Displaying items in cart, cost and tax etc. :)

**Delete Items in Cart** \- Using the documented method - remove\_items input field. I cannot remove individual items from cart.

```
<input type="checkbox" name="remove_items[{key}]" value="1" /> Remove {title}

```

I have this inside the {items} loop. Then before {/exp:store:checkout} I have:

```
<input type="submit" name="update_cart" value="Update Totals" class="btn" />
<input type="submit" name="empty_cart" value="Empty Cart" class="btn btn-danger" />
<input type="submit" name="next" value="Continue to Billing Details" class="btn btn-primary" />

```

Update Totals - **DOES NOT WORK**. Page refreshes but nothing changes

Empty Cart - **DOES WORK!!**

Before I go and dig further, can anyone who has successfully used a checkbox to delete items from an Expresso Store project confirm the code they used or point me in the right direction.

EE 2.7.2 + Store 2.0.3

# Answer
> 1 votes
This has been fixed in Store 2.0.5.

If you are using an earlier version and can't upgrade right now, the problem is caused because Store was ignoring the `remove_items` array if no `items` array was submitted at all.

To work around this, you should simply be able to add this line inside the `{items}` loop in your checkout tag.

```
<input type="hidden" name="items[{key}][item_qty]" value="{item_qty}" />

```

That means an `items` parameter will be submitted, and Store will know to check for `remove_items` as well.

# Answer
> 2 votes
Just to expand on Justin's comment, I had this head scratcher too (assuming you've fallen into the same trap) and made a change request to Expresso.

I had a single form with the quantity and remove buttons on. Users clicked remove, it submitted the form, but the Store code took priority of the quantity and therefore ignored the remove.

I was using the following form code (shortened for simplicity):

```
<input type="text" maxlength="12" name="items[{key}][item_qty]" value="{item_qty}" size="2">
<input type="submit" name="remove_items[{key}]" value="1" class="delete_item" />

```

And it would fail due to the reasoning above - Note this is with Store v1.6.3

So I had to set the quantity to 0 when the user clicked remove.

```
//###   Delete Item from Basket - Send via Ajax   ###
$("form .delete_item").click(function(e) {
    e.preventDefault();
    if (confirm("Are you sure?")) {
        $(this).parents('tr').animate({ "opacity": "hide" }, "slow")
            .find('.quantity input[type="text"]').val(0);
        AjaxSubmit($(this), true);
    }
});

```

# Answer
> 2 votes
Well, I was also looking for an answer for this particular issue. I am still fine tuning what I have but the logic is updating the quantity of the item on the checkout template to zero then update the cart totals, that will remove an item from the cart. Code looks like:

Checkout template: I added a link next to the quantity text field

```
<td>
     <input name="items[{key}][item_qty]" value="{item_qty}" class="input-mini item_qty" />
     <a href="#" class="remove-product">Remove</a>
</td>

```

JQuery Script: This updates the quantity of that item to zero and clicks the update cart button

```
$('.remove-product').click(function(){
         // click handler
         $(this).prev().val('0');
         $('#update_cart').click();
     return false;
    });

```

If someone else has a better solution, you can share for all to benefit

---
Tags: expresso-store, shopping-cart, delete
---


# Question
Title: Place article_images inside a div only if there's more than 1?
Pretty new to ExpressionEngine, so please excuse my lack of knowledge. I have a site where I want to use a slider on pages with more than one article image. The way I have it set up now works fine for these pages, but if there is a page with only 1 image, the image doesn't display because it's being hidden behind and off to the side of the content as if it were a slider image.

Basically, I want to make it so that if there is more than 1 image on the page, it will place the image code inside the "news\_slider" div, but if there is only 1 image, it will just place that single image link without a div container. Here's the code:

```
{if article_images}
   <div id='news_slider'>
      {article_images}
         <img title="{img_title}" src="{img}" />
      {/article_images}
   </div>
{/if}

```

Thanks in advance!

# Answer
Perhaps there is a more elegant way, but this works:

```
{article_images}
    {if total_rows > "1" && row_count == "1"}
        <div id='news_slider'>
    {/if}
         <img title="{img_title}" src="{img}" />
    {if total_rows > "1" && row_count == total_rows}
        </div>
    {/if}
{/article_images}

```
> 4 votes

# Answer
With Matrix you can try next code:

```
{if article_images}
   {if {article_images_total_rows} > 1}<div id='news_slider'>{/if}
      {article_images}
         <img title="{img_title}" src="{img}" />
      {/article_images}
    {if {article_images_total_rows} > 1}</div>{/if}
{/if}

```
> 1 votes

---
Tags: matrix, conditionals
---


# Question
Title: Is it possible for me to change the formatting buttons in the Matrix rich text field?
Is it possible for me to change the formatting buttons in the Matrix rich text field? Just trying to add a break tag `<br>` and maybe a couple others.

# Answer
The formatting buttons aren't part of Matrix. They are part of the ExpressionEngine native RTE. Please see the docs for how to adjust settings for the RTE field here.
> 1 votes

---
Tags: rte
---


# Question
Title: Matching a Low Variable matrix field with custom channel field
Hopefully this will be easy to sort.

One of my custom channel fields is a select dropdown.

I have created a low variable matrix field, which contains two columns.

Column 1 is "Name" & Column 2 is "Description"

When displaying the single entry, I want it to show the name & description in my markup, based on what was selected in the custom field.

Not quite sure how to do this.

```
{exp:low_variables:pair var="lv_custom"}
<h5>Random text to display {name}</h5>
<p>{description}</p>
{/exp:low_variables:pair}

```

Thats my starting point, but I need to somehow make it match the Name against the name that is selected in the custom field.

Any ideas? Thanks.

or I'm open to a better way of doing it!

**EDIT** I've scrapped it for now. Think I was over complicating things.

Gone with this instead in my within my channel entries tag...

```
<h5>Random Text<strong>{custom_field}</strong></h5>
{if custom_field =="Option One"}<p>Description One.</p>{/if}
{if custom_field =="Option Two"}<p>Description Two</p>{/if}
{if custom_field =="Option Three"}<p>Description Three</p>{/if}

```

Ideally I wanted a way to control the Descriptions within the CP, as opposed to hard coding it, but this works fine.

Thanks!

# Answer
> 2 votes
If you are manually editing the options of the custom field, why not replace `<p>Description One.</p>` etc with low variables? (Separate text fields, not a matrix field)

```
{if custom_field =="Option One"}{lv_description_one}{/if}

```

---
Tags: matrix, custom-fields, low-variables
---


# Question
Title: Displaying current and upcoming occurences with solspace calendar
I have a calendar with lots of different events. Some are single days, some span for months, others recur on specific dates, and some others recur on specific dates but also span several days.

How would I display the date of an occurrence while it is in progress, otherwise display the next occurrence?

This is what I have now:

```
{exp:calendar:occurrences
    event_id="{event_id}"
    date_range_start="today"
    date_range_end="+ 1 year"
    occurrences_limit="1"}

    {if '{occurrence_start_date format="%d/%m/%Y"}' == '{occurrence_end_date format="%d/%m/%Y"}'}
        {occurrence_start_date format="%d/%m/%Y"}
    {if:else}
        {occurrence_start_date format="%d/%m/%Y"} - {occurrence_end_date format="%d/%m/%Y"}
    {/if}
{/exp:calendar:occurrences}

```

This works most of the time, but breaks when there are recurring events spanning multiple days. For example, an event which recurs "every other weekend" will be displayed properly until Sunday, since the occurrence start date is Saturday.

# Answer
In a number of cases involving getting event data within a specific timeframe, the recommended tag to use is `{exp:calendar:cal}`. This is the only tag that displays multi-event occurrence listings in full chronological order. More information on the use of the main Calendar tags can be found here: http://www.solspace.com/docs/calendar/getting\_started/

I would then use conditionals to compare {event\_start\_date}, which will be the start date of the currently looped occurrence with EE's native {current\_time}, which displays the current time. You might also want to check if {current\_time} is in between {event\_start\_date} and {event\_end\_date} to display events that are currently in progress.
> 1 votes

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


# Question
Title: Low Variables & Grid with text input containing http:// gives 403 error on save
EE 2.7.2 LV 2.4.0

I have low variables variable containing a grid with two text inputs and a radio button. In the text input for a link, if I add a link containing http:// and save I get taken to a 403 error. If I save the link without http:// everything saves just fine.

Any idea how to fix this? Is it a bug? if so with Grid or with Low Variables?

In case it's relevant have included a screenshot of my grid settings.

# Answer
> 2 votes
I would check to see if you have mod\_security installed on your server. That seeing the `http://` in your form post (saving LV) may be triggering the save to be blocked.

# Answer
> 1 votes
Also, try with a blank htaccess file. Could be an error in your .htaccess rules.

---
Tags: error, low-variables, grid
---


# Question
Title: How to use global variables in if-condition?
Say I have a global variable `foo`. To output it in the templates, all I have to do is:

```
<h1>{foo}</h1>

```

However, I can't seem to use it in an if-condition. For example:

```
{if foo == 'bar'}<h1>Hello, world</h1>{/if}
{if {foo} == 'bar'}<h1>Hello, world</h1>{/if}
{if '{foo}' == 'bar'}<h1>Hello, world</h1>{/if}

```

How do I use a global variable in an if-condition?

# Answer
> 3 votes
The issue is one of parsing order... User Defined global variables are the last thing to be parsed.

This PDF outlines **ExpressionEngine’s Parse Order**.

This page in the docs details the **Rendering Stages of the EE template engine**.

The solution is to switch to using a **Snippet** instead.

# Answer
> 2 votes
You're running into a parse order issue here. The conditionals are parsed before the global variables, and therefore your comparison is taking place with the actual value you have within the conditional instead of the parsed value.

There are a couple things you can do.

1) Use a snippet instead of a global variable, as these parse much earlier

2) Use an add-on like Low Variables, which enables you to set global variables to be early-parsed.

---
Tags: templates, template-scripting, global-variables
---


# Question
Title: Using Stash conditional to interrogate Solspace Tag Related Entries count
I'm using a Solspace Tag - Related Entries to show tagged entries. On the page, I show the first 3 channel entries and then wish to show a link to view more entries, but only if there are more than 3 entries to show.

I'm struggling to get a conditional working to show/hide the link based on the count of items in the results, while using Stash.

Here's my template;

```
{exp:stash:set name="itinerary_events"}
    {exp:tag:related_entries
        channel="event"
        orderby="event_date"
        sort="asc"
        limit="3"
        paginate="bottom"
    }
    {title}
    {/exp:tag:related_entries}
{/exp:stash:set}

{exp:stash:set name="itinerary_events_more"}
    {exp:tag:related_entries
        channel="event"
        orderby="event_date"
        sort="asc"
        limit="15"
        paginate="bottom"
        offset="3"
    }
    {stash:count}{count}{/stash:count}
    {title}
    {/exp:tag:related_entries}
{/exp:stash:set}

{exp:stash:set_list name="itinerary-vars" parse_tags="yes" parse_depth="2"}
    {exp:channel:entries
        channel="{channel}"
        status="open"
        limit="1"
    }
        {stash:tag}{exp:tag:tags entry_id="{entry_id}" limit="1" websafe_separator="-"}{tag}{/exp:tag:tags}{/stash:tag}
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:set name="content"}

    {exp:stash:get_list name="itinerary-vars"}

<div class="box">
    {if "{exp:stash:get name='count'}" > "3"}<a href="#">View all</a>{/if}

    {exp:stash:get name="itinerary_things"}

    {exp:stash:get name="itinerary_things_more"}
</div>

    {/exp:stash:get_list}

{/exp:stash:set}

```

I would be grateful if anyone might be able to help. Thank you.

# Answer
Since your question is about the View All link setup, I removed the `itinerary-vars` set\_list. There's no need to run your `exp:tag:related_entries` tag twice when you're using Stash. Let Stash do the work to cut down on db queries.

```
{exp:stash:set_list name="itinerary_events" parse_tags="yes"}
    {exp:tag:related_entries
        channel="event"
        orderby="event_date"
        sort="asc"
        limit="4"
    }
        {stash:event_title}{title}{/stash:event_title}
        {stash:event_count}{count}{/stash:event_count}
    {/exp:tag:related_entries}
{/exp:stash:set_list}

{exp:stash:set name="content"}
    <div class="box">
        {exp:stash:get_list name="itinerary_events"}
            {if "{event_count}" == 4}<a href="#">View all</a>{/if}
            {if "{event_count}" <= 3}<h1>{event_title}</h1>{/if}
        {/exp:stash:get_list}
    </div>
{/exp:stash:set}

```
> 2 votes

---
Tags: stash, solspace-tag
---


# Question
Title: What is the URL to link to (paginate-able) single entry from channel index or category
I have an index page showing channel entries and also working as the category view.

I want to link to a single entry from either of the above states and then be able to paginate to the next / previous entry within context.

E.g. there are 400 entries. On the main index they show in groups of 20. A category view might show a subset of 70 entries, category 'foo'. I know how to paginate either of these index views. The URLs looks like:

/archive/P40 or

/archive/category/foo/P20

If I want to view a single entry in each state (and paginate) the URL's look like:

/archive/single/P40 or

/archive/single/category/foo/P20

What I can't figure out is how to code the links from the index page to the single entry versions.

Hope that makes sense. Can anyone help? Cheers

# Answer
I'm not following 100% but I think you just need:

```
{title_permalink="archive/single"}

```

This will get you a URL like:

```
/archive/single/article-name-here-using-url-title

```
> 1 votes

# Answer
Untested answer here, but just a suggestion.

You want to be able to show a single entry url but also have a paginated listing on the same page?

Maybe from the initial listing, say /archive/P40, you could create links using `{title_permalink='archive/single'}/{segment_2}` or `/archive/single/{url_title}/{segment_2}`.

or links on /archive/category/foo/P40 you'd do `{title_permalink='archive/single'}/category/{segment_3}/{segment_4}` or `/archive/single/{url_title}/category/{segment_3}/{segment_4}`.

Then on your single entry article you'd use

```
{exp:channel:entries url_title="{segment_3}" dynamic="no" ...}

```

and for your listing - to be honest I don't know if it'll pick it up automagically from the url - but you could use Low Seg2Cat to help out.

```
{exp:channel:entries category="{segment_4_category_id}"}

```
> 1 votes

---
Tags: categories, pagination, entrylinks
---


title: matrix date field output

text:
# Question
Title: matrix date field output
I'm having some trouble getting a matrix field to output a date cell correctly.

I am running EE 2.5.2, Matrix 2.4.1.

When I put the following code into my template:

```
{legislator_labi_score limit="1" orderby="score_date" sort="desc"}
<strong>LABI Score: {score_number}%</strong><br />
<small>(as of {scoreEditDate format="%m/%d/%Y"})</small><br />
{/legislator_labi_score}

```

It outputs like this:

```
(as of {scoreEditDate format="%m/%d/%Y"})

```

If I just put the field with no formatting info at all it outputs like this:

```
(as of June 10,2012)

```

which isn't bad, but it isn't what I wanted. Can you tell me what the problem might be? I saw a post from Get Satisfaction that had this issue, but they upgraded to 2.4.1 and it fixed the issue. I'm running 2.4.1 and I'm still having the problem.

Thanks,

Brian

# Answer
> 1 votes
Per comment from add-on developer team member (Lisa), upgrading is the solution.

---
Tags: matrix, pixelandtonic
---


# Question
Title: Turn profiler and debugger off for specific templates (called via AJAX)?
I have a page where I'm calling several separate sections via ajax. When I am logged in each of these sections pull in their own "version" of the profiler and debugger.

Is it possible to disable in these sections while keeping it on for the main template?

# Answer
You can do this if you're willing to programmatically manipulate hidden configuration variables in your config file ;-)

I use Focus Labs Master Config style configs, so I have this in my dev config:

```
$env_config['template_debugging']  = 'y';
$env_config['show_profiler']       = 'y';

```

And, obviously, you can set those to 'n' by-hand to turn off the debugger and profiler.

But, you also could set those values programmatically, inside of your own PHP conditional. In pseudo-code:

```
$env_config['template_debugging']  = 'y';
$env_config['show_profiler']       = 'y';

if ($currentURL === $myAjaxURL) {
  $env_config['template_debugging']  = 'n';
  $env_config['show_profiler']       = 'n';
}

```

I do manipulate site configs programmatically. It's obviously a place where you can accidentally knock your site offline, but if you are sufficiently careful and/or rube-goldberg-ish, the config files are just another place where you can program things via PHP.

If you don't use the Focus Labs Master Config style configs, you still can do this kind of thing in your config.php. You'll just use the proper EE hidden variable syntax:

```
$config['template_debugging']  = 'n';
$config['show_profiler']       = 'n';

```

One caveat, though: I don't know if EE will overwrite your code in the config.php if you go into the System Preferences (or, other admin) via the CP. You can always set your config.php permissions to read-only when you're doing this testing, to prevent EE overwriting it, if that does become an issue.
> 5 votes

# Answer
You cannot natively turn off profiling and debugging info in specific templates.
> 0 votes

---
Tags: ajax, debugging
---


title: Remember Me Bug

text:
# Question
Title: Remember Me Bug
I am using ExpressionEngine 2.7.2

I have a remember input box in my login form.

However, even if it is unchecked, I still login in immmediately to my site even if I closed the browser.

How is this fixed?

# Answer
This isn't a bug.

The users CP session won't clear when you close the browser... it will clear when the session expires (which I think by default is 1 hour or 3600 seconds).

You can make this longer or shorter by setting "**cp\_session\_ttl**" in your config.php file:

```
$config['cp_session_ttl'] = 3600;

```

The number is in seconds.
> 1 votes

---
Tags: remember-me
---


# Question
Title: Module: Facebook functionality on publish Tab?
I've been banging my head against the wall with this and I have not found an answer.

I am attempting to build an EE application where admin can come in and create a quiz app. I then need to allow the admin to add the app to their Facebook Page (using FB Graph API calls).

What I'm facing is when to introduce that Facebook functionality. From what I could see looks like I need to create a custom module.

**Module -- Publish Tab** But what I see looks like only stuff that goes in publish\_tabs function are fields. Does that mean I must create a custom field then? I would need to allow the user to authenticate the FB App, then give it permissions to manage FB Pages, then *finally* a way to add the entry/quiz to their FB Page.

Is the tab able to do such functionality? Thanks!

# Answer
I don't think you'd want to do this on the Publish Tab. It would be better for the user to save the entry and be presented with your new FB functionality on the subsequent page.

The **entry\_submission\_absolute\_end** hook is probably what you'll want to use. It gives you access to the following specific to the entry being saved:

```
$entry_id (int) – Entry ID of submitted entry
$meta (array) – Entry’s metadata (channel_id, entry_date, i.e. fields for exp_channel_titles)
$data (array) – Entry’s field data
$view_url (string) – Control Panel URL to view submitted entry

```

You can also find some helpful addon development resource links on this question:
**Tools for learning ExpressionEngine addon development**
> 1 votes

---
Tags: custom-fields, module, facebook
---


# Question
Title: Namespacing for a relationship loop breaks scope?
I have a "videos" channel that has a one-to-one relationship with a "person" and a one-to-many relationship with other videos in the same channel. I am trying to display the information about the person and the related videos with a template like this.

```
<Videos>
    {exp:channel:entries channel="videos"}
    <Video>
        <Subject>{person:title}</Subject>
        <Affiliation>{person:affiliation}</Affiliation>
        <RelatedVideos>
            {related}
            <VideoId>{related:person:title}</VideoId>
            {/related}
        </RelatedVideos>
    </Video>
    {/exp:channel:entries}
</Videos>

```

This results in:

```
<Videos>
    <Video>
        <Subject/>
        <Affiliation/>
        <RelatedVideos>
            <VideoId>title 1</VideoId>
            <VideoId>title 1</VideoId>
            <VideoId>title 1</VideoId>
        </RelatedVideos>
    </Video>
</Videos>

```

Note the empty `<Subject/>` and `<Affiliation/>`.

However if I change the template to exclude the related video person:

```
<Videos>
    {exp:channel:entries channel="videos"}
    <Video>
        <Subject>{person:title}</Subject>
        <Affiliation>{person:affiliation}</Affiliation>
        <RelatedVideos>
            {related}
            {!-- <VideoId>{related:person:title}</VideoId> --}
            {/related}
        </RelatedVideos>
    </Video>
    {/exp:channel:entries}
</Videos>

```

I get this:

```
<Videos>
    <Video>
        <Subject>title 1</Subject>
        <Affiliation>affiliation 1</Affiliation>
        <RelatedVideos></RelatedVideos>
    </Video>
</Videos>

```

It seems I can get either the person related to my entry, or the person related to the other entries related to this entry. How can I get both?

# Answer
I'm a little confused as to your channel and channel fields setup, but think you might be missing something if I am understanding.

Since `person` is a relationship field then you should add the `person` tag pair.

```
<Videos>
    {exp:channel:entries channel="videos"}
    <Video>
        {person}
        <Subject>{person:title}</Subject>
        <Affiliation>{person:affiliation}</Affiliation>
        {/person}
        <RelatedVideos>
            {related}
            <VideoId>{related:person:title}</VideoId>
            {/related}
        </RelatedVideos>
    </Video>
    {/exp:channel:entries}
</Videos>

```
> 1 votes

---
Tags: channel-entries, templates, relationships, channel
---


title: Delete Cart Items with Minimum Quantity

text:
# Question
Title: Delete Cart Items with Minimum Quantity
I have EE 2.7.2 and Store 2.0.4, wondering if anyone else have encountered this issue. I can't delete from cart items with a minimum qty set. However I can delete any other items without a min qty as I mentioned here Delete from Store Cart

My template looks like:

```
{exp:store:checkout
    form_class="form-horizontal"
    next="shop/customer-details"}

    {items}
        <tr>
            <td>{price}</td>
            <td>
                <input name="items[{key}][item_qty]" value="{item_qty}" class="input-mini item_qty" />
                <a href="#" class="remove-product">Remove</a>

            </td>
        </tr>
    {/items}

{/exp:store:checkout}

```

And the script:

```
$('.remove-product').click(function(){
        // click handler
        if (confirm("Are you sure?")) {
            $(this).parents('td').find('.item_qty').val('0');
            $(this).parents('tr').animate({ "opacity": "hide" }, "slow");
            $('#update_cart').click();

            return false;
        }
});

```

Any help?

# Answer
I was working on a My Cart page last night and ran into the bug with the Remove From Cart functionality not working. I used jQuery to solve my problem. Here's my basic code.

```
{exp:store:checkout next="checkout/step1"}
    {items}
        <input type="hidden" name="items[{key}][item_qty]" value="{item_qty}" class="remove-{key}">
        <input id="remove-{key}" type="submit" name="update_cart" value="Remove" class="remove-me">
     {/items}
{/exp:store:checkout}

```

AND

```
<script type="text/javascript">
    $(function(){
        $(".remove-me").click(function(){
            var target = $(this).attr("id");
            $("." + target).val("0");
        });
    });
</script>

```
> 1 votes

# Answer
This was a bug in Store 2.0.4 if you upgrade to Store 2.0.5 this should fix the problem for you.
> 1 votes

---
Tags: expresso-store, ee2, delete
---


title: Placing .gitignore abover web root?

text:
# Question
Title: Placing .gitignore abover web root?
I wonder where should I place my .gitignore file when the EE system folder is above the root and I need to track those files.

This is my .gitignore at the moment:

```
# Globals and OS junk files
[Tt]humbs.db
.DS_Store
*.DS_Store
cgi-bin/
error_log

# Subversion files
.svn

# Master Config
config/config.local.php

# Images and Media
sized/
thumbs/
_thumbs/
made/
remote/
public_html/media/**/*
!public_html/media/**/*.gitkeep

# Caches
system/expressionengine/cache/**/*
system/expressionengine/cache/eedt/**/*
!system/expressionengine/cache/**/index.html
!system/expressionengine/cache/**/*.gitkeep
!system/expressionengine/cache/**/current_version

```

Any ideas?

# Answer
> 3 votes
Above the webroot in this case.

# Answer
> 2 votes
I guess you know this, but you shouldn't set up your production sites like that. Ideally it should be:

```
.git
.gitignore
system/
third_party/
templates/
webroot/

```

etc.

You don't want any expressionengine files, addon files, or .git files to be accessible via webroot, or even set up some system to make them unavailable - the easiest and safest is just to keep them outside the webroot.

# Answer
> 1 votes
Personally, I wouldn't want my deployment method to dictate my placement of Git related files. I would rather my deployment process "clean" my environment and perhaps as a back-up, configure the web server to not serve Git related files. For example, here are some suggestions for Apache configurations in another question.

https://serverfault.com/questions/128069/how-do-i-prevent-apache-from-serving-the-git-directory

---
Tags: .gitignore
---


title: Linking to PayPal Express

text:
# Question
Title: Linking to PayPal Express
I'm trying to send the user off to PayPal Express by way of a single button (design calls for a PayPal button and also a regular checkout), so I have this:

```
    {exp:store:checkout
        payment_method="paypal_express"
        return="checkout/confirm/ORDER_HASH"
        require="order_email"
    }

        <div class="fr">
            <label for="inp-login-email" class="fl">Email Address <span class="required">*</span></label>
            <div class="ff">
                <input type="email" name="order_email" id="inp-login-email">
            </div>
        </div>

        <input type="submit" value="Checkout with PayPal">

    {/exp:store:checkout}

```

However that bounces me back to the same page I was on before. Presumably I need to add some more info into that form before I can pass to PayPal?

# Answer
> 1 votes
You'll need to add a name attribute your submit button. Like this:

```
<input type="submit" name="submit" value="Checkout with Paypal" />

```

Then Store knows that you're looking to finish the checkout and make payment.

# Answer
> 2 votes
PayPal express requires that you pass the users email address before it will allow you to create an order. If you wanted to have a similar experience to your current you would need to have something along the lines of:

```
{exp:store:checkout
    payment_method="paypal_express"
    return="checkout/confirm/ORDER_HASH"
}
    <input type="text" name="order_email" placeholder="Your Email Address" />
    <input type="submit" value="Checkout with PayPal">
{/exp:store:checkout}

```

---
Tags: expresso-store
---


# Question
Title: Restricting search or search results to the logged in member's id
I have a restricted site, where users have to login to see any content. The content they are shown is restricted by their member id.

To do this, each entry is assigned to a specific member. I'm using 'VMG Chosen Member' to make this easier in the CP.

Showing the relevant entries is working fine and I'm using the following:

```
{exp:channel:entries channel="fsr" disable="categories|trackbacks" dynamic="off" orderby="fsr-datefield" sort="desc"}
{if logged_in_member_id == fsr-customer}
<tr>
    <td>{title}</td>
    <td>{fsr-datefield format="%Y-%m-%d"}</td>
    <td>{fsr-system-name}</td>
    <td>{fsr-call-type}</td>
    <td><a href="{fsr-pdf}" class="btn" target="_blank">Download PDF</a></td>
</tr>
{/if}
{/exp:channel:entries}

```

I want to apply the same limitations to search/results but when I do, it returns the correct results but if there are no results for that member but there are for other members then I get blank content and cannot redirect to the 'no results' template.

Here's my search results code:

```
{exp:search:search_results}
{if logged_in_member_id == fsr-customer}
<tr>
    <td>{title}</td>
    <td>{fsr-datefield format="%Y-%m-%d"}</td>
    <td>{fsr-system-name}</td>
    <td>{fsr-call-type}</td>
    <td><a href="{fsr-pdf}" class="btn" target="_blank">Download PDF</a></td>
</tr>
{/if}
{/exp:search:search_results}

```

I'd ideally just restrict the search or search results by member id, but that does't appear to be possible?

Does this even make any sense?!

Any other ideas? I'm really rusty with EE btw, so please be gentle :)

# Answer
# Update

Since the VMG Chosen Member is a custom field that just captures the `member_id` and doesn't override the `author_id` of the entry, you could use the search parameter with Low search to find the correct entries:

```
{exp:low_search:form
    collection="fsr"
    search_mode="all"
    search:fsr-customer="{logged_in_member_id}"
    result_page="search/results"
}

```

Make sure the `fsr-customer` field is set to `searchable` too. If this doesn't work, it's most likely a parse order issue with `logged_in_member_id`

# Update #2

With the release of Low Search 3 just now, if the above does not work because of parse order, you can now use parameters as input fields in the latest version. So you could alternatively do this:

```
<input type="hidden" name="search:fsr-customer" value="{logged_in_member_id}">

```

---

I don't believe the native search module supports this type of use. You could use a 3rd party addon like Low Search which allows you to use **all** of the native `{exp:channel:entries}` parameters. So you could do something like this:

```
{exp:low_search:form
    author_id="CURRENT_USER"
    collection="fsr"
    search_mode="all"
    result_page="search/results"
}
  <fieldset>
    <label for="keywords">Keywords</label>
    <input type="search" name="keywords" id="keywords" />
    <button type="submit">Search</button>
  </fieldset>
{/exp:low_search:form}

```

This would then return only entries of the currently logged in user. Also, I updated your relevant entries channel tag. The conditional is unnecessary when using the `author_id` parameter and the `CURRENT_USER` constant. Try this:

```
{exp:channel:entries channel="fsr" author_id="CURRENT_USER" disable="categories|trackbacks" dynamic="off" orderby="fsr-datefield" sort="desc"}
<tr>
    <td>{title}</td>
    <td>{fsr-datefield format="%Y-%m-%d"}</td>
    <td>{fsr-system-name}</td>
    <td>{fsr-call-type}</td>
    <td><a href="{fsr-pdf}" class="btn" target="_blank">Download PDF</a></td>
</tr>

{if no_results}
    Currently you have no entries assigned to you
{/if}
{/exp:channel:entries}

```
> 3 votes

---
Tags: members, search, no-results
---


# Question
Title: "Unable to Load Site Preferences; No Preferences Found" error with HTTPS
I set "Force HTTPS connection for checkout and order tags" to "yes" in the Exp:resso Store settings and was met with this error when viewing my store pages using https:

```
Unable to Load Site Preferences; No Preferences Found

```

All http page loads are fine when I see this error with https page loads.

# Answer
> 4 votes
It turns out this error was caused by a misconfiguration of the SSL certificate at the web host's end.

---

After getting the error on Exp:resso Store pages using https, I tested a page load of the home page (a non Store page) and got the same error. I concluded it wasn't an Exp:resso Store specific issue.

I eliminated htaccess as the source of the error by loading the page with an empty .htaccess file.

I then uploaded a test html file and tested page loads with http and https. https still failed and showed the EE error. This page load of a non-EE page shouldn't show an EE error ever... What the heck? So this wasn't an EE error.

I concluded this was a server issue and emailed the host. They fixed the misconfiguration promptly.

---
Tags: error, ssl
---


title: Stash list, conditionals, and {count}

text:
# Question
Title: Stash list, conditionals, and {count}
I'm using Stash lists to output channel entries grouped by the value of a custom field. In this case the custom field is a relationship field, but that's not relevant because the actual entries output is working just fine. What *is* giving me problems is using the {count} variable to apply a heading to each group of entries. Here's my code (for simplicity I've removed most of the variables that I'm stashing and just including the 'reviewtext' one).

```
<!-- STASH variables -->
{exp:channel:entries channel="reviews" disable="categories|member_data|pagination" show_expired="yes" cache="yes" refresh="10"}
    {exp:stash:append_list name="entries" context="{reviews_assigned_project:channel_short_name}" parse_conditionals="yes"}
        {stash:reviewtext}{reviews_review}{/stash:reviewtext}
    {/exp:stash:append_list}
{/exp:channel:entries}

<!-- book reviews -->
{exp:stash:get_list name="entries" context="books" process="end"}
    {if {count} == 1}
        <h2>Book reviews</h2>
    {/if}
    <article>
        {reviewtext}
        {count} of {total_results}
    </article>
{/exp:stash:get_list}

<!-- comic reviews -->
{exp:stash:get_list name="entries" context="comics" process="end"}
    {if {count} == 1}
        <h2>Comic book reviews</h2>
    {/if}
    <article>
        {reviewtext}
        {count} of {total_results}
    </article>
{/exp:stash:get_list}

```

The output is fine apart from the conditional, which is output verbatim, with the exception that the value of {count} is parsed into the page. So, when I have three book reviews and two comic reviews, I get the following:

```
<!-- book reviews -->
{if 1 == 1}
    <h2>Book reviews</h2>
{/if}
<article>
    ... my entry content ...
    1 of 3
</article>

{if 2 == 1}
    <h2>Book reviews</h2>
{/if}
<article>
    ... my entry content ...
    2 of 3
</article>

{if 3 == 1}
    <h2>Book reviews</h2>
{/if}
<article>
    ... my entry content ...
    3 of 3
</article>

<!-- comic reviews -->
{if 1 == 1}
    <h2>Comic book reviews</h2>
{/if}
<article>
    ... my entry content ...
    1 of 2
</article>

{if 2 == 1}
    <h2>Comic book reviews</h2>
{/if}
<article>
    ... my entry content ...
    2 of 2
</article>

```

I've tried wrapping the conditional in exp:ifelse tags, and I've tried using Switchee instead of the {if} conditional. In every case the conditional tags (of whatever sort, including the ifelse and switchee tags) are output as template code. I tried stashing the count as a variable but that gives me the count from the entire channel entries tag rather than the count of the list output - so my book reviews have counts of 1, 3 and 4, whilst my comic reviews have counts of 2 and 5. Not what I'm after.

What am I doing wrong and how can I get the stash:list's count to work in the conditional statement? Thanks.

# Answer
Try adding parse\_conditionals="yes" to your get\_list. I think the issue is parse order for the conditionals on the get\_list because you are using process="end". Does this work (I also added a prefix parameter for the count):

```
<!-- book reviews -->
{exp:stash:get_list
    name="entries"
    context="books"
    parse_tags="yes"
    parse_conditionals="yes"
    prefix="st"
    process="end"
}
    {if {st:count} == 1}
        <h2>Comic book reviews</h2>
    {/if}
    etc....

```
> 2 votes

---
Tags: stash, conditionals
---


# Question
Title: Item information missing from order details view
I've just updated to Store 2.0.5 and have noticed that item information is missing from the order details admin screen - see image.

Item information is shown as expected in my order invoice template, using the `{exp:store:orders}` tag, however it's missing from the admin screen, exported order PDF and email templates (within the `{items}` tag pair).

All other order details in the admin screen are correct (billing and shipping details, order total etc.)

I presume this is a bug?

EDIT: I forgot to mention, this applies to all orders - those in the system prior to updating to Store 2.0.5, and new orders placed after updating.

# Answer
> 1 votes
This was a bug introduced in Store 2.0.5. You can download the latest version 2.0.6 that was released today to fix this issue.

---
Tags: expresso-store, orders
---


title: Allow members access to certain pages

text:
# Question
Title: Allow members access to certain pages
I'm setting up a membership site where registered members can access video pages.

The access to video pages needs to be done on a per member level. This will be done manually by the administrator.

For example certain members will have access to video page 1 and other members will have access to video page 2 etc.

What is the best way of setting this up?

Will I need to setup individual member groups?

# Answer
> 2 votes
There are a couple of different approaches that you can go about doing this. I am not a huge fan of the multiple member groups because it can be hard to maintain and it requires that you go to the Members admin area, select the members in question then change the member group as needed. If you have multiple videos and might need to have members able to see multiple videos it can easily become unmanageable. (5 videos would result in the need for 120 member groups for all video combinations, and 6 videos would result in 720 options)

The first option that I would recommend would be to take a look at something like Entry Access which will create a new tab on your publish page. You can configure presets for specific member groups or members if you want or by default it will grant access to everyone unless you have selected certain member/groups to have access.

The second option is fairly similar, there are a couple of Member fieldtypes (VMG Chosen Member or VZ Members). With these you would select the members then you would need to have some logic in your template that checked the `logged_in_member_id` vs the output of the `field_name` of the member fieldtype you created.

# Answer
> 2 votes
EE can control access based on member groups, most directly by setting permissions on specific templates. These are set in the control panel under Design / Template Manager and then the Access link per template.

So, you could have templates for video1, video2, etc., and then set the Access per template set to specific groups.

If you have members who need access to multiple pages--e.g., as if they were in multiple groups, this is not possible with EE member groups. A user can be assigned to only one EE member group.

In that case--or, if you have a large number of members such that you'd need too large a number of groups, then you'd maybe use groups simply to have a "Members" group to distinguish between the public/guests and members. All of your members would be in that Members group.

But then you'd need to write custom code on your video page(s) to restrict access based on some data in each member's profile. You'd essentially be writing a custom member access manager, albeit it could pretty simple depending on how many different groups you have and how people are assigned to them.

There are many ways to do this--and lots of people do do this. I think using add-ons like either Solspace User or Profile:Edit would be helpful. There are other add-ons like this, too.

(I'm doing something like this now on a site, using Profile:Edit, which gives each user a regular channel entry. I then assign categories to those user entries that are used to restrict what content they see. I've used Solspace User in the past for something similar.)

# Answer
> 2 votes
At the most basic level, yes, you will need to set up unique member groups in EE. Then in your template add some conditionals. Modify the group\_id numbers as needed.

```
{if logged_in_group_id != "1" OR logged_in_group_id != "6" OR logged_out}
  {redirect="/"}
{/if}
{if logged_in_group_id == "1" OR logged_in_group_id == "6"}
  show this page
{/if}

```

I'd even suggest getting the IfElse add-on and do this:

```
{exp:ifelse parse="inward"}
  {if logged_in_group_id == "1" OR logged_in_group_id == "6"}
    {!-- page content --}
  {if:else}
    {redirect="/"} {!-- or whatever else you want to happen --}
  {/if}
{/exp:ifelse}

```

---
Tags: members
---


# Question
Title: Taxonomy breadcrumbs - only show one level back
I have a taxonomy tree with two levels.

When I am on a page at the second level, i.e., Sales & Management Training, breadcrumbs look like this

```
< Careers < Training Programs

```

But I only want to see the level immediately above the current page, which is:

```
< Training Programs

```

I don't see a way to do this built in the the Taxonomy breadcrumb tag.

# Answer
> 3 votes
I love when I answer my own question. Instead of the breadcrumbs tag, just use get\_node: http://iain.co.nz/software/docs/taxonomy3-get-node

This lets you get information about the parent, which is all we need. It's like a single, elegant, delicious little breadcrumb.

```
{exp:taxonomy:get_node tree_id="2" entry_id="{entry_id}"}
    <a href="{this_parent_node_url}">< Back</a>
{/exp:taxonomy:get_node}

```

# Answer
> 1 votes
You could use a conditionals with a single variable like `node_level` to determine what is shown:

```
{exp:taxonomy:breadcrumbs}
    {if node_level > 1}
        {if here}
            {node_title}
        {if:else}
            <a href="{node_url}">{node_title}</a> →
        {/if}
    {/if}
{/exp:taxonomy:breadcrumbs}

```

---
Tags: taxonomy
---


# Question
Title: BrilliantRetail->checkout_shipping action network FAILURE
In one of my dev environments, I'm having an issue with loading Shipping Rates.

I have action 39, checkout shipping in BrilliantRetail. When I go to the checkout page, the loading.gif spins, then nothing. The network debugging tool in Chrome just shows FAILURE for every "?ACT=39" call.

Any ideas on what to check? The same code is being used in several different dev environments and a production site with no problems.

# Answer
> 3 votes
Its hard to say what the local issue would be without any additional information, but here are a few things you might try:

* Is the request locally going to the correct url? Ajax will fail if for cross domain issues. Make sure the url is exactly the same as the one requested.
* Make sure that you aren't trying to hit an "https" url locally if you do not have an SSL certificate installed. That will throw an SSL error and result in an ajax failure.

---
Tags: shipping, brilliantretail
---


title: Get an EE instance without any output

text:
# Question
Title: Get an EE instance without any output
I'm developing payment gateway for the BrilliantRetail and I need to create IPN callback script which will change BR orders statuses and return response data to the IPN-gateway.

So I'm trying to find a solution to get EE instance but produce no output after calling.

My version of EE is 2.3.1, but I hope to find universal solution for other version.

I have tried a very-very rough way, to put IPN-callback script into the webroot, include index.php and catch output buffer.

```
ob_start();
require_once( 'index.php' );
ob_end_clean();
$ee = get_instance();

```

I don't want to use this solution. I must be sure there are no random output will be returned and no templates will be used at all.

Is there are any ways to get EE instance in than manner by using hooks or something?

Thanks.

# Answer
I have spend some extra time with this issue and have found a very handily solution: using PHP templates stored in DB to get current EE instance and create callback processing script.

As I needed this script for BrilliantRetail payment gateway module ( based upon Brilliant\_retail\_gateway ) main idea is to create PHP-template on module install and remove it on module deleting.

I decided to use custom template group to avoid template groups mess-up.

I'll describe all necessary action for this solution below.

First of all: manually create a template group and template itself for testing ( in Design \> Template Management ) with such parameters:

* Type — Web Page
* Enable Caching — No
* Allow PHP — Yes
* PHP Parsing Stage — Output

*For this example I will use `tpl_group_name` for the group name, and `tpl_name` for the template name*

Turn on file synchronization and save template to the file. For now, you can create write pure PHP code to the template.

**IMPORTANT:** Your template file must have PHP close tag ( ?\> ), to avoid template parsing error.

You can execute your template-script by opening URL like: http://example.com/tpl\_group\_name/tpl\_name

Template will be stored in `system/templates/default_site/tpl_group_name.group/tpl_name.html`

*Directory `default_site` is depend on your system configuration and can be different*

You can work with EE instance in your template via

```
$this->EE

```

After script codding was finished template-script must be packed and placed into the BR Payment module.

I decided to compress file content with gzip then after apply base64 encoding to get plaint text, which allows me to insert compressed content to the file as a string variable.

Finally, you can manipulate your template using `template_model` class. Code below demonstrate how to add PHP-template and group to the DB.

```
// Adding group
$this->EE->load->model('template_model');
$grp_data = array(
    'group_name'        => 'tpl_group_name',
    'is_site_default'   => 'n', // do not replace default group
    'site_id'           => $this->EE->config->item('site_id')
);

// Create group
$group_id = $this->EE->template_model->create_group( $grp_data );

// Adding callback template
$tpl_data = array(
    'group_id'              => $group_id,
    'template_name'         => 'tpl_name',
    'template_type'         => 'webpage',
    'template_data'         => $template_content,
    'edit_date'             => $this->EE->localize->now,
    'save_template_file'    => 'n', // DO not save template to the file for product site
    'allow_php'             => 'y', // allow PHP code
    'last_author_id'        => '1', // assume a super admin
    'site_id'               => $this->EE->config->item('site_id') // use current site_id
);

// Create group
$this->EE->template_model->create_template($tpl_data);

// Clear db cache
$this->EE->functions->clear_caching('db');

```

Unfortunately there are no methods to remove template groups from the DB, so I used DB request to remove group.

Code to remove templates from DB

```
// Find and remove template
$template_id = null;
$template_find = $this->EE->template_model->get_templates( null, null, array( 'template_name' => 'tpl_name' ) );

if( $template_find->num_rows ) {
    $template_tmp = $template_find->_fetch_assoc();
    $template_id = (int) $template_tmp['template_id'];
}

// Remove template if ID was found
if( $template_id ) {

    // Try to remove file as well
    if( !$this->EE->template_model->delete_template( $template_id, true ) ) {
        // If fiel removing has failed -- remove only DB content
        $this->EE->template_model->delete_template( $template_id );
    }
}

// Clear IPN callback template group
$group_id = null;
$groups = $this->EE->template_model->get_template_groups();

if( $groups->num_rows > 0 ) {
    while( $group_tmp = $groups->_fetch_assoc() ) {
        if( $group_tmp['group_name'] == 'tpl_group_name'  ) {
            $group_id = (int) $group_tmp['group_id'];
        }
    }
}

// Remove group record if ID was found
if( $group_id ) {
    $this->EE->db->delete( 'template_groups', array( 'group_id' => $group_id ) );
}
$this->EE->functions->clear_caching('db');

```

If you have any advices — I'm glad to read.

Thanks.
> 0 votes

# Answer
Something is way off about your approach. You should not need the `ob_start()` methods if you were to build this properly. If you need a callback method, what you really want to look into is a using a module for a "controller". (For more info on a controller, refer to CodeIgniter's MVC pattern.)

So could create an ACT url (http://yourdomain.com/ACT=X) and this will be your callback. This will be called before the TMPL object is instantiated, and therefor you can more easily fetch the global instance.

There are two ways that are commonly used to grab the instance in the controller (EE 2.5.5 and before).

```
$this->EE =& get_instance();

```

And in 2.6+ it's simply:

```
ee();

```
> 4 votes

# Answer
I just want to point out that BrilliantRetail has methods for handling IPN callbacks when creating custom gateways. I would consider using the core methods instead of putting logic in templates or files outside of the ExpressionEngine system:

http://docs.brilliantretail.com/3-extending-brilliantretail/payment-gateways/index.html#ipn-methods

The PayPal Standard gateway included in the system/expressionengine/brilliant\_retail/core/gateways folder would work as an example using IPN methods.

Best, David
> 2 votes

# Answer
Have you tried?

```
$ee =& get_instance();

```
> 1 votes

---
Tags: ee2, templates, hook, brilliantretail
---


# Question
Title: Primary Category display in EE2.6 Relationships loop
I can find no way of displaying any of the Primary Category tags within the new EE2.6 Relationships field loop.

It works fine with Playa fields.

Does anyone know if there is a way to display Primary Category tags within EE2.6 Relationship Child loops?

# Answer
> 1 votes
Instead of using the PriCat Tag Pair inside a EE2.6 Relationships Tag Pair, the following works perfectly:

```
{exp:primary_category entry_id='{my_related_field:entry_id}'}{primary_category_parent_url_title}{/exp:primary_category}

```

---
Tags: relationships, categories
---


# Question
Title: White Screen When Adding New Field in Freeform Pro
I am running EE 2.7.2 on a GoDaddy server and I'm attempting to create a new field in Solspace Freeform Pro 4.1.3. I get a white screen after clicking the New Field button. I believe I recall a comment in the Solspace weekly chat that there may be some issues with this combination...GoDaddy being the main issue. Has anyone run into this or aware of any fixes? Thanks!

# Answer
> 1 votes
> "Blank pages in ExpressionEngine, where the source is also empty, are usually the result of a suppressed PHP error."

Here are instructions for troubleshooting blank pages in EE:
http://ellislab.com/expressionengine/user-guide/troubleshooting/general/blank\_pages.html

# Answer
> 0 votes
Just to give up an update here. It seems like it was a rare occurrence, but the team at Solspace did make some updates to the code on my installation which will be a part of the next patch.

---
Tags: solspace-freeform
---


# Question
Title: When I add an image to a WYGWAM field, using Assets, from an S3 source, I get a double slash
I chose an image from a regular upload directory and it works fine. I chose one from an S3 source set up in Assets, and it doesn't. For instance:

```
<img alt="" src="http://s3.amazonaws.com/foursquare.org//1350928362-IMG_3335.PNG" />

```

The double slash is causing the image not to display.

I'm using WYGWAM 2.7.1, EE 2.6.1, Assets 2.1.4, and a lot of Scotch at this point.

# Answer
This was resolved by Pixel&Tonic for me.
> 0 votes

---
Tags: assets, pixelandtonic, wygwam, s3
---


# Question
Title: Using the class="store_product_price" with sale items?
Is it possible to still show that an item is on sale while using the dynamic product variable for store\_product\_price?

Here is what I am trying to do:

```
{if on_sale}~~{regular_price}~~**{sale_price}**{if:else}{price}{/if}

```

When I use the above code, it ONLY shows the sale price, but I'd still like it to show the regular price crossed out.

Am I missing something?

# Answer
You should be able to do something along the lines of:

```
{if on_sale}
  Price: <del>{regular_price}</del>
  {price}.
{if:else}
   Price: {price}
{/if}

```

**EDIT 1:**

If you want to use the dynamic price variables you would need to do something slightly different in this case then putting the css class on the `h2` element. Something along the lines of this to only show the regular price if the item is on sale.

```
<h2>
  Price: {if on_sale}<del>{regular_price}</del>{/if}
  <span class="store_product_price">{price}</span>.
</h2>

```
> 2 votes

---
Tags: expresso-store
---


# Question
Title: Paypal Issue: Invalid response from payment gateway
ExpressionEngine 2.4.0 Store 1.6.4

We're having issues with Paypal as when the browser goes back to the checkout page from Payal we get the "Invalid response from payment gateway." message and the Store 1.6.4 cart doesn't record the transaction. Paypal, however, does send out an e-mail to the client and we receive payment. Any thoughts on what could be the issue? This has only been happening within the last 4 months.... Site has been running since August 2012.

# Answer
> 2 votes
PayPal has depreciated the PayPal Standard API which requires the use of their IPN (Instant Payment Notification) system which has been awful for as along as I can remember (and often causes orders to not complete since the IPN never gets sent). I would enable the PayPal Express gateway in **Store \> Settings \> Payments Methods** then **Add New Payment Method** which should give something that looks like:

PayPal Express Checkout requires an API Username, Password, and Signature. These are different from your PayPal account details. You can obtain your API details by logging in to your PayPal account, and clicking **Profile \> My Selling Tools \> API Access \> Request/View API Credentials \> Request API Signature**.

Once you have enabled the gateway make it the default, if you have hardcoded the original Gateway Short Name in any of your templates you will need to change that to the `paypal_express` short name and then you can disable the PayPal Standard gateway.

# Answer
> 0 votes
PayPal Standard was removed in Store 1.6.0, for precisely this reason. It is extremely unreliable. I'm not even sure how you are still using it with Store 1.6.4.

It's definitely worth upgrading to the newer PayPal Express gateway which also ships with Store.

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


title: exp:channel:form and relationships

text:
# Question
Title: exp:channel:form and relationships
So, running on 2.5.5 I would do the following (with SafeCracker instead):

```
{exp:channel:form channel="resumeer" return="folketinget/resume_ret/ENTRY_ID" include_jquery="no"}
    <p>Overskrift: <input type="text" name="title" id="title" value="{title}" size="50" maxlength="100"  /></p>
     <input type="hidden" name="url_title" id="url_title" value="{url_title}" maxlength="75" size="50" />
     <input type="hidden" name="allow_comments" value="y" />
     <input type="hidden" name="relation_lovforslag" value="<?php echo $entry_id; ?>" />
     <input type="hidden" name="status" value="Closed" />
     {field:wygwam_basic}
     <p><input type="submit" name="submit" value="GEM KLADDE" class="form-submit" /></p>
{/exp:channel:form}

```

This is for creating a related entry to the main channel entry. The field relation\_lovforslag is for that purpose and it just sends the entry\_id of the main entry. However, this doesn’t work anymore and I wonder what the proper syntax is for 2.7?

# Answer
> 1 votes
I ended up getting it to work with:

`<input type="hidden" name="relation_lovforslag[data][]" value="<?php echo $entry_id; ?>" />`

# Answer
> 1 votes
To output the information this worked for me:

```
<p class="grid-row"><em>Fav Style:</em><span>{options:member_favourite_drinks}{if selected}{option_name},{/if}{/options:member_favourite_drinks}</span></p>

```

... and to have this in a select list:

```
{custom_fields}
     {if field_name=="member_favourite_drinks"}
            <select id="{field_name}" name="{field_name}[data][]" multiple="multiple">
                  <option value="">Select...</option>
                  {options}
                      <option value="{option_value}"{selected}>{option_name}</option>
                  {/options}
             </select>
     {/if}
{/custom_fields}

```

# Answer
> 0 votes
This works

```
<input type="hidden" id="relation_lovforslag" name="relation_lovforslag[][data][]" value="<?php echo $entry_id; ?>" />

```

---
Tags: relationships, forms
---


title: 2 entries in one channel

text:
# Question
Title: 2 entries in one channel
I am pretty new to exsprexxion engine and want to ask a quistion i want to do this:

```
<ul class="touchcarousel-container">
  <li class="touchcarousel-item">
    <div class="rblock"> ITEM 1 </div>
    <div class="balk_wit"></div>
    <div class="rblock"> ITEM 2 </div>
  </li>
  <li class="touchcarousel-item">
    <div class="rblock"> ITEM 3 </div>
    <div class="balk_wit"></div>
    <div class="rblock"> ITEM 4 </div>
  </li>
</ul>

```

ENZ....

When I try it I only get all the entries in the upper part of the `<li>` (so they all come in the place of "ITEM 1"). Is there a way to count and display only the od ones and for the bottom `<li>` the od ones?

It would be nice if you can help me out.
Leon

Ok this is the code:

```
                <div class="rblock">
                {exp:channel:entries channel="track_record" dynamic="off"}
                {if count==1}
                     <div class="balk"><p>{title}</p></div>
                    {exp:ce_img:single img src="{track_record_picture}" alt="{title}" width="230" height="132" crop="y" allow_scale_larger="yes"}
                    <div class="text"><p>{track_record_description}</p></div>

                </div>

                <div class="balk_wit"></div>

                <div class="rblock">
                {if count==2}

                    <div class="balk"><p>{title}</p></div>
                    {exp:ce_img:single img src="{track_record_picture}" alt="{title}" width="230" height="132" crop="y" allow_scale_larger="yes"}
                    <div class="text"><p>{track_record_description}</p></div>
                    {/exp:channel:entries}
                </div>
                {/if}
            </li>

```

# Answer
> 2 votes
The most simples way for this is used **switch** tag

```
<ul class="touchcarousel-container">
                {exp:channel:entries channel="track_record" dynamic="off"}
                    {switch='<li class="touchcarousel-item">|'}
                    <div class="balk"><p>{title}</p></div>
                    {exp:ce_img:single img src="{track_record_picture}" alt="{title}" width="230" height="132" crop="y" allow_scale_larger="yes"}
                    <div class="text"><p>{track_record_description}</p></div>
                    {switch='<div class="balk_wit"></div>|</li>'}
                {/exp:channel:entries}
</ul>

```

---
Tags: channel-entries, count
---


title: FreeForm PRO checkbox requied field

text:
# Question
Title: FreeForm PRO checkbox requied field
I am using FreeForm PRO with EE 2.6.1. I have a form that I only want submitted if the author agrees to the terms and conditions by checking the box. I tried to make it a required field, but that did not work.

Any help would be appreciate.

# Answer
> 2 votes
I don't have a copy of Freeform Pro on hand, so I don't have the checkbox fieldtype, but with the free version of 4 I was able to accomplish this with the following:

1. I created a field for the checkbox as a text input named "terms" and attached it to my form
2. I added the required="terms" parameter to my {exp:freeform:form} tag.
3. I added a checkbox input with the name="terms" parameter inside my {exp:freeform:form} tag and set it's value to true.

Upon submission, if the checkbox is unchecked it fails as you would expect, and when it is checked it succeeds.

# Answer
> 0 votes
What Diemer said above will work, but for a better user experience you will probably want to use some jquery to validate the form. Personally I like Parsley.js for this sort of thing and is very simple to use.

You'll also want to add the required="checkbox\_field\_name" parameter to your freeform tags just as a backup measure.

---
Tags: solspace-freeform
---


# Question
Title: exp:channel:month_links - need multi lingual output
I've got a multi lingual site powered by Transcribe and I've run into one area where I am unable to get both French and English to work. See the code below

```
{exp:channel:month_links channel="blog" limit="50"}
    <li><a href="{exp:transcribe:uri path="events/archives"}" {if {month} == segment_4}class="current"{/if} >{month}, {year}</a></li>
{/exp:channel:month_links}

```

I need the **{month}** variable to be in French on the french side and English on the English side. However since this is being pulled directly from EE itself I'm not sure how to achieve this.

# Answer
Since you're evaluating a string, the arguments should be enclosed in quotes (`"`).

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

```

You may need to add a `OR` operator for a second condition to check.

# Update

Just realized I misunderstood your question. I found this Multi Language Module that allows you to define phrases for each language

# Update #2

Since you're using the transcribe module, I would just create variables for each month (ie. `month_01`) and pass it through the translate tag pair:

```
{exp:transcribe:translate name="month_{month_num}"}January{/exp:transcribe:translate}

```
> 2 votes

---
Tags: multi-language, template-scripting, transcribe, multilingual
---


# Question
Title: Error when using WYGWAM 3.2.1 & Assets 2.2.2 with EE < 2.6
According to the WYGWAM Installing and Updating page, WYGWAM requires ExpressionEngine 2.4 or late.

However, if you are using both WYGWAM 3.2.1 and Assets 2.2.2 (may be the same for older versions) and you are running an EE version less than 2.6, you are likely going to get the following error when attempting to access any of the Editor Configurations within WYGWAM's settings:

> Call to undefined function ee() in /PATH/TO/INSTALL/DIR/system/expressionengine/third\_party/wygwam/mcp.wygwam.php on line 139

# Answer
This is a pretty easy to resolve. Simply open up:

/expressionengine/third\_party/wygwam/mcp.wygwam.php

and change line 139 from:

```
$all_sources = ee()->assets_lib->get_all_sources();

```

to

```
$all_sources = $this->EE->assets_lib->get_all_sources();

```

Looks like this is the only reference to the ee() global in the codebase. Because this code block exists in a conditional which only gets executed if you are using Assets, you won't run into this problem if you are using the native File Manager.
> 3 votes

---
Tags: assets, wygwam
---


title: Fields not showing on publish/edit page

text:
# Question
Title: Fields not showing on publish/edit page
I have a site we are setting up on EE 2.72, and without realizing there was a known issue it i started using the Field Editor add-on to add fields. It was throwing some errors here and there but seemed to save things ok.

The issue I'm having is that now I'm getting some fields that just won't show on the publish page layout. I the edit layout sidebar they show as empty squares. When you click on the squares it switches to the eyeball but doesn't actually show in the layout.

I tried removing the field and adding it without field editor, removing field editor, and even going into the database exp\_layout\_publish table and removing the field layout json completely but no luck?

Any ideas?

# Answer
Sounds like you need to reset the **Publish Layout**. Select the member groups for which the layout should be reset and click the "Reset Layout" button. Then refresh the browser window. You'll then need to rebuild your Publish Layout.
> 4 votes

---
Tags: publish-layout, field-editor
---


# Question
Title: Automated Emails - custom, based on member
Is there a way to send emails based on member group (e.g. when a member registers and is assigned group x, they get email x; if group y, they get email y)? My site also is multi-lingual, so being able to send email based on the site's current language when user signs up would be nice. Or being able to send email based on user's language preference would also be good (I'm using SafeCracker registration, so my members have an associated channel entry which can store a language preference).

Possible to do in EE?

# Answer
> 2 votes
Take a look at the **Postmaster addon**. If any addon can do what you're wanting it will be this one. It also has **hooks** for custom development if you end up going that way.

---
Tags: add-on, email
---


# Question
Title: Can a Matrix table be forced to scroll horizontally to allow for usable column widths?
So I have way too many columns, let's get that out of the way first. But, be that as it may, I find that entering Matrix field data on a 13' laptop to be quite cramped.

Here's a sample of what it looks like on my 27" iMac.

Nice, plenty of room to edit all fields.

Now let's look at that same field on a much smaller screen.

Most of it is tedious to work with at this width.

What I'd really like is if the Matrix field would automatically stretch to be as wide as it needs to be, and the containing DIV would just scroll horizontally to accommodate it.

Has anyone encountered, and found a solution for this problem?

# Answer
> 1 votes
This may not work exactly the way you want but it's a solution:

When setting up your Matrix columns set a Column Width. This will force the width of the column.

Then create a new file called override.css and place it into your EE install here:
`/themes/cp_themes/default/css/`

In that file add:

```
table.matrix {
    table-layout: fixed;
    width: 100%;
}

```

---
Tags: matrix, pixelandtonic
---


title: Multiple statuses on a page?

text:
# Question
Title: Multiple statuses on a page?
I currently have a block of code that looks like

And the problem I'm trying to resolve is that I have a section on a different page using all of these statuses in their own divs to create a sort of Editor's Choice area. shown here:

```
THE FEATURED STATUS
{exp:channel:entries channel="news|blog|misc" limit="1" dynamic="no" status="Featured"}
  <div class="featured img">
    an image
  </div>
  <div class="featured text">
    text that links to article view template
      <div><a class="color-red lg featured read-more" href="{site_url}{channel_short_name}/view/{url_title}">Full Article…</a>
      </div>
  </div>
{/exp:channel:entries}

EDCHOICE STATUS
{exp:channel:entries channel="news|blog|misc" limit="1" dynamic="no" status="EdChoice"}
  <div class="EdChoice1 img">
    an image
  </div>
  <div class="EdChoice1 text">
    text that links to article view template
      <div><a class="color-red lg featured read-more" href="{site_url}{channel_short_name}/view/{url_title}">Full Article…</a>
      </div>
  </div>
{/exp:channel:entries}

EDCHOICE STATUS
{exp:channel:entries channel="news|blog|misc" limit="1" dynamic="no" status="EdChoice"}
  <div class="EdChoice2 img">
    an image
  </div>
  <div class="EdChoice2 text">
    text that links to article view template
      <div><a class="color-red lg featured read-more" href="{site_url}{channel_short_name}/view/{url_title}">Full Article…</a>
      </div>
  </div>
{/exp:channel:entries}

```

And those populate perfectly fine. And the articles pulled with EdChoice status work when clicked on basically pulling up their respective channels view template and displaying the article. HOWEVER, anything with the status of Featured shows and goes to the correct url, but does not display and obviously redirects to my 404 page. Here is a block of what's in my view template, of which all the articles (EdChoice, Featured, Open, or otherwise) are pulling:

```
 {exp:channel:entries site="{site_short_name}" channel="news|blog|misc" url_title="{segment_3}" limit="1" dynamic="no" status="Open|Featured|EdChoice" require_entry="yes"}
    {if no_results}{redirect="404"}{/if}
    <h1><span itemprop="name">{title}</span></h1>
            etc etc
 {/exp:channel:entries}

```

And when I changed THE FEATURED STATUS block status to status="EdChoice" the view page works fine. I'm not sure what's going on here. Has anyone encountered this before? Or know what I'm doing wrong as I am new to using multiple statuses

# Answer
> 1 votes
Remove everything from your template and just add this:

```
 {exp:channel:entries channel="news|blog|misc" status="not closed"}
    {title}
 {/exp:channel:entries}

```

If this works, start adding code back in piece by piece until things break.

# Answer
> 1 votes
The `exp:channel:entries` tag by default only looks for **status="open"** entries.

Might be best to use `status="not closed`" in your setup. This will show all entries except those using the "closed" status.

# Answer
> 1 votes
Because you are setting `url_title="{segment_3}"` and `dynamic="no"` try removing the `require_entry="yes"` parameter from your `exp:channel:entries` tag.

OR

Remove `url_title="{segment_3}"` and `dynamic="no"`, and leave the `require_entry="yes"` parameter.

# Answer
> 1 votes
Remove `site="{site_short_name}"` from your tag. This parameter isn't present on your working code.

---
Tags: channel-entries, status
---