title: Assets and Member Group Permissions

text:
# Question
Title: Assets and Member Group Permissions
I recently installed 'Assets' by Pixel & Tonic for a client that has multiple member groups with access to the control panel. Each member group has varying permissions level. The install went fine, but as I was writing up the instructions for one of the members group, I switch my control panel access to a user within that group, 'writers' and notice that none of the images display in the Assets field.

Here is the field, a mini-photo-gallery, viewed as a super-admin

This is the same field, same record, viewed as a writer

I've adjusted the setting under the 'Writers' group, so that they now have access to the Assets Module (which I'm not certain is required), but they still can't view the added images, except on the front-end.

This seems to be directly related to permissions, but I can't seem to find what permissions are stopping a writer from viewing content that's obviously in the record. Especially, when they can add new items to the record.

So my question is, where should I go to look for other permissions that maybe interfering with the display of the images? We need all the groups that have access to the field\_type, to be able to see what data has already been added to it, so that they don't re-add or can just verify that the correct photos have been added.

I've not had to deal with this in other installs of Assets, because generally there is just SuperAdmins and one member group level, like 'staff' who have access to the control panel.

**Updated:** The site is running ExpressionEngine 2.5.3, Build Date: 20120911 and Assets 1.2.2.

# Answer
> 1 votes
Brad ended up figuring this one out:

> "The images that were selected by the Super Admin are all coming from the "Event Images" upload folder (specifically the 2008\_Madison\_Symposium subfolder) and the "outreach" member group does not have permissions to upload to that folder."

Assets should still have let them view those images - and that will be fixed in a future release. The workaround for now is to give that member group permission to that event images file upload preference.

---
Tags: assets, permissions
---


# Question
Title: Disable table sorting for one column of a table created with EE's Table class?
I'm building a fieldtype add-on, and it presents the data contained therein via a table. I'm using EE's Table class to generate the thing, and it's mostly working fine - columns are sortable, etc. However, one column is a checkbox (for selecting that row), and obviously I don't want it to be able to sort by that column.

According to the Table class documentation, I should be able to disable sorting like this:

```
$this->EE->table->set_columns(array(
    'code' => array('header' => 'Code'),
    'name'  => array('header' => 'Name'),
    '_check'  => array('header' => form_checkbox(), 'sort' => false)
));

```

When viewing the generated table, it *looks* like it's doing the right thing (the "no-sort" class):

```
<table cellspacing="0" cellpadding="0" border="0" class="mainTable" data-table_config="{removed for brevity}">
    <thead>
        <tr class="odd">
            <th data-table_column="code" class="header">Code</th>
            <th data-table_column="name" class="header">Name</th>
            <th class="no-sort header" data-table_column="_check">
                <input type="checkbox" class="toggle_all" value="true" name="select_all">
            </th>
        </tr>
    </thead>
    <tbody>
        ...
    </tbody>
</table>

```

However, the table is still sortable by the checkbox column.

With javascript disabled, the output code is:

```
<table cellspacing="0" cellpadding="0" border="0" class="mainTable" data-table_config="{removed for brevity}">
    <thead>
        <tr>
            <th data-table_column="code">Code</th>
            <th data-table_column="name">Currency Name</th>
            <th class="no-sort" data-table_column="_check">
                <input type="checkbox" class="toggle_all" value="true" name="select_all">
            </th>
        </tr>
    </thead>
    <tbody>
        ...
    </tbody>
</table>

```

I've looked at tables that have sorting disabled for one column (the Content -\> Edit table of entries being the prime example), and it appears that the "header" class that is getting added to my table via javascript might be at fault, and the Entries table doesn't have that:

```
<thead>
    <tr class="even">
        <th data-table_column="entry_id">#</th>
        <th data-table_column="title">Title</th>
        <th class="no-sort" data-table_column="view">View</th>
        <th data-table_column="comment_total">Comments</th>
        <th data-table_column="screen_name">Author</th>
        <th data-table_column="entry_date" class="headerSortUp">Date</th>
        <th data-table_column="channel_name">Channel</th>
        <th data-table_column="status">Status</th>
        <th class="no-sort" data-table_column="_check">
            <input type="checkbox" class="toggle_all" value="true" name="select_all">
        </th>
    </tr>
</thead>

```

How do I do this properly?

EDIT: As requested, here's the full table generation code (simplified by removal of conditionals, etc):

```
$this->EE->table->set_columns(array(
    'code'      => array('header' => lang('code')),
    'name'      => array('header' => lang('name')),
    '_check'    => array(
        'header' => form_checkbox('select_all', 'true', FALSE, 'class="toggle_all"'),
        'sort' => FALSE
    )
));

$table_data = array();

// Iterate over the complete list of items to build each table row
foreach ($this->items as $code => $label)
{
    // Is $code found in the $data array?
    $checked = (in_array($code, $data)) ? TRUE : FALSE;

    // Prepare checkbox parameters
    $params = array(
        'name'      => $field_name.'[]',
        'id'        => $code,
        'value'     => $code,
        'checked'   => $checked,
        'class'     => 'toggle'
    );
    // Add row as array to table array
    $table_data[] = array(
        'code'      => form_label($code,$code),
        'name'      => form_label($label,$code),
        '_check'    => form_checkbox($params)
    );
} // End table rows loop

// With all rows prepared, buid complete table
$this->EE->table->set_data($table_data);
return $this->EE->table->generate();

```

# Answer
> 1 votes
I've done this before by removing the javascript sort function in my own addon's jquery file.

```
$('table.mainTable > thead th.no-sort').unbind();

```

---
Tags: add-on-development, fieldtype, table
---


# Question
Title: Has conditional logic changed in ExpressionEngine 2.5.5?
Although I can no longer find the reference on the ExpressionEngine forums, I was advised several years ago by Ellislab staff to use:

```
{if my_custom_field != ""}{/if}

```

rather than:

```
{if my_custom_field}{/if}

```

This has worked well up until now.

After upgrading to ExpressionEngine 2.5.5 from 2.5.2, some of my conditional logic now does not work as expected.

Specifically, results that used to correctly return nothing, now return '0' (zero).

For example, either of the following would return nothing in 2.5.2:

```
{if my_custom_field != ""}
    {my_custom_field}
{/if}
{if "{my_custom_field}" != ""}
    {my_custom_field}
{/if}

```

However, now they return '0', which obviously breaks things.

In order to return nothing in ExpressionEngine 2.5.5, I need to do this instead:

```
{if my_custom_field}
    {my_custom_field}
{/if}

```

If this behaviour is the new norm, I will need to change all my templates, which will suck.

Can anyone confirm this behaviour on their 2.5.5 install, and know if this is the new norm?

Thanks.

# Answer
I cannot replicate this in EE 2.5.5. I tested all 3 variations OP suggested, plus tried single quotes instead of double quotes. The field I tested it against was a File field.

I believe it just depends on the fieldtype.
> 3 votes

---
Tags: conditionals
---


title: Assets and MSM won't upload/display

text:
# Question
Title: Assets and MSM won't upload/display
I have sites A and B Each site has it's own uploads directory, and I have the upload preferences set dynamically:

```
$config['upload_preferences'] = array(
        1 => array(                                                            // ID of upload destination
            'name'        => 'A Images',                          // Display name in control panel
            'server_path' => $_SERVER['DOCUMENT_ROOT'] . '/files/uploads/', // Server path to upload directory
            'url'         => '/files/uploads/'      // URL of upload directory
        ),
        2 => array(                                                            // ID of upload destination
            'name'        => 'B Images',                          // Display name in control panel
            'server_path' => $_SERVER['DOCUMENT_ROOT'] . '/files/uploads/', // Server path to upload directory
            'url'         => '/files/uploads/'      // URL of upload directory
        )
    );

```

so if you are logged into the individual MSM sites control panel (a.com/admin.php), you should be able to upload images to that relative path. I can upload them to the folder via FTP, and then index them via assets and they become available to select, but the thumbnails do not show up. so 2 issues:

1. I can't upload on sibling MSM sites using their respective document roots for upload paths
2. When viewing files that are indexed in assets, no thumbnails appear in file browser

# Answer
> 1 votes
Have you looked at there possibly being problems with openbase\_dir restrictions affecting that? I have generally found with MSM upload errors and images not working correctly have been due to openbase\_dir restrictions.

---
Tags: assets, multi-site-manager
---


title: Content restriction based on IP range

text:
# Question
Title: Content restriction based on IP range
Has anyone ever heard of anything that would control content based on IP range? I am looking to regionalize content for a site.

ie: regionalized promotions offered in a certain area are displayed based on your IP

# Answer
There's a bunch of plugins that do this: http://devot-ee.com/search/tags/tag/ip

Hope that helps!

I did some research and found that you can do exactly what you want with this plugin: http://devot-ee.com/add-ons/ipgeo

and this logic

```
{if "{exp:ipgeo:country}" == "United States"}US featured content{/if}

```

Cheers!
> 3 votes

---
Tags: permissions
---


title: Character entity output in Wygwam

text:
# Question
Title: Character entity output in Wygwam
I have content in a Wygwam field. When I toggle to Source mode, I see numerous `’`, `”`, etc encoded characters. This is as desired.

When that content is output in my templates, using the Wygwam tag, and I view source in my browser, I see the rendered characters --  and  -- not the encoded equivalents that were in the Source view in the Wygwam field.

I have verified that the `entities` and `entities_processNumerical` settings are both set to Yes in the editor configuration.

I discovered this while working on a plugin. The same conversion is happening via the `$this->EE->TMPL->tagdata` value. I'm loading this string into a DOMDocument to do some processing on it, and the rendered characters are breaking.

What should the output data look like?

EE: v2.5.5 - Build Date: 20121220

Wygwam: 2.6.3

# Answer
When you paste directly into "Source" mode and hit submit, CKEditor doesn't get a chance to encode any HTML entities so they get passed to Wygwam unencoded. If you paste in source mode, switch to WYSIWYG mode, then submitted it would encode them. Alternatively, you could probably just use the "Paste as Plain Text" button from WYSIWYG mode and it would work, too.

It's working for you the 2nd time around because Wygwam defaults to WYSIWYG mode.
> 1 votes

---
Tags: wygwam, character-encoding
---


title: Creating a prev/next CATEGORY links

text:
# Question
Title: Creating a prev/next CATEGORY links
There are some great options to do prev/next entries (Advanced Prev/Next, Nearby Entries, etc.) but I could not find an add-on or an EE-native way to do a "Go to Next Category" and/or "Go to Previous Category".

Am I missing something obvious?

# Answer
As mentioned, you can easily do this with the `query` module. I've done something very similar, but you could pass the needed variables to an embed to get the prev/next category.

```
[removed] see updated answer below

```

### Update

Depending on how your categories are ordered (alphabetical or custom) & nested a few more variables are needed. You will need to use an add-on like GWcode Categories to get the necessary variables for a query, specifically `cat_order`, which GWcode gets.

**Parent Template:**

```
{exp:gwcode_categories
    cat_url_title="{segment_3}"
    limit="1"
}
    {embed="some/template" cat_url_title="{cat_url_title}" group_id="{cat_group_id}" parent_id="{parent_id}" cat_order="{cat_order}"}
{/exp:gwcode_categories}

```

**Embded**

```
{exp:query sql=
"SELECT
    cat_url_title as prev_cat_url_title,
    cat_name as prev_cat_title
FROM exp_categories
WHERE cat_url_title <> '{embed:cat_url_title}'
AND parent_id = {embed:parent_id}
AND group_id = {embed:group_id}
AND cat_order = {emebd:cat_order} - 1
LIMIT 1"
}
<a href="../{prev_cat_url_title}/">{prev_cat_title}</a>
{/exp:query}

```

For next category, change the `cat_order` clause to:

```
AND cat_order = {emebd:cat_order} + 1

```
> 3 votes

# Answer
I wrote some code a while back that stepped through categories to generate lists the way I wanted them. While `{exp:query}` is the go-to solution for a lot of category interaction, you can't just use SQL to get these, you need to follow the logic that EE uses to order them.

You can check out the recursive subcategories add-on on Github if you want to try to whip up a plugin that does the same. There's a link to a fork that ports it to EE2.
> 1 votes

---
Tags: navigation, categories, links
---


# Question
Title: Matrix playa field children tag not honoring status
I'm on EE2.5.3 using playa 4.3.3 and matrix 2.5.3 with the code below. My understanding is the children tag should take into consideration the status of the parent and not return children for a closed parent entry. However, I'm getting exactly that. The tag is returning children for parents with a closed status. I've checked to make sure the parent status is closed, entry date is in the past.

Is this a bug or a problem with my code?

```
    {exp:playa:children col="warranty_item_subscontractor" dynamic="no" orderby="title" sort="asc"}
         <li>{title} → {exp:playa:total_parents} warranty {if {exp:playa:total_parents} == 1}item{if:else}items{/if}</li>
    {if no_results}<li>There are no outstanding subcontractor items</li>{/if}
    {/exp:playa:children}

```

Here's some of the output. Both ASD Systems and Beverly Northwest are children whose parent entry is closed and shouldn't be returned.

ACCENTS & INTERIORS, INC. → 8 warranty items

AMERICA 1ST ROOFING → 2 warranty items

ASD SYSTEMS, INC. → 0 warranty items

BEVERLY NORTHWEST, INC. → 0 warranty items

# Answer
> 1 votes
Adding a conditional for total\_parents gets the results I need. However, I'd love it if the children tag honored the parent status.

```
        {exp:playa:children col="warranty_item_subscontractor" orderby="title" sort="asc"}
    {if {exp:playa:total_parents} >= 1}
             <li>{title} → {exp:playa:total_parents} warranty {if {exp:playa:total_parents} == 1}item{if:else}items{/if}</li>
             {/if}
        {if no_results}<li>There are no outstanding subcontractor items</li>{/if}
    {/exp:playa:children}

```

# Answer
> 0 votes
The "status" on the children tag says "only show children whose status is 'Open'". It doesn't apply to the parent.

You might be able to pull it off with a nested:

```
{exp:playa:parents entry_id="{entry_id}" status="Open"}

```

inside the children tag.

---
Tags: matrix, playa, status
---


title: Safecracker and Channel Relationships

text:
# Question
Title: Safecracker and Channel Relationships
I'm using Safecracker to edit entries for the Channel Foo.

Suppose I have another Channel Images which has a filename field and a relationship field that points to Channel Foo.

Essentially, a Channel Foo entry can have 0 or more "images"(1-to-many)

Now when I am editing entries, I may want to add new images to a Channel Foo entry.

Is there a way to do it in Safecracker?

# Answer
Why not have a Playa field in Foo that allows you to choose multiple Images entries? (Instead of relating Foo to Images)
> 1 votes

---
Tags: safecracker
---


# Question
Title: Extensions Manager returns "Internal Server Error"
An EE1 site that I developed many years ago was recently moved to a new server. I logged into the CP to do some work and everything seemed fine, but when I tried to pull up "Utilities -\> Extensions Manager", I get an "Internal Server Error".

I FTP'd in, and everything seems to be in place, permissions correct, etc. Is there something specific that I should look for?

# Answer
It could be any number of things, PHP memory limit, PHP version change (this would be my guess), .htaccess

If you've moved server then it's most likely running a newer version of PHP and if I remember rightly EE1 won't work past a certain PHP version.

I'd compare the versions, check the difference in memory and perhaps temporarily remove the htaccess file.
> 1 votes

---
Tags: control-panel, ee1, extension
---


title: How to integrate Low Search with Ajax?

text:
# Question
Title: How to integrate Low Search with Ajax?
I am at a loss on how to implement Ajax in Low Search.

There is currently no documentation on how to do Ajax with Low Search in the Low Search docs.

I already perused some answers in expressionengines stackexchange(second question one is mine)

http://expressionengine.stackexchange... http://expressionengine.stackexchange...

but the answers are very cryptic, don't show any low search forms and results tag examples and doesn't really help anyone new to implementing Low Search with Ajax.

Does someone have a step-by-step tutorial on how to use Low Search with Ajax?

# Answer
> 0 votes
Here's a gist of the approach I mentioned in the GetSat thread: https://gist.github.com/4632695

That should give you a good starting point.

---
Tags: low-search
---


# Question
Title: Change the class of the Assets buttons in a Safecracker form
I have Assets 2.0.3 as a field in a Safecracker form. The buttons created by Assets have the class "assets-btn", leaving me with pink buttons.

Rather than overriding CSS for these buttons I would rather use a different class to use the styling of Twitter Bootstrap.

Is this possible?

(The styling in Assets 1 was far more generic and preferable for including in Safecracker form.)

# Answer
> 0 votes
Simon,

currently that is not possible, but you can wrap the safecracker form in an element with an id specified and then apply some CSS overrides based on that.

We have discussed better Safecracker support, but we'll have to see how it pans out - we have a couple of ideas that should make people excited - we just have to finalize them and then implement them.

---
Tags: safecracker, assets, css, bootstrap
---


# Question
Title: Inserting HTML into a text area using WysiHat and a custom rte button
I am trying to create a button which inserts custom HTML into a rich text area.

So far I have added the button, and triggered an alert:

```
return "
    WysiHat.addButton('insert_slide_show', {
        label:         EE.rte.insert_slide_show.label,
        handler: function(editor)
        {
            alert("hello");
        }
    });
";

```

I have tried inner html:

```
this.innerHTML("<p>something</p>");

```

and jQuery html:

```
this.html("<p>something</p>")

```

both of which seem to submit the page, i suspect this is due to an error with the html.

I also looked threw the documents on this and still have no clue, any help would be appreciated.

So in summery I'm looking to insert custom html into a rich text area on a button click, using a custom rte button.

# Answer
> 2 votes
So after a little bit of rummaging around on the EE site and some intuition I found this:

```
this.Commands.insertHTML();

```

---
Tags: rte
---


# Question
Title: Having trouble uploading PDFs to a channel
This is an EE1 site. Whenever I try to upload a PDF I get an error message saying that there was a problem uploading this file. The permissions on the server are still set to 777 and the XSS filtering is off. I have no idea what else it could be.

Here is the exact error message:

> PDF – There was a problem uploading ‘TEST.pdf’

# Answer
> 1 votes
Having searched an old EE 1 site's source it looks as though that's an error triggered by Mark Huot's File fieldtype. Here's the corresponding code snippet from ext.mh\_file\_ext.php:

```
foreach($file_tmp_names as $file_key=>$file_tmp_name)
{
    if(@move_uploaded_file($file_tmp_name, $server_path.$file_names[$file_key]) === FALSE)
    {
        $errors[] = str_replace(array('%{field}', '%{file}'), array($file_field['field_label'], $file_names[$file_key]), $LANG->line('error_transfer'));
    }
}

```

Presumably you have an invalid path configured somewhere or this is a permissions issue. If you remove the `@` before `move_uploaded_file` that will disable error suppression and you should see a PHP error that details exactly why the upload has failed.

---
Tags: ee1, file-uploads, xss
---


title: Stash list is empty, but why?

text:
# Question
Title: Stash list is empty, but why?
I am setting a list of entries added to a favorites list. Some of it works but the set\_list portion doesn't. I cannot see why its not working.

```
{exp:shortlist:view}{exp:stash:append name='dofoco-favorites'}{entry_id}|{/exp:stash:append}{/exp:shortlist:view}

{exp:stash:set_list name='favorite_list'}
    {exp:channel:entries
         status="not closed"
         entry_id="{exp:stash:get name='dofoco-favorites' backspace='1'}|0"
         dynamic="no"
         parse="inward"
    }
           {stash:favorite_thumbs}<li>{title}</li>{/stash:favorite_thumbs}
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name='favorite_list'}{favorite_thumbs}{/exp:stash:get_list}

```

However, this outputs as expected:

```
{exp:stash:set name="side-navigation"}
{exp:channel:entries
     status="not closed"
     entry_id="{exp:stash:get name='dofoco-favorites' backspace='1'}|0"
     dynamic="no"
     parse="inward"
 }
    <li><a href="{page_url}">{title}</a></li>
{/exp:channel:entries}
{/exp:stash:set}

{exp:stash:get name="side-navigation"}

```

# Answer
> 4 votes
There are two problems here. First, at the point you try to use `dofoco-favorites` it doesn't exist yet. Second, without using `parse_tags="yes"` when setting the list, the enclosed channel entries tag won't get parsed and the list won't be generated in order to be captured.

I keep banging on about peeling onions, but it's a helpful metaphor when thinking about how the EE template class parses module tags: from the outwards inwards, one layer of tags with each pass.

There are various ways to subvert parse order with Stash, but in this case the `parse_tags="yes"` parameter is the simplest. Using it you can parse any enclosed tags to whatever depth you like (determined by `parse_depth="x"`).

```
{!-- capture the entry_ids, making sure the enclosed tag is fully parsed --}
{exp:stash:set name="dofoco-favorites" parse_tags="yes"}{exp:shortlist:view}{entry_id}|{/exp:shortlist:view}{/exp:stash:set}

{!-- capture the list items. We can access Stash vars like this {stash:my_var} --}
{exp:stash:set_list name="favorite_list" parse_tags="yes"}
    {exp:channel:entries
         status="not closed"
         entry_id="{stash:dofoco-favorites}0"
         dynamic="no"
    }
           {stash:favorite_thumbs}<li>{title}</li>{/stash:favorite_thumbs}
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="favorite_list"}
    {favorite_thumbs}
{/exp:stash:get_list}

```

# Answer
> 0 votes
Try adding `parse_tags='yes'` to your set\_list parameters and removing `parse='inward'` from your channel entries tag.

---
Tags: stash
---


# Question
Title: Order entries by custom date field, with empty date-entries last in list
I'm listing courses by a custom date field, but some courses are "on demand" and doesn't have a specific time. When using orderby="custom\_field" and sort="asc" all the courses without a date shows up first in the list. How can I get them to show up at the end instead?

# Answer
> 3 votes
You may have to run two Channel Entries loops to do this, since the empty fields are essentially treated as `0`, so they will always come first in an ascending order.

First, to get your entries which *have* a custom date:

```
{exp:channel:entries channel=:courses" orderby="course_date" sort="asc" search:course_date="not IS_EMPTY"}

```

Then grab those which do *not* have a custom date:

```
{exp:channel:entries channel="courses" orderby="title" sort="asc" search:course_date="IS_EMPTY"}

```

---
Tags: custom-fields, entry
---


# Question
Title: Sidebar widget selector in pages channel using structure
The site I'm currently building has a dynamic sidebar. I want the user to make a decision about what gets displayed in the sidebar in the channel content.

I am currently using structure, so I have a channel called pages. Under that I wish to have a tabs which allows the user to select different widget options and order them.

I also need the ability to add my own custom widgets.

I have tried the add on **widgets** but this seems to only allows me to set up different widget categories and i dont feel doing one for each page would make editing of the page clear to the end user.

Any thoughts on add ons or if the widgets addon can be added to the channel field options.

# Answer
Could you use Matrix & Playa to solve this?

Your Matrix field would let you add any number of sidebar widgets to the page as rows in Matrix. You can configure the Maximum Allowed Rows if you want to limit the number of sidebar widgets you associate.

Within each Matrix row, your Playa field can be used to relate widget entries from their own Sidebar Widgets channel. You can manage those via Structure under the Assets tab, giving them appropriate widget/sidebar fields and templates.

### Updated:

Instead of selecting Widget entries in your Playa field, you can configure Playa to choose from other channels: People, Blog Posts, Videos, etc.

Within your Widget template, have a series of conditions:

```
if channel==people
...
if channel=blog
...

```

Then you pull the appropriate excerpts, images, etc from those respective channel entries, and format the widget appropriately for that content.

I've done this many times in the past, and we're doing it on a current project with a different CMS: Store the "promo" or widget content on the entry you're linking to, and pull that specialized content through a sidebar/widget template wherever you've specified to promote that content.

We used this approach throughout this site: http://massgeneralcenterforglobalhealth.org
> 4 votes

# Answer
I usually use a relationship field (either built in or Playa) as mentioned here already, but you could also use a custom field on each entry. Then, your sidebar channel tag could use the search parameter to pull in ones with the custom field "sidebar" or whatever you assign. This works fine, but each is managed on it's own, while using a relationship field lets you do them all at once.
> 0 votes

---
Tags: structure, dynamic
---


# Question
Title: Why does the word Signature appear in Forum responses?
I am setting up a Forum for a client (running EE 2.5.5) and have Signatures enabled, however, whenever anyone posts a reply the signature shows up like this:

> **Signature**
>
> Mark Twain
>
> CIO

I checked the template code and it shows like this:

```
<div class="fm-signature-wrapper">
<h4>{lang:signature}</h4>
{if signature_image}
    <img src="{path:signature_image}" class="fm-signature-image" border="0" width="{signature_image_width}" height="{signature_image_height}" alt="{lang:signature_image}" />
{/if}
<div class="fm-signature">
    {signature}
</div>

</div>

```

If I can just get rid of the word **Signature** I will be content.

Thanks.

# Answer
It looks like `<h4>{lang:signature}</h4>` is the culprit. Have you tried removing that?
> 4 votes

---
Tags: forum
---


# Question
Title: Membership Fields Failing to Map During Checkout / Account Creation in Expresso-Store
Hullo

We've a 4 stage checkout process working (Select Billing, Email Address & Passwords, then Optional Shipping Stage, then Delivery/Shipping Method, then Payment Method). This all works lovely as far as getting an order through the system, with all the right data in the order details. A member account is created, with the matching password, however all of the mapped fields are nowhere to be seen.

ExpressionEngine 2.5.3 | Expresso Store 1.6.2

Any ideas? Have we missed a magic tag? We are using register\_member field in the checkout tag.

Many thanks

Geoff

# Answer
This is a known issue in Store 1.6.2. Mapped member fields aren't updated for customers who register an account during checkout (because the account is currently created after the mapped fields are processed). For all existing users the mapped fields should be working correctly.

**UPDATE:** This issue has been fixed in Store 1.6.3.
> 3 votes

# Answer
Did you map them in the Store Order Fields panel? Order Fields allows you to map order fields to member fields:

Store \> Settings \> Order Fields
> 1 votes

---
Tags: expresso-store, members
---


# Question
Title: Assets refresh button spinning, not showing file locations
I've just whipped up a new EE v2.5.5 site with a copy of Assets 2.0.2. I've added in a file upload location, and when I go to Assets I see a spinning refresh button with no locations showing below.

I noticed that if I click 'Update indexes', the location I added in shows up there OK.

Any ideas what might be behind this?

# Answer
You always need to start by updating your indexes. That’s Assets’ equivalent of EE’s upload directory synchronization. Without updating your indexes, the File Manager won’t know that your upload directories even exist.

The Refresh button in the File Manager is sortof a Poor Man’s Update Indexes – it will only update indexes for the currently-viewed folder’s files. But again, if you haven’t done the real Update Indexes yet, you won’t have a currently-viewed folder in the first place.
> 2 votes

# Answer
> Hi Brandon - I think i've solved this one. The server default is set to index.html, and I had an index.html file in the root (acting as a holding page). Without that, Assets works like a charm!

With that in mind, the issue was simply that Assets’ Ajax requests were getting sent to your index.html file rather than index.php.

You can keep your index.html page in place and simply point Assets to your index.php file by adding this to your system/expressionengine/config/config.php file:

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

```
> 1 votes

---
Tags: assets
---


# Question
Title: Changing channel assignments for one member group disables them for other member groups
Every time I try to create a new member group (or edit any member group that isn't Super Admin) and assign channels and module access to this new group it disables all channel assignments module access in other member groups. If I then go back to the original member group to fix the disabled channel assignments and module access, the new one gets disabled.

It should be noted that I have two add-ons that *may* be part of the problem. These two add-ons are Structure and Zoo Visitor.

Any idea why this might be happening??

# Answer
> 4 votes
I think, you are using ExpressionEngine 2.5.3. You should see here https://support.ellislab.com/bugs/detail/18234 for the solution.

---
Tags: members, structure, zoo-visitor, member-details
---


# Question
Title: Dynamic Filepaths to Assets Files in Wygwam Fields
How does one go about building a dynamic link to a file managed by Assets within a Wygwam field?

In other words, when we move our EE project from dev.example.com/projects/project\_name to example.com, will we have to go back into Wygwam and update all of our paths to any PDFs or images that were linked to within our Wygwam fields, or is there a way to build those links (perhaps using {path}?) so they don't break?

# Answer
> 5 votes
I'm hoping I'm getting this right. I'm not a Wygwam/Assets expert, so... The way we have handled it is by setting our EE file upload preferences 'URL of Upload Directory' settings with the relative path from the web root. For example:

```
'/images/article_images/'

```

I believe Wygwam then uses the {fieldir\_1} syntax when it saves the image path, so in the channel data it gets a path like:

```
{filedir_1}myimage.jpg

```

Then when it is processed in the template the image path becomes:

```
<img src="/images/article_images/myimage.jpg" />

```

---
Tags: assets, wygwam
---


# Question
Title: CartThrob Price Modifier Configurator add column not working
Running CT v2.2.4 at the moment and having troubles adding columns to the fieldtype.

The docs show an inventory column, but I can't see how to add that. Docs are spotty at best. http://cartthrob.com/docs/fieldtypes/price\_modifiers\_configurator/index.html

When I click the add column, it adds the column to top portion of field, and I can type in it, then on entry save, column is lost.

# Answer
So, you're talking about keeping the inventory in the product options field, if I am reading this right. Two things:

* Make sure you have mapped the inventory to this field, in the CartThrob settings.
* Keep in mind that you should keep inventory in only one field - if you're tracking individual line item inventory using an options field, you should always keep your inventory in that field.
> 1 votes

---
Tags: add-on, cartthrob
---


# Question
Title: FreeForm 4.0.10 - possible to have submit button download a file and submit form?
I need to set up a form where users submit information in order to download a file that should be downloaded as soon as they click the submit button (which is going to say "Download").

Is this possible? I know I can always have the form redirect to a page with the download link, but ideally clicking download would start the download and submit the form at the same time.

# Answer
You'll want to set the form redirect page to allow PHP and set http headers to force download of the PDF. Something like this.

You can, of course, mix EE tags in that PHP-enabled template, so you could include a value in your segment variables to look up the right PDF to download, etc. Lots of options.
> 2 votes

# Answer
Why not use jQuery to trigger a get request for the download URL?
> 2 votes

# Answer
I think, it would be fairy easy by using the hook either freeform\_module\_insert\_end or freeform\_module\_insert\_begin. And in this hook you can use the force download of "download" helper.
> 1 votes

---
Tags: solspace-freeform, how-to
---


# Question
Title: Are there limitations to ExpressionEngine's JavaScript templates?
I recently upgraded a couple of sites to EE2.5.5. I was utilizing templates to store JQuery and its plugins, combining all within an index file of my 'scripts' group. This isn't necessarily best practice, or how I typically include JQuery in my more recent builds, but it worked for the sites for a very long time. Upon completing the EE2 upgrade, JQuery included in a template produces a script error, breaking the site's scripting.

Here is an example error from firebug using JQuery 1.7.1:

```
SyntaxError: unterminated string literal
...entElement;q.setAttribute("className","t"),q.innerHTML="<link/><table></table><

```

This occurs on all versions of JQuery I've tried, minified or not, and produces a variety of errors.

The real answer is "Don't load JQuery from a template", but I think the fact that EE is somehow breaking JS code when using a Javascript template type is something to note and question. Are there limitations to 'javascript' template types?

# Answer
My specific issue was corrected by making sure that both the JavaScript files and the index file I was embedding them into were set to use the 'JavaScript' type.

Earlier versions of ExpressionEngine would work with that index file set to other template types, but the latest versions are particular, and submit more strict headers with the templates.
> 2 votes

---
Tags: templates, javascript, jquery
---


title: Assets 2.0.3 Rename File Issue

text:
# Question
Title: Assets 2.0.3 Rename File Issue
Just upgraded a site from EE 2.5.2 \> 2.5.5 and Assets 1.XX \> 2.0.3 (along with a couple of others)

Not that I ever tried it previously but a user has reported that when right clicking an image in Assets and "rename" the modal appears but upon saving nothing happens.

Here we add "NEW" to the end

Browser "refeshes" and filename doesn't change

I can confirm this is in fact a "real" problem, no obvious errors are being thrown either. Site is running PHP 5.3.19

Bit of a loss as to why but that's why I'm here :)

# Answer
This will be fixed in the next release. Thanks for the heads up!
> 1 votes

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


# Question
Title: Safecracker / zoovisitor required category field
I am using zoo visitor to register members onto a site. Some member groups are required to select their country which is saved in their entry as a category.

There is also a region field which is a sub category list linked to the country.

I have all the required field errors set inline but am not sure how I would require the country category (and if possible the region if it was present)

Here is the relevant section of my code :

```
{exp:zoo_visitor:registration_form return='/register/success' allowed_groups="7|8" datepicker="yes" error_handling="inline" rules:country="required"}
<label for="mobile" class="required">Mobile number:</label>
<input type="text" name="mobile" id="mobile" value="{mobile}" />
<span class="error"> {error:mobile}</span><br>

<label for="country_of_residence" class="required">Country:</label>
<select name="category[]" id="country" class="quicksearch region_optional">
    <option value="">Select Country</option>
    {exp:channel:categories category_group="1" parent_only="yes" style="linear" parse="inward"}
    <option data-name="{category_name}" value="{category_id}">{category_name}</option>
    {/exp:channel:categories}</select>
    <br><span class="error"> {error:country}</span>

<label for="regions" class="required">Region:</label>
<select name="category[]" id="regions" class="quicksearch">
    <option value="">Select Region</option>
    {exp:channel:categories disable="category_fields" style="linear"}
    {if parent_id == '0'}{if count != '1'}</optgroup>{/if}<optgroup label="{category_name}">{/if}
    {if parent_id != '0'}<option value="{category_id}">{category_name}</option>{/if}
    {/exp:channel:categories}
    </select> <br>

{/exp:zoo_visitor:registration_form}

```

# Answer
Thanks for the suggestestions. I have decided to use jquery validation on the form instead. i think it will give me beter control over the the output.

http://github.com/posabsolute/jQuery-Validation-Engine

Demo: http://www.position-relative.net/creation/formValidator/
> 0 votes

# Answer
As inline error handling works for channel's custom fields and native fields like Title, URL title but not for category.

You should show global error messages for it like

```
{global_errors}{error}{/global_errors}

```

Hope it would help you.
> 0 votes

---
Tags: safecracker, zoo-visitor
---


# Question
Title: ExpressionEngine Search not working with Matrix
I have a list of files in a Matrix field. here is a screenshot of it: https://i.stack.imgur.com/2QC9Y.jpg

So we have a file\_title of 'Form 1' and when I search for Form I get the EE error page that says no Results Found. Even when searching for Form 1 verbatim I get the same result.

Just to be concise here is the code for the search box:

```
{exp:search:simple_form search_in="everywhere" result_page="site/search-results" status="not closed" where="all" show_expired="yes" show_future_entries="yes"}
                <input type="image" src="/img/search-input.jpg" alt="Hunt" class="button" />
                <input type="text" name="keywords" id="header_s" class="text" maxlength="100" />
            {/exp:search:simple_form}

```

Any help would be greatly appreciated.

# Answer
Matrix’s “Is col searchable?” setting doesn’t take effect until you re-save your entries. If you’ve got a lot of entries, check out this script which will loop through all of your entries and re-save them for you.
> 3 votes

# Answer
First thing is to add the `channel=""` **parameter** to your search tag with the short name of the channel or channels that needs to be searched.

Other things to check:

1. Is the entry containing this data set to closed?
2. Does the entry containing this data have an expiration date set that has passed?
3. Does the entry containing this data have an entry date that is set for the future?
> 1 votes

---
Tags: matrix, search
---


# Question
Title: Fatal error: Call to undefined method CI_Typography error on line 315
I'm getting this error on the front-end, although the back-end/CP seems to be working correctly:

```
Fatal error: Call to undefined method CI_Typography::initialize()
in /my_path/system/expressionengine/modules/channel/mod.channel.php on line 315

```

The server wizard works fine, and 1.x that was running on the same server/directory was functioning as well.

Where should I start to look? Thanks all!

# Answer
> 1 votes
Well well, problem solved with simply resetting all permissions to its correct places (even the non-cache/config files), and re-uploading core files.

Feeling silly? YES!

---
Tags: channel, module, error, server, fatal
---


# Question
Title: What does $config['disable_all_tracking'] do?
Not sure how to choose to set $env\_config\['disable\_all\_tracking'\] = 'y' or 'no'; When documentation says if set to 'y' some of the below settings are disregarded

```
/* Tracking
-------------------------------------------------------------------*/
$env_config['disable_all_tracking']        = 'y'; // If set to 'y' some of the below settings are disregarded
$env_config['enable_sql_caching']          = 'n';
$env_config['disable_tag_caching']         = 'n';
$env_config['enable_online_user_tracking'] = 'n';
$env_config['dynamic_tracking_disabling']  = '500';
$env_config['enable_hit_tracking']         = 'n';
$env_config['enable_entry_view_tracking']  = 'n';
$env_config['log_referrers']               = 'n';
$env_config['gzip_output']                 = 'y';

```

Thanks in advance for great support

# Answer
I'm still not certain what your overall question is, but I can explain **$env\_config\['disable\_all\_tracking'\] = 'y';**.

```
$env_config['disable_all_tracking']        = 'y';

```

Is part of ExpressionEngine's option for Handling Extreme Traffic. If you `disable_all_tracking` then you **do not** have to individually set the options for:

```
$env_config['enable_online_user_tracking'] = 'n';
$env_config['dynamic_tracking_disabling']  = '500';
$env_config['enable_hit_tracking']         = 'n';
$env_config['enable_entry_view_tracking']  = 'n';
$env_config['log_referrers']               = 'n';

```

These `disable_all_tracking` option is generally set to 'n', but if your basing it off a master config that is trying to maximize performance, then it would be set to yes.

These options are best used for **traffic spikes** or sites that are constantly hit heavily. For your average site, having tracking on is fine, and will provide you with a variety of information that can be used to help you measure the site's success.

But, many of these details are also provided by Google Analytics (GA) and content delivery networks (CDN), such as CloudFlare. So as long as your site is configured to use an analytics program, those details are still available to you, just not via the control panel.

Some developers leave this variables on by default, and I know others turn them off by default, so that is up to you for the site your building or managing.

Also if you need to deal with heavy traffic sites or just want to make a site that performs better, add Solspace's Website Performance Guidelines to your reading list, and take a look at some of their performance enhancing add-ons. You can also take a look at Matt Perry's Make EE Faster presentation.
> 5 votes

---
Tags: config, config-overrides
---


title: Searching across multiple installations

text:
# Question
Title: Searching across multiple installations
Assume there are 10 separate EE installations: each installation is on its own domain (possibly with its own hosting), its own database, etc. Assume further that they have a particular Channel that is identical across all 10 sites (e.g. a "Products" channel that has the following fields: name, description, category, price).

Is there a way to develop a separate site that can list all 10 sites' Products entries? And is there a way to allow a user of this new site to be able to search across the 10 sites (e.g. find all Products that are category "toy" order by price)?

Say MSM is not an option.

# Answer
Google Custom Search Engine could handle the cross-site search. It allows you to create a search option that can be limited to one site or multiple sites. I believe there maybe a limit on the number of sites, but I recall it being higher than 10.

As for the 10+ sites consolidated to a single site? That's harder, if you want 'pure consolidation', since the entries would have same entry\_ids, possibly similar or same product names, categories, etc. But if you don't want or need everything, and want to retain details on which site which data came from, you could look at RSS or XML, publish a feed from each site, that's imported into the consolidated site, using something like Data Grab or Feed Parser.

Data Grab is more robust, Feed Parser is free. Either can pull data from one EE install into another, and you can add unique fields, for storing original site, and original entry\_id for that site, if need be. If images are involved, you'd obviously want to reference the full url to the image on the site it was originally created on. This may require a find and replace on import.

The benefit of pulling the data from multiple sources into a single install and stored in a database like this, is the data can be normalized and limited. If you only need name, price, description, image, and link to original, then everything can be stored into a single channel, with just the needed data. You can either then just search the new site, since it would send the user back to the original site, or you could still use Google CSE.

The data imports can be automated, once the feeds are set-up and working, you can set-up a cron job to run once a day or every hour to find new entries and pull them over. With 10 sites, you may want to create 2 or more cron jobs and stagger them, so that sites 1-5 data are pulled at the top of the hour and sites 6-10 data is pulled at the bottom. That way, the site shouldn't behave sluggishly, on processing.
> 2 votes

# Answer
Use JQuery / Javascript to load the various searches from the other sites and display all on one page.

Either that, or serverside, you'ld have to make a very elaborate plugin that does it, has to connect to all databases separately.

Edit: or use a server side search and retrieval technology like Apache Lucene ( http://en.wikipedia.org/wiki/Lucene ) or similar, and feed data into it.
> 0 votes

---
Tags: multi-site-manager, search
---


title: Matrix_ext/channel_entries_tagdata

text:
# Question
Title: Matrix_ext/channel_entries_tagdata
I have a template which channel's custom fields do not use neither Matrix nor Playa, but the template debugger shows about 60-70 times:

> Calling Extension Matrix\_ext/channel\_entries\_tagdata Calling Extension Class/Method: Playa\_ext/channel\_entries\_tagdata

Why is that?

# Answer
Playa and Matrix both use the `channel_entries_tagdata` extension hook to do their thing. Extension hooks are called whenever that particular hook runs in EE's process, regardless of whether they may be needed anywhere on that individual page load. In this case, I can only assume you're returning 60-70 individual channel entries in your template?

But they are just function calls which in this case will return very quickly having done nothing.
> 4 votes

---
Tags: matrix, playa
---


# Question
Title: SQL Query to write member username to custom channel field
Can anyone help with the syntax to write ALL members 'Usernames' in a particular member Group to a custom\_field in a channel.

Each member would have one entry each in this channel and I need to pull their username into the channel before deleting the member.

# Answer
Here's some simplified code (you asked for "syntax" and not actual code, so i assume you're familiar enough to write the actual code yourself?). You'd have to roll this into a PHP-enabled template and replace some variables with their actual names (or array members).

To get all the `username`s:

```
SELECT member_id, username FROM exp_members WHERE group_id = X

```

Then, loop through those results with a `foreach` statement, and grab the `entry_id`:

```
SELECT entry_id FROM exp_channel_titles WHERE member_id = $member_id AND channel_id = X LIMIT 1

```

Then update like so:

```
$this->EE->db->query(
    $this->EE->db->update_string(
        'exp_channel_data',
        array('field_id_X' => $username),
        'entry_id = $entry_id'
    )
);

```

**UPDATE:**

OK, here's the code. First, backup your database, then create a new template, enable PHP on it, then put this in it (replace the appropriate variables values at the top of the script) and load it in your browser.

```
<?php

$this->EE =& get_instance();

$member_group_id = XX;
$channel_id = XX;
$field_id = XX;

$members = $this->EE->db->query("
    SELECT member_id, username
    FROM exp_members
    WHERE group_id = $member_group_id
");
if($members->num_rows() > 0)
{
    foreach($members->result_array() as $member)
    {
        extract($member);
        $entries = $this->EE->db->query("
            SELECT entry_id
            FROM exp_channel_titles
            WHERE member_id = $member_id
            AND channel_id = $channel_id
            LIMIT 1
        ");
        if($entries->num_rows() > 0)
        {
            $entry_id = $entries->row('entry_id');
            $this->EE->db->query(
                $this->EE->db->update_string(
                    "exp_channel_data",
                    array("field_id_$field_id" => $username),
                    "entry_id = $entry_id"
                )
            );
        }
    }
}

?>

```

I strongly suggest you read up on doing database queries in EE -- it's pretty straight forward and can make migration work like this a breeze.
> 1 votes

---
Tags: members, custom-fields, database, query
---


# Question
Title: Display Choice from Select Dropdown Custom Field in Sidebar
This is taken from this previous thread but I still can't get the answer. Can someone help me?

Basically I am looking to be able to display different sidebar options dependant on what option is picked in a custom field.

Channel = page.

Custom Field = page\_sidebar\_options - which is a select dropdown with 6 options.

Embed Templates = sidebar\_default, sidebar\_opt\_1, sidebar\_opt\_2 etc.

Template code:

```
{exp:channel:entries channel="page" disable="member_data" limit="1" dynamic="no"}
{embed="include/{page_sidebar_options}"}
{/exp:channel:entries}

```

The answer given on the EE forums hasn't worked for me. I can get my page to display "sidebar\_default", "sidebar\_opt\_1" etc but not the actual code itself.

Thanks.

# Answer
> 1 votes
Give this a shot.

```
{exp:channel:entries channel="page" ...}
  {if page_sidebar_options == "default"}{embed="include/sidebar_default"}{/if}
  {if page_sidebar_options == "one"}{embed="include/sidebar_opt_1"}{/if}
  {if page_sidebar_options == "two"}{embed="include/sidebar_opt_2"}{/if}
{/exp:channel:entries}

```

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


# Question
Title: Multi-entry Channel Entries need to be a list?
Another question! I'm in the middle of a site redesign which has got me thinking about this.

When I am displaying multiple entries from a channel, i.e on a listing page, does the channel entries tag have to be part of a list `<li>` `<ul>` etc in order to display correctly?

In my current design I have all my listing pages as `<ul>` lists, but in my redesign I designed a listing page with multiple entries based on a recurring div.

Something like

```
<div class="container">
  <h2>Title</h2>
  <span>Date</span>
  <p>Description</p>
</div>
<div class="container">
  <h2>Title 2</h2>
  <span>Date 2</span>
  <p>Description 2</p>
</div>

```

Therefore if I wrapped the channel entries tag (with a limit of 10) around the first container div, and passed the fields through, would it then give me 10 repeated div's?

Not sure if this is an obvious or stupid question, but I am still learning EE, and the tuts that I followed when building all worked of lists items for multi entries.

# Answer
This is more of an HTML question than an EE question. ExpressionEngine will return 5, 10, 20 or whatever number of entries you like, in the format that you like.

So if you want each entry returned as

```
<div class="container">
  <h2>Title</h2>
  <span>Date</span>
  <p>Description</p>
</div>

```

It will do so.

For example, here's the code we use on an image gallery:

```
{exp:channel:entries site="site" channel="gallery" limit="30" orderby="title" sort="asc"}

<div class="clearfix frame four columns{exp:tag:tags entry_id='{entry_id}' limit='5' orderby='total_entries' sort='desc'} {tag}{/exp:tag:tags}">
    <div class="gallery-meta">
        <h3><a href="/{image_type}/display/{url_title}/">{title}</a></h3>
        <p>{image_caption}</p>
    </div>
<img src="/images/gallery/{image_medium}" alt="{title}" />
</div>

{/exp:channel:entries}

```

You just have to decide which pieces of the code need to be repeated, and which go outside of the channel tag.
> 3 votes

# Answer
Whatever is between the `{exp:channel:entries}{/exp:channel:entries}` tags will be repeated for each entry.

So for this:

```
{exp:channel:entries channel="blog"}
  <div class="entry">{title}</div>
{/exp:channel:entries}

```

You'd get a `<div>` for each entry.

However, a common practice is to use conditionals to output stuff at the beginning and end though.

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

  {if count == 1}<ul>{/if}
    <li>{title}</li>
  {if count == total_results}</ul>{/if}

  {if no_results}
    <p>There are no entries.</p>
  {/if}

{/exp:channel:entries}

```

This way, you have control whats at the start, end, and what happens if there are no entries.

You don't have to use lists, you can use whatever code you want.
> 4 votes

---
Tags: channel-entries, channel, list
---


# Question
Title: Website using old images... is this a cache issue?
I've built a site for a client that has a section which displays a number of entries.

For each entry there is a thumbnail.

There are currently 50 entries, and for just two of those entries the website is displaying the wrong thumbnails. All others are working correctly.

I'm using the brilliant CE Image plugin to display my images.

I've tried clearing my browser's cache, EE's cache AND deleting the contents of my 'images/made/images/remote' directory, but it's still displaying the wrong images.

Any ideas anyone?

Thanks in advance,

Tom

# Answer
> 2 votes
It turns out the problem was being caused by the lack of a simply setting in the CE Image tags. As Aaron from CE Image very helpfully pointed out, by adding `remote_cache_time="360"` CE Image automatically checks each thumbnail image every 360 minutes (or 6 hours) and overwrites it if the image has changed.

Thanks to everyone for their suggestions!

---
Tags: ce-image, image, cache
---


title: "On This Day" Plugin for EE2?

text:
# Question
Title: "On This Day" Plugin for EE2?
Someone named Yoshi Melrose wrote a plugin for EE1 called "onthisday" which I'm using on my EE1.7.1 sites. I'd like to migrate those sites to EE2 and this functionality is a key requirement. I'm trying to locate a replacement plugin or find someone interested in migrating the EE1 plugin.

The plugin is really cool for blogs. It allows you to create a link to posts that were made "on this day" (or a date of your choosing) from previous years. Since I've had a couple of blogs that have been running for about 7 or 8 years, the results can sometimes be very interesting and fun.

Has anyone heard of this plugin? I can't find an EE2 version (or locate Yoshi for help), so a functional replacement would be very much appreciated.

I think migrating it is beyond my skill level since it actually extended the weblog class in EE1 and I can't see how to do that in EE2.

# Answer
> 4 votes
You can use a custom query to fetch the titles and url\_titles on the channel\_titles table. It has a year, month and day column. If you need custom fields too, then you could only fetch the entry\_id's and feed those to an embed, for a regular channel:entries tag.

edit (example)

```
On this day:<hr>

{exp:query sql="
  SELECT
    title, url_title, year
  FROM
    exp_channel_titles
  WHERE
    channel_id = 1
  AND
    month = {current_time format='%m'}
  AND
    day = {current_time format='%d'}
  "}

  <p>{year} - {title} - {url_title}</p>

  {if no_results}
    <p>nothing found</p>
  {/if}
{/exp:query}

```

Query module:
http://ellislab.com/expressionengine/user-guide/modules/query/index.html
Date formatting:
http://ellislab.com/expressionengine/user-guide/templates/date\_variable\_formatting.html

If you need full custom fields then only select the entry\_id and feed it to an embed with channel entries. The zero in front is a fail-safe (for if no entries are found).

```
 // Main template (query result something like 0|12|32|44)

{embed="blog/thisday"
   items="0{exp:query sql="SELECT entry_id FROM exp_channel_titles
              WHERE channel_id = 1
              AND month = {current_time format='%m'}
              AND day = {current_time format='%d'}
              "}|{entry_id}{/exp:query}"}

 // embedded template blog/thisday

 {exp:channel:entries channel="blog" entry_id="{embed:items}"}
    <p>{title}</p>
    {!-- {custom_field} --}
    {if no_results}nothing found{/if}
 {/exp:channel:entries}

```

or without embed, but with parse="inward", and a bit cluttered

```
 {exp:channel:entries channel="woningaanbod"
    entry_id="0{exp:query sql='SELECT entry_id FROM exp_channel_titles
          WHERE channel_id = 1
          AND month = {current_time format='%m'}
          AND day = {current_time format='%d'}
          '}|{entry_id}{/exp:query}"
    parse="inward"
  }
    <p>{title} - {entry_date format="%Y %m %d"}</p>
    {!-- {custom_field} --}
    {if no_results}ahum, nothing found{/if}
 {/exp:channel:entries}

```

ps. this (and EE in general) is quite delicate with the double and single quotes nesting inside each other. Anything inside the entry\_id="" tag (inside those double quotes), needs to have single quotes if you use tags for a parameter. Luckily the current\_time is parsed very early on, so those nested single quotes from the format parameter, inside the query module tag, are replaced first with the values for month and day. After that, the query module runs first, because of the parse inward parameter. the rest is history, "on this day".

---
Tags: plugin
---


# Question
Title: Recurring subscription for posting channel entries
Hope this is OK to ask here.

I have a relatively simple EE site set up, and I am soon looking to expand the sites scope by adding the option for business owners to be able to post an advert/description of their business to the site. The advert will be entered via a safecracker form on the front end, and will become an entry into the relevant channel.

For this I want to charge a yearly fee.

I am currently looking at the possible options.

I can either:

a. Charge a yearly subscription for the actual ad. Therefore anyone can add an advert, and pay on a "per ad" basis.

or

b. Charge the business a yearly fee for access to the "advertisers" member group. Once they have paid for access and become an advertiser, allow them to access the safecracker forms to upload their ad.

At the moment I do not mind which scenario I take, but I am looking at the possible options for each.

As far as I am aware, the only two add-ons that will allow me to create this functionality are CartThrob (together with the new Subscriptions add-on) or Membrr.

Initially I thought Membrr, as it would allow me to implement option 1 (and 2 I think!), but I have heard a few reports that it is not the easiest to implement.

I have seen recommendations for CT, although the initial price is steep, and I think it is probably a bit overkill in terms of functionality for what I want to achieve.

I was wondering if anyone had any experience they can share, or suggest another way of adding this functionality.

# Answer
> 1 votes
I would suggest you to use Membrr module (http://www.membrr.com/).

The Membrr module has a very good feature of "Channel Protection" which seems to fit perfectly according to your need and it have much less price than CT :).

# Answer
> 1 votes
Well, i would still recommend CartThrob!

I actually did something for a site with the Cartthrob Pro add-on that sounds like what you want to do. It was for a property site where the site allowed a property owner to add a listing for their property and then add that listing to their basket. They could then pay for it and on payment confirmation that property listing (an EE entry) would have it's status changed from "pending" to "open" so that listing was made live. This used a custom extension i built.

Your scenario would be the same but change "listing" to "advert" in the above! There is now a extension on Cartthrobs github account that does exactly what my extension did and it's free too.

Whatever route you take, i appreciate it's much more expensive, but Cartthrob will allow you the most flexibility.

Just my 2 cents :)

---
Tags: cartthrob, ecommerce, payment-gateway
---


# Question
Title: Limit the amount of entries a user can post?
Is it possible to limit the amount of entries that a user can post. For example, if users are posting entries to a channel via a safecracker form, can I limit them to a single entry?

# Answer
How would you want to enforce the limit? You could use a query tag at the top of the Safecracker form:

```
{exp:query sql="Select count(*) 'number_posts' from exp_channel_titles where author_id='{member_id}'"}
    {if number_posts == 1}{/if}
{/exp:query}

```

And within that query, you could do a redirect, display a message, or wrap the whole form in a conditional that wouldn't display it if the user had \> 1 result.

You could also only enable the form `if number_posts < 1`, and then in the else case redirect to an edit form for their single entry.

(Might not be the right syntax for author/member -- You'll need to look up the actual tags for those.)
> 6 votes

---
Tags: channel-entries
---


title: Store isn't adding products to the cart

text:
# Question
Title: Store isn't adding products to the cart
I'm building a VERY simple store setup to demonstrate its capabilities to a client. I setup a quick and dirty EE site, added Structure, Wygwam and Store. EE and all the add-ons are current versions. I then created my field types, my product channel, and linked the two. I added a store home page in Structure and told it to use the store\_example/index template. I added a single product then went to the site. So far so good. I went to the product page, clicked on add to cart and nothing appears in the sidebar cart after the page reloaded. Is there some step I've missed or a reason why my add to cart button wouldn't work?Remember, these are the default templates that are installed with Store, I haven't changed anything other then that main navigation on top. and linked to a common bootstrap.css file.

**UPDATE:** I'm not sure how relevant this is but I started looking at other Store examples on the web and I noticed that the exp:store:product tag was outputting a form tag with an action. Mine is missing the action parameter for some strange reason.

**UPDATE 2:** .htaccess file contents:

```
# remove index.php
RewriteCond %{QUERY_STRING} !^(ACT=.*)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

# EE 404 page for missing pages
ErrorDocument 404 /index.php/site/404

# remove www
# RewriteCond %{HTTP_HOST} ^example.com$ [NC]
# RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

```

The removal of index.php is from the documentation for Structure and has worked for all sites I've ever built with it. The 404 was added recently due to EE not working without it. I never could figure out why. The removal of www is commented out because this is a test site.

Commenting out the removal of index.php and updating my $config\['site\_index'\] does work but I'd like to be able to remove index.php from the URLs.

# Answer
The 404 line is almost certainly the problem. I've seen this a couple times before now.

Basically Apache is treating every page load as a 404 and sending it through to ExpressionEngine. At this point EE sees the URL and displays the page you expect. While this works well enough for most pages, it also happens to destroy any POST data, which is why no products are added to your cart. It's more of an accident that your site is working at all, and you should really try to avoid this situation.

**Rule of thumb:** Never use `ErrorDocument 404` in an ExpressionEngine htaccess file. It does more harm than good, and masks the underlying issue.

You should always start by testing **only** the official htaccess method:

```
RewriteEngine On

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

```

Note you should leave out the `<IfModule mod_rewrite.c>` lines, because all they do is hide errors when `mod_require` isn't enabled (and it's much better to know about this problem than to spend hours trying to figure out why rewrite isn't working, trust me).

It doesn't look like you're using it, but for the record, always **avoid NSM Htaccess Generator**, it often breaks form submissions (precisely because it adds an `ErrorDocument 404` line like you have used above). Also always start from the smallest htaccess possible, then add back in lines as necessary (I've seen people with htaccess files 3 pages long wondering why their site isn't working).

If the official htaccess isn't working, try changing the `RewriteRule` line to one of these:

* `RewriteRule ^(.*)$ index.php/$1 [L]`
* `RewriteRule ^(.*)$ /index.php?/$1 [L]`
* `RewriteRule ^(.*)$ index.php?/$1 [L]`
* `RewriteRule . index.php [L]`

If that still doesn't work, try changing the `$config['uri_protocol']` setting in `config.php`. I find `PATH_INFO` or `ORIG_PATH_INFO` work more often than not on stubborn servers:

```
$config['uri_protocol'] = 'ORIG_PATH_INFO';

```

Finally, if none of those suggestions work, it's probably time to start talking to your web host - often they have much better knowledge of how their servers are configured (alternatively, find a host with a more standard setup).
> 3 votes

# Answer
I experienced the same problem and it was related to the .htaccess file. That would be the place to investigate.
> 0 votes

---
Tags: expresso-store, htaccess
---


# Question
Title: Stash set_list/get_list only returning one entry
I'm using Stash to create an A-Z page, that will simply loop through each {title} from the Pages module, using the match/against regex as follows;

```
{exp:channel:entries channel="page" sort="asc" orderby="title" dynamic="no"}

    {exp:stash:set_list name="pages_a" parse_tags="yes" match="#^A#" against="{title}"}
        {stash:title_a}{title}{/stash:title_a}
        {stash:url_title_a}{url_title}{/stash:url_title_a}
    {/exp:stash:set_list}

    {exp:stash:set_list name="pages_b" parse_tags="yes" match="#^B#" against="{title}"}
        {stash:title_b}{title}{/stash:title_b}
        {stash:url_title_b}{url_title}{/stash:url_title_b}
    {/exp:stash:set_list}

    {exp:stash:set_list name="pages_c" parse_tags="yes" match="#^C#" against="{title}"}
        {stash:title_c}{title}{/stash:title_c}
        {stash:url_title_c}{url_title}{/stash:url_title_c}
    {/exp:stash:set_list}

{/exp:channel:entries}

<h4>A</h4>
<ul>
    {exp:stash:get_list name="pages_a"}
        <li><a href="/{url_title_a}">→ {title_a}</a></li>
    {/exp:stash:get_list}
</ul>

<h4>B</h4>
<ul>
    {exp:stash:get_list name="pages_b"}
        <li><a href="/{url_title_b}">→ {title_b}</a></li>
    {/exp:stash:get_list}
</ul>

<h4>C</h4>
<ul>
    {exp:stash:get_list name="pages_c"}
        <li><a href="/{url_title_c}">→ {title_c}</a></li>
    {/exp:stash:get_list}
</ul>

```

However, it is only returning one entry for each get\_list/letter. I was wondering if anyone can spot something that I am missing?

Admittedly the code is a little more verbose than it perhaps needs to be.

Thanks.

# Answer
What you currently do is setting a list every time a channel entries loop runs, which is why you only get the result stored during the last loop that matched your criteria.

Put the set list tags outside the channel entries tags and just set one list at that point. Stash set list will automatically detect multiple rows and capture them.

```
{exp:stash:set_list name="st_pages" parse_tags="yes"}
    {exp:channel:entries channel="page" sort="asc" orderby="title" dynamic="no"}

        {stash:st_title}{title}{/stash:st_title}
        {stash:st_url_title}{url_title}{/stash:st_url_title}

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

```

Match against can then be used to create three lists out of one when you GET the list.

```
{exp:stash:get_list
   name="st_pages"
   match="#^B#"
   against="st_title"
}
...
{/exp:stash:get_list}

{exp:stash:get_list
   name="st_pages"
   match="#^A#"
   against="st_title"
}
...
{/exp:stash:get_list}

```
> 3 votes

---
Tags: stash
---


# Question
Title: {filename} Variable Outputting Full Path
Assets 2.0.3; EE 2.5.5

My Assets field is inside a Matrix cell. The Matrix field is named `index_slides`, and the Assets cell is named `full`. I want to output just the filename of the file (myfile.jpg). Here's the code I'm using:

```
{index_slides}
    {full}
        <p>The name of this file is {filename}</p>
    {/full}
{/index_slides}

```

Instead of outputting "myfile.jpg" as expected, it outputs the full file path ("http://mysite.com/my/upload/dir/myfile.jpg"), which should be what the `{url}` variable is for.

# Answer
> 1 votes
The issue seems to be that I'm using a single variable farther up in the tag pair, like this:

```
{index_slides}
    {exp:ce_img:single
        src="{full}"
        width="500"
        height="300"
        alt="{alt}"
        crop="yes"
    }
    {full}
        <p>The name of this file is {filename}</p>
    {/full}
{/index_slides}

```

That seems to be getting Assets all confused, which is understandable.

# Answer
> 0 votes
can you try by putting the code like:

```
{index_slides}
    {full}
        <p>The name of this file is {file_name}</p>
    {/full}
{/index_slides}

```

as asset cell also treat as file field type so it may work.

---
Tags: assets, matrix
---


# Question
Title: CartThrob - Discount ‘undefined’ using AJAX
Since the CartThrob guys seem to have vanished from the face of this earth, I hope somebody here has the knowledge to help me out with this problem:

I am using AJAX to update the totals on a single page checkout page.

When entering an invalid discount code in the input for the ‘add\_coupon\_form’ and then entering a valid code after that, the discount value returns as ‘undefined’. Also, apart from the XID code, none of the other CT debugging info displays in the console.

If entering a valid discount code straight away (without entering an invalid one on first try), the code is applied and totals are updated as expected.

**The form code in my template:**

```
{exp:cartthrob:coupon_info}
    {if no_results}
      {exp:cartthrob:add_coupon_form return="shopping-bag/payment" id="coupon"}
        <label class="show" for="coupon_code">Have a discount code? Enter it here:</label>
        <input type="text" name="coupon_code" id="coupon_code" class="coupon_code" value="" placeholder="Discount code" />
        <button type="submit" class="apply btn classy">Apply Discount</button>
      {/exp:cartthrob:add_coupon_form}
    {/if}

    {exp:cartthrob:add_coupon_form return="shopping-bag/payment" id="coupon"}
      <label class="show" for="coupon_code">Discount code used:</label>
      <input type="text" name="coupon_code" id="coupon_code" class="coupon_code" value="{coupon_code}" disabled />
      <a href="{path='shopping-bag/remove-coupon'}" class="remove btn classy">Remove discount code</a>
    {/exp:cartthrob:add_coupon_form}
{/exp:cartthrob:coupon_info}

```

**The AJAX code:**

```
// AJAX functions
            // if set to true, ajax form will be shown, and all json data will be printed to the console log
            var ct_debug = true;

            function update_cart(data, statusText, xhr, $form) {
                if (data.success) {
                    $('input[name=XID]').val(data.XID);
                    $('.payment-total .subtotal .col2').html( data.cart_subtotal );
                    $('.payment-total .discount .col2').html( '- ' + data.cart_discount );
                    $('.payment-total .shipping .col2').html( data.cart_shipping );
                    $('.payment-total .total .col2').html( data.cart_total );

                    if (data.cart_discount && data.cart_discount != '$0.00') {
                        $('.payment-total .discount').removeClass('hidden');
                        $('form#coupon label').html('Discount code used:');
                        $('form#coupon input').attr('disabled', 'true');
                        $('form#coupon button.apply').addClass('hidden');
                        if ( $('form#coupon .remove').length == '0' ) {
                            $('form#coupon').append('<a href="{path=\\'shopping-bag/remove-coupon\\'}" class="remove btn classy">Remove discount code</a>')
                        }
                        $('form#coupon .invalid').addClass('hidden');
                    }
                }
                if (!data.success) {
                    // invalid discount code added
                    if ( $('form#coupon .invalid').length == '0' ) {
                        $('form#coupon').append('<p class="invalid"><small>The code you entered is invalid.</small></p>');
                    }
                    $('.shopping-bag.payment').find('form#coupon input.coupon_code').val('');
                }
                // if debugging is turned on, all data will be output to the js console log
                if (ct_debug)
                {
                    $.each(data, function(index, item){
                      console.log(index + ": " +item);
                    });
                    $.each(data.errors, function(index, item){
                      console.log(index + ": " +item);
                    });
                }
                return true;
            }

            var cart_form_options = {
                success: update_cart,
                dataType: 'json'
            }

           // discount code entered
            $('.shopping-bag.payment').find('form#coupon button').click(function(){
                var form = $('form#coupon');
                $(form).ajaxForm(cart_form_options);
                $(form).submit();
            });

```

I am only just getting to grips with AJAX, so maybe I made a mistake there that I can't see.

I've also posted this in the CartThrob forums, but as I've said, the team hasn't been answering any posts for over a month, and aren't replying to emails or tweets.

# Answer
It could be that your update to the XID isn't specific to the form you're updating. Do you have an update cart form on the page as well? This line:

```
$('input[name=XID]').val(data.XID);

```

Will look for ALL fields on a page with the name set to XID. You need to set that in the scope of the form you're updating, like so:

```
$form.find('input[name=XID]').val(data.XID);

```

Notice $form is passed as one of the attributes to your success function of ajaxForm. You should do that for all your calls to the form fields.

Regarding some of your jquery, you could improve performance by chaining (See: http://api.jquery.com/end/). E.g, instead of:

```
$('.payment-total .subtotal .col2').html( data.cart_subtotal );
$('.payment-total .discount .col2').html( '- ' + data.cart_discount );
$('.payment-total .shipping .col2').html( data.cart_shipping );
$('.payment-total .total .col2').html( data.cart_total );

```

You should really do:

```
$form
    .find('.payment-total')
        .find('.subtotal .col2')
            .html( data.cart_subtotal )
        .end()
        .find('.discount .col2')
            .html( '- ' + data.cart_discount )
        .end()
        .find('.shipping .col2')
            .html( data.cart_shipping )
        .end()
        .find('.total .col2')
        .html( data.cart_total );

```

That saves jquery having to start traversing the DOM for each line and is a good practice.
> 1 votes

---
Tags: cartthrob, javascript, ajax
---


title: Simple Commerce Currency

text:
# Question
Title: Simple Commerce Currency
Even though I have my currency set to CAD my purchases are coming through paypal as USD. Am I missing something because I cannot figure out why.

```
{exp:channel:entries channel="products" sort="asc" entry_id="21|22|23|24|25|26|27|28"}
{exp:simple_commerce:purchase entry_id="{entry_id}" success="user_main/success" cancel="user_main/index" country_code="CA" currency="CAD"}

       <p><strong>{item_name}</strong> -
       {if item_type == "purchase"}

< a href="{add_to_cart_url}" onclick="window.open(this.href);return false;">Add to Cart</a >

       {/if}

{/exp:simple_commerce:purchase}
{/exp:channel:entries}

```

# Answer
> 1 votes
Is your currency set correctly/added in PayPal? Login to PayPal and go to:

***My Account \> Profile \> My Money \> PayPal Balance More Menu \> Currencies***

---
Tags: ecommerce
---


# Question
Title: Auto populate a field? (In this case a Matrix cell)
> **Possible Duplicate:**
> Pre-fill matrix field when creating new entry?

Is there a way to automatically populate a field with a fixed static value in the EE control panel publish page? Specifically in my case I'm looking to auto populate a cell within Matrix with a pre-determined fixed static value.

Natively or with the help of an addon.

# Answer
You can use the instructions text of the custom field to insert some javascript where you can populate the field.

See Pre-fill matrix field when creating new entry?
> 3 votes

# Answer
Another option for you is using an add-on like MX Cloner that would allow you to clone, or copy, entries.

You could create 'default' entry with initial set of data (make sure it's status is 'closed' so it's not published on site) and ask authors to clone it when creating a new entry. That way, entries will be created already with set of required data in them.
> 2 votes

# Answer
It seems that you would like to have new field type which can put for a matrix cell and this will only populate static text (not for inputting value/s). If so, a small field type need to be developed which should be supported with matrix.

Please shed more light on your need in the case i 'm incorrect.

Thanks,
> 1 votes

# Answer
I had to set up default entries in the past and have new entries "inherit" from those. We did that with SAEF, now Safecracker, and 2 steps for new entries. We'd support just enough fields to get the entry going in step 1, redirect to a template that would populate the fields with values from the default entry, save those values and redirect back to the full entry for step 2.

You might be able to make that 1 step in Safecracker by wrapping a subset of fields in a channel entry tag for the default entry values.
> 1 votes

---
Tags: matrix, fields, automation, pre-populate
---


# Question
Title: Unable to Change Template Caching Preference
I am running into the strangest problem. I am unable to change template preferences on an EE site. I am a Super Admin, but when I click "Edit Preferences" and try to Enable Caching I get a dropdown at the top of the page that says, "You are not authorized to access this page".

Help! I’ve tried all sorts of things and can’t figure out what on earth is going on.

# Answer
> 3 votes
I ran into this a while back and Robin helped me. Here's the thread on the subject: http://ellislab.com/forums/viewthread/224591/

And here's the answer:

As an update for anyone who stumbles on to this post, the great EllisLab team tracked the issue down to headers and post data through json. Info is below:

It boiled down to a json array being sent as a string on that manage page whenever it had to pull back the template group’s data via ajax.

But looking at it- we couldn’t figure out why we couldn’t reproduce. It’s because you have your site set to NOT send http headers. And EE’s output class, when sending AJAX, sends a header to treat it as json. But since you’ve got sending headers turned off- it gets seen as a string, and goes wrong.

We’re actually going to discuss the long term solution tomorrow. Really- that header probably should be sent regardless of the header setting. But- it can be worked around by explicitly including it in the ajax call. That’s actually what I’ve done on your site for now- in themes/javascript/compressed/cp/manager.js :

```
function refresh_prefs_ajax(id) {

 $.ajax({
  type: "GET",
  url: EE.template_prefs_url,
  data: "is_ajax=TRUE&group;_id=" + id,
  dataType: 'json',
  success: function (data) {
   EE.pref_json = data;
  }
 });

```

see that dataType param? That’s what fixed it.

I suspect the long term fix may be different- and we’ll attack it from the output class. But it needs some discussion. For the short term- the hack should work fine. And when we release the next version we’ll have a fix in it, though what that fix is may vary a bit.

* Robin

# Answer
> 1 votes
Doing a search on `lang('unauthorized_access')` in the EE codebase shows that it's used for just about everything. Have you checked file permissions within your site directory? Is it trying to create a cache directory or file on the server and unable to?

---
Tags: templates, admin, system
---


# Question
Title: Database errors when deleting channel fields and second site with Multisite Manager
I'm using ExpressionEngine 2.5.2.

I recently added a second site using Multisite Manager on my local environment, staging environment, and production environment. The installation is complete and I have my second templates working correctly. I am only working on my local set up, but as soon as I have this up and running without errors, I will be moving all of my changes over to my staging site, then production site. Locally, when I try to add new channels field groups to my second site within my ExpressionEngine control pannel, my newly created channel field groups are automatically showing the channel fields from my primary site. I cannot delete the old channel fields, because I am receiving the following database error(s):

> Error Number: 1091
>
> Can't DROP 'field\_id\_176'; check that column/key exists
>
> ALTER TABLE exp\_channel\_data DROP field\_id\_176
>
> Filename: libraries/api/Api\_channel\_fields.php
>
> Line Number: 434

This error is different depending on the channel field I try to delete. It will vary by listing a different database entry that it cannot drop (i.e . 'field\_id\_176,' 'field\_id\_178,' etc.)

If I manually delete those fields in my database, it removes them from my second site, but it also removes them from my primary site. Obviously this is a problem because I am racking up too many fields which is very confusing.

I also cannot delete the second site, because it gives me the same database errors. When I try to hook up a third site, it does not recognize the folder with my templates in it and the Template Manager page shows up with no templates or template groups (the folders exist locally and all of my paths to the appropriate directories are correct).

I do not have this problem on my staging or production server, but I cannot get much work done locally and I'm in a time crunch!! Help would be greatly appreciated.

# Answer
> 1 votes
Unfortunately I wasn't able to problem solve the exact issue on my computer, however (luckily!) we had a second copy running without errors on a computer. I ended copying all of those files onto my machine, then importing that database and all is working fine now.

---
Tags: channel, database, multi-site-manager
---


# Question
Title: expression engine jump to #id location on loaded page possible?
Just wondered if its possible to make a newly loaded page jump to a id ? with or without javascript

like the old fasion way of having links to jump the same page. goto 4 would jump to jump here

Can this be archived on load ? if forexample my link is in segment\_2

thats all :)

# Answer
Sure. You'd just need something like this is in your template:

```
{if segment_2!=''}
<script type="text/javascript">
$(document).ready(function(){
$.scrollTo('#{segment_2}');
})
</script>
{/if}

```

That's assuming you have some sort of "scrollTo" jQuery add-on. You'll have to check the validity of that quickly written code.
> 3 votes

# Answer
You wouldn't be able to do it without JavaScript, unless you link directly to the anchor from the previous page.

```
<a href="{path='page-with-id'}#id">Page with ID</a>

```
> 2 votes

---
Tags: navigation
---


title: EE2 User Guide for v.2.1.0?

text:
# Question
Title: EE2 User Guide for v.2.1.0?
My company currently uses EE2 v.2.1.0, while the current version and User Guide is at 2.5.5. I'm looking for the 2.1.0 User Guide to better understand the older version of the {pagination\_links} tag, which seems to fail as a paired tag, and older pagination API in general.

I've Googled and searched EllisLab's site for access to previous versions but have not uncovered any links. Does anyone know if and where this information might be available?

# Answer
Here is a download of the EE 2.1.0 Docs!

http://d.pr/f/LeSk/WpTT61nY

Brad
> 3 votes

---
Tags: pagination
---


# Question
Title: Correct syntax for inserting a channel entry with a playa field?
I've been experimenting with using SQL INSERTs and UPDATEs instead of using the Channel Entries API in my add-on. In one of my channels I am using a playa field which is simply connected to a separate channel (in this case, my contacts channel).

When using the Channel Entries API, I format the playa field like so:

```
$playa_field = Array('selections' => Array($entry_id));

```

This works perfectly every time. However, when you examine the output of this in the database, you get the following format:

```
[entry-id] [url-title] Full Name
e.g. [82] [joe-bloggs] Joe Bloggs

```

To create this format using the necessary variables I use the following code:

```
$formatted_contact = "[$entry_id] [".$meta['url_title']."] ".$e_data['contact_name'];

```

And embed it in the following query to insert a new item into my database:

```
$titleQ = $this->EE->db->query("INSERT INTO `exp_channel_titles` (`site_id`, `channel_id`, `author_id`, `title`, `url_title`, `status`, `entry_date`) VALUES ('1', '3', '".$meta['author_id']."', '".$touch_date.' '.$touch_type."', '".str_replace(' ', '-', $touch_date.' '.$touch_type)."', 'open', '$touch_date')");
$new_entry_id = $this->EE->db->insert_id();
echo 'new_entry_id is: '.$new_entry_id;
$entryQ = $this->EE->db->query("INSERT INTO `exp_channel_data` (`entry_id`, `site_id`, `channel_id`, `field_id_14`, `field_id_4`, `field_id_6`, `field_ft_6`, `field_id_48`, `field_id_49`, `field_id_53`, `field_id_52`) VALUES ('$new_entry_id', '1', '3', '$touch_date', '$touch_type', '$formatted_contact', 'none', '$touch_complete', '$touch_inactive', '$touch_comment', '$touch_source')");

```

All my code executes well enough from what I can see, however the playa field doesn't seem to get picked up along the way. If anyone can point out the potentially glaring formatting error it would be great! Please note, I am only looking at SQL as an alternative for the purposes of enhancing my system's speed and this will only be done in the background with little margin for error.

Cheers!

# Answer
@GDmac, thank you for your response and great spot:

```
$relQ = $this->EE->db->query("INSERT INTO `exp_playa_relationships` (`parent_entry_id`, `parent_field_id`, `parent_col_id`, `parent_row_id`, `parent_var_id`, `child_entry_id`, `rel_order`) VALUES ('$new_entry_id', '6', 'NULL', 'NULL', 'NULL', '$entry_id', '0') ");

```

The above code is now called in my script and everything works out perfectly!
> 2 votes

---
Tags: channel-entries, playa, database, mysql, performance
---


title: Submitting Comments from Control Panel

text:
# Question
Title: Submitting Comments from Control Panel
Hello ExpressionEngine gurus!

Could someone please show me how to add comments to an ExpressionEngine 2-based site from its control panel, being logged in as a Super Admin (as opposed to entering comments using the front end comment submission form)?

Would be grateful for your help!

# Answer
You can't add comments from the control panel, to the best of my knowledge. You can manage comments— delete or edit, but I believe creating comments is purely a front end experience, unless you're talking about commenting code in the templates.

Comments are a 'user-based experience' item. Managing comments is a 'super-admin' experience. This can be done via the edit entries view or from clicking the recent comments link on the home screen of the control panel.
> 5 votes

---
Tags: control-panel, comments
---


# Question
Title: Does P&T Assets work with Rackspace cloudfiles?
I have noticed that Pixel & Tonic Assets add-on explicitly states compatibility with Amazon S3. We use Rackspace for our site and are expanding to CloudFiles to take advantage of the integrated CDN. Is Assets an option here?

The only other add-on I have seen on devotee was Rackspace Cloudfiles. I have used many P&T add-ons before. Just trying to figure out what my options are here.

Ideally if someone has used one or both of these add-ons with CloudFiles, I would love to hear from you. Can I manage other types of assets like PDFs?

Thanks for any information you can provide.

# Answer
> 3 votes
> We use Rackspace for our site and are expanding to CloudFiles to take advantage of the integrated CDN. Is Assets an option here?

No. Assets only works with the local file system and Amazon S3.

> Can I manage other types of assets like PDFs?

Yes, you can manage any type of file with Assets.

# Answer
> 1 votes
I recently switched from Assets to Dev Demon's Channel Files on one project to gain Amazon S3 support. Unfortunately it was just a few weeks before Assets support for S3 was announced. I'm a big Assets fan.

Dev Demon's Channel Files appears to support Rackspace Cloud if you don't find support with Assets.

# Answer
> 0 votes
The whole codebase was re-engineered for Assets 2 to enable multiple source types, so Rackspace Cloud will be coming in the future, but we don't have an ETA on that yet.

---
Tags: add-on, assets
---


title: Stash regex on title

text:
# Question
Title: Stash regex on title
I have a stash list of different plans that I need to break based on whether the word `light` is in the title or not.

So here is what I'd like:

1. One list of plans whose title contains the word light. If it doesn't contain light then I don't want it.
2. Complete opposite to above. List of plans without light in the title.

I believe this possible using the `match` and `against` params in stash but I can't work out what the regex would be.

Code:

```
{exp:stash:set_list
name="digismart_plans"
save="yes"
scope="site"
parse_tags="yes"
}

{exp:channel:entries
    channel="plan_digismart"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    dynamic="no"
}
    {stash:plan_title}{title}{/stash:plan_title}
    {stash:plan_entry_id}{entry_id}{/stash:plan_entry_id}

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

```

Then later in the template

```
{exp:stash:get_list
name="digismart_plans"
parse_vars="yes"
parse_tags="yes"
match="[#Light#]"
against="plan_title"
}
    {plan_title}
{/exp:stash:get_list}

```

Not sure on the regex required for not Light. Would be as simple as `match="{#!Light#]"`?

# Answer
**Inverse Matching**

---

```
(?m)^((?!\bLight\b).)*$

```

You can see it in action here and take note of the info in the shot. Everything highlighted is being matched or in this case not matching Light:

If you need to match both lowercase and capital light then you'd change it to this. Everything highlighted is being matched or in this case not matching Light or light:

```
(?m)^((?!\b(l|L)ight\b).)*$

```

And you end up with:

**Matching**

---

`\bLight\b` matches Light:

And finally `\b(l|L)ight\b` matches both light and Light:

Note: Notice how we aren't picking up `Lighttt`? That's because we are wrapping with \b which sets up our match boundaries. Remove the two \b if you don't need boundaries.

**Update**: as pointed out by Mark Croxton in a comment:

> Also, be sure to enclose your regex pattern with hashes, e.g. `#(?m)^((?!\b(l|L)ight\b).)*$#`

I'm sure Mark can explain this in more detail but the basic gist of it is that Stash itself reads regex wrapped in the hashes. This is something that, to my understanding anyway, pertains to Stash only; versus everyday regex.
> 4 votes

# Answer
I'm no regex guru, far from it - more a regex googler

A quick Google suggests that using negative look arounds to do an inverse match.

```
^((?!Light).)*$

```

Should work

Also when using match against, you might have to use the stash title not the original 'title'

```
against="plan_title"

```

Either way this should, hopefully, help you on your way :)
> 0 votes

---
Tags: stash, regex
---


title: EE1.x and EE2.x sites side-by-side?

text:
# Question
Title: EE1.x and EE2.x sites side-by-side?
I'm wanting to update my site (which has blogs for me, my wife, our dogs as well as discussion forums on home cheese making and extensive image galleries on wild mushrooms and wildflowers of Colorado high country) to EE2.x.

I've tested this update offline and I think most of it will go well. We'll lose some functionality, but I've found replacements or can do without. (Still looking for an "on this day" replacement, see my other post.)

My biggest concern is the loss of the Image Gallery in EE2.x. I have many hundreds of photos archived in three galleries, most with meaningful titles, descriptions and even comments. This gallery has been the source of photos published in books on mushrooms and wildflowers because the images are well documented and easy to find.

Sure, I could migrate all of the photos to Flickr or maintain them natively in EE with Matrix, but that would mean manually moving hundreds and hundreds of photos and duplicating titles and descriptions, and likely losing the valuable comments.

So, I am wondering if there is a way to keep my EE1.x gallery "live" and available, while also moving the blogs to EE2.x.

Here is my thinking: create a new database and migrate EE1.x to that database and upgrade to EE2.x. Have my "main" site be EE2.x driven, but provide links to the old blog galleries still running under EE1.x.

Has anyone tried anything like this and what would you suggest as the way to manage the two sides in a single domain? (Root-level directory structure, how to set up index and path files, etc.?)

Of course, all this would be unnecessary if there was Image Gallery support in EE2.x. And, it has been rumored for a long time. Anyone know anything about that possibility?

# Answer
> 3 votes
I haven't used EE1's Gallery feature for years now, so unfortunately my memory of this is hazy, but even in the EE1 days I felt Matrix just worked better for galleries.

You could look at using the excellent Datagrab module: for importing into a channel with the images going into the matrix field. I expect you'd be able to make a template in EE1 that would output the info as XML ready for importing.

Also worth checking out Pixel & Tonic's Assets for running galleries - I believe Datagrab can import into this as well.

# Answer
> 2 votes
Managing EE1 and EE2 sites on same domain might cause you some pain.

I would suggest switching from Gallery to Channel Images. It looks like there's a version for EE 1.x available. And it is possible to import existing images to Channel Images gallery (though it could probably still require some manual labour).

---
Tags: ee2-upgrades, image-galleries
---