# Question
Title: How to create a multi-page rental order/catalog form with email notifications & session?
I need to create a form that allows customers to select various rental items from a large list of products.

Users will be able to select the quantity of each item they require and then hit submit. Upon submitting the form no special inventory or e-commerce functionality needs to take place. An email simply needs to be sent to an admin with the requested items. They'll then contact the customer directly.

Here is an exact example of what we're trying to replicate: http://www.quixote.com/get\_a\_quote#.URIvJE\_bpAN

I immediately thought of Freeform. But there are still a few issues there will be a large number of products that will probably need to be paginated. We'd need to be able to retain the user's selections across pages?

We also need to be able to import the product info weekly via .csv file upload. For this I was planning on using DataGrab.

I'm trying to figure out the best way to achieve this. Any suggestions would be appreciated.

# Answer
We did this sort of thing with Safecracker and a post-submit template.

If you create a template with PHP enabled, you can set your redirect URL in your Safecracker form to be that template. You can include the new entry's ID in the segment variables. (Not sure if we used an add-on for that or it's built-in.)

That PHP template, set to run on output, can grab the new entry with `exp:channel:entries`. You can then run PHP against that data. You can send it by email, send a confirmation email, post it to APIs, etc.

In that PHP template, you do a PHP redirect (`header('Location: /thank-you-page'); exit;`) to the page you want the user to see - The page you would have otherwise used as your redirect URL.

In that "processor" template, it's possible to accomplish this with EE tags, using add-ons to send the email. It doesn't matter what you do in that template. The idea is that you enable a "processor" template to run post-submit, and redirect from that template to the page you want the user to see. I set up a PHP solution first because oftentimes a custom solution needs custom work.

That addresses the first part of your question - Sending an email on submit.

For the pagination and storing the user's selections - I wonder if you could also do this with Safecracker? Set the prev/next buttons to be submit buttons that submit the form in progress. Instead of redirecting through your "processor" template, redirect them to the next page in the pagination. You would maintain the user's "session" through an entry in your submissions channel. You could have a status field that you leave set to "in-progress" and restore their form on a later visit. You could have a cron job that sweeps in-progress entries periodically and deletes old ones.

Note that you can submit a partial entry form using Safecracker, but you will need some core fields, such as title, url\_title, entry\_date. You can make those hidden fields.

You may also want to look at Postmaster. I have not used it, but it touts being able to configure sending of emails based on a number of triggers and variables.
> 2 votes

# Answer
For the email notifications, I suggest you checkout my add-on Postmaster. It's definitely the definitive solution for email with virtually any trigger. It's highly customizable and completely extendible using the open API's.

https://www.objectivehtml.com/articles/read/postmaster-v1.2

Let me know if you have any questions. I use Postmaster with virtually every EE instal and has proved to be a huge resource to me any my clients. v1.3 is on the way with even more powerful notication features.
> 1 votes

# Answer
You might have a look at Joel Bradbury's Shortlist add-on. It may get you a chunk of the way there. It's specifically to allow user-generated lists of items. Whether it will support item + quantity, if the question, but he does reference amazon wish lists among his inspirations, and I believe they include quantities as well, or if it doesn't, perhaps he could customize it for you.
> 0 votes

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


# Question
Title: Move ExpressionEngine from development to live (same server)
I'm 95% of the way through a project just now and soon I am going to have to move EE from the 'development' folder to the 'live' folder. My questions before I do this are:

* Can I just copy all the EE files from the 'development' folder to the 'live' folder and then change the paths specified in the docs? If so are all the login details the same?
* Do I need to create another database or can I use the same one that is already set up?
* Can I keep the 'development' version where it is in case I need to do anymore development?

I am fairly new to EE so any help is much appreciated.

Thanks. Stephen.

# Answer
I'm going to address this part:

> I am fairly new to EE so any help is much appreciated.

I think you'll find that many of the developers here are currently using a workflow that incorporates version control, typically Git via Github or another service.

In most cases, our workflow looks like this:

1. We start development on a local computer, with our database and site files there. As mentioned in another response, we use FocusLab's approach to config files to keep the site portable: Providing the database variables are updated or kept the same, we should be able to move things around without impact.
2. When client review starts, we set up a Staging subdomain on one of our servers: Something like clientname.clearbold.com. We set up a database on that server with the same name & username/password as we had in dev, so no changes to the database config are needed. This sounds like the dev site on your live server.
3. We'll dump a copy of the database in dev into a directory in our version-controlled project directory, and push it to our git repository. We use a deployment tool (Beanstalk or DeployHQ are good options) to (S)FTP all the files to the server. You can also log into your git repo on the server and pull down the files.
4. We then import the database on Staging, and the site's running.

Now, once we get to the point where the client is making edits, whether to Staging if we're pre-launch or on Production if we've launched, that database is now the master. Any time we do development, we log onto the server the client is using, do a database dump, and copy that down to our dev machines. We import that locally to work with the latest content/data, and we include that dump file in our git repo so that all developers can get it. If the Production site is the master, we may want to update Staging with that dump so we can demo some new features there. This is really important. For us, the database is always a one-way update. We add new fields or install new add-ons in the master database, and then copy it down to dev to start working with it.

In your case, I'd recommend:

1. Updating your config to use the FocusLab approach, so that you can copy your files into the live site directory without changing paths. This will also enable you to copy the site locally in the future to test updates/upgrades, develop new features, etc.
2. It's fine to keep your current "dev" (more accurately, Staging, because the client can see it) site pointing to the same database. Since I've advocated always making modifications in the master database first, there's no need to copy from Production to Staging. Just be careful if you're testing new features via your Staging site.
3. Be sure to make backups of your db before making any changes.

Virtual Servers, whether running Plesk like MediaTemple's DV or barebones like their VE, or any of EngineHosting's offerings, etc should let you enable and log in with SSH. I highly recommend getting the hang of this. Running mysqldump and mysql import from the command line are much, much more efficient than using PHPMyAdmin. (We run Rackspace Cloud and A Small Orange servers currently.)

I actually did a video of this workflow, using git and moving database dumps around, a while back:

https://s3.amazonaws.com/clearbold-content/EE-git-screencast.mp4
> 13 votes

# Answer
The FocusLab approach to this has become a de facto standard for what you're doing, especially long term:

https://github.com/focuslabllc/ee-master-config

Hope this helps.
> 5 votes

# Answer
I used this tutorial and it works just perfect: http://www.creat-ee.com/tutorials/more/migrating\_your\_ee\_site\_to\_live\_server

Francois
> 1 votes

---
Tags: database, server, server-migration, staging-server
---


title: why would this 404 redirect not work?

text:
# Question
Title: why would this 404 redirect not work?
I'm using this code for my 404 redirect:

```
{exp:channel:entries channel="about-us" limit="1" require_entry="yes" {gv_param_disable_default}}
        {if no_results || last_segment != url_title }

        {redirect="404"}

        {/if}
<!--content here-->
{/exp:channel:entries}

```

Why wouldn't this work? It seems to stop an additional segment from being added to the url, but if I just change the last segment to an invalid path, it just goes to the blank index template for that channel.

# Answer
The only thing you normally need for 404 with a require\_entry="yes" and strict urls enabled is:

```
{if no_results}{redirect="404"}{/if}

```

Can you just try this on a clean template? As others have said, a broader context could help debugging this.

EDIT: if, as per your comment, you know you should only have two segments, then simply modify the code as follow to redirect to 404 if more segments are added

```
{if no_results OR segment_3 != ""}{redirect="404"}{/if}

```

Have a look at this little blogpost on 404 pages in ExpressionEngine for more detailed information.
> 2 votes

---
Tags: redirects, 404
---


title: Adding another CI application?

text:
# Question
Title: Adding another CI application?
I need to grab a CSV version of one of my channel entries and upload it to an FTP server. I also need to grab some images, which are part of the channel entries, and rename them, etc.

I have already created a template that renders the CSV I need. Now, I need to do all that FTP and image processing stuff. The process could be triggered by adding or editing a Channel entry -- or I could just run this via a cron at some set interval.

How should I deal with this process? Should I build some sort of addon? Or should I create a separate CI application? I'm actually not sure how to add another CI application to the current EE/CI setup.

# Answer
IMO, creating an extension would be the right way to do it.

The hook to be used will be entry\_submission\_end, the extension setting should contain remote host, post, path - and template name or URL of file to upload.

You can use CI FTP library in your add-on.

Quick search does not find anything that would do even something similar - so the whole community would benefit if you develop it and make public :)
> 2 votes

---
Tags: add-on-development, codeigniter
---


# Question
Title: Upgrading EE1 to EE2 database name problem in update script
I'm trying to get an EE1 site up to EE2.5.5

To do this I created a clone of the live site's files. Exported the SQL from the live database and populated a "dev" database with the data then updated paths and config settings accordingly. This created a working clone (I've done this many times with no problems).

So, to clarify; I have a live site running from a database named "clientname\_live" I have a dev site running from a database named "clientname\_dev"

I have managed to get from 1.6.8 to 1.7.3 with no issues but trying to go from there up to 2.0.0 is throwing up problems.

The site uses ngen file field, structure and gypsy. I have removed gypsy completely, converted any file fields to text inputs and run the Structure update script (which appeared to run fine and do its stuff).

After uploading the necessary EE2 files and starting the update process I almost immediately hit the following error:

```
Error Number: 1146

Table 'clientname_live.exp_weblog_fields' doesn't exist

SELECT field_id FROM exp_weblog_fields WHERE field_type = 'date'

Filename: updates/ud_200.php

Line Number: 1583

```

Clearly the problem is that the update script (maybe just at that point) is trying to do something to clientname\_live. What I don't understand is where it's getting that information from. The config file points at clientname\_dev and the site is definitely running from *that* data base and not the live one.

Where could this database name be stored other than in the config file?

# Answer
Do you have a **exp\_layout\_publish** table in the database now?

Just a thought as before that error (line 1583) there are a few tables created and if these are being created then there is definitely something rather strange going on there as why would it be able to find the database and create those tables but then throw a wobbly later on?

Did you clear all caches on the site?

Last but not least where is your dev site hosted? Is this on a local machine or on the same server as the live site? You're definitely trying to update the correct site aren't you? ;-)
> 1 votes

# Answer
Look at line 1583 in the upgrade file. It'll tell you exactly what's trying to be done and where the name is coming from. Track backwards from there.

The DB settings are only stored in the config file. However, could be something in a template or addon.
> 0 votes

---
Tags: ee2, ee1, config, upgrade
---


title: Carthrob's Shipping Rules

text:
# Question
Title: Carthrob's Shipping Rules
I am having some difficulty understanding why I can't get some shipping rules to work.

I am using the 'By Location - Price Threshold' shipping set in Cartthrob.

I have checked and the country code is being saved in the correct field etc, so I am guessing its something to with how I have set out my shipping rules. I have looked on the CT website, but the documentary doesnt particular explain how the correct layout should be.

I have attached the image below. Is say 10-20 the correct way to enter thresholds?

**UPDATE**

The shipping rules I need are for Great Britain, and the rest of the world. GLOBAL covers everything as far as I know in CT. I then want to have different shipping costs dependant on the price. So if the price is between 0-10 and the users shipping country code is GBR £1.20. if between 10-25 £2.50 etc

# Answer
No. You'll see in the column description above that a threshold of 0-10 is entered as simply "10". Basically the way they have it set up is that thresholds are articulated by the maximum value applicable, and i believe the threshold logic loops through the items you have setup looking for the one that applies. So if you set up thresholds of 10, 20 and 30, it automatically treats them as 0-10.00, 10.01-20.00, and 20.01-30.00 respectively. What it does mean, of course, is that they can't overlap, because then the logic check would return more than one applicable rule, and I don't know how it would react to that.
> 1 votes

---
Tags: cartthrob
---


title: Renaming image file names

text:
# Question
Title: Renaming image file names
I have a client that would like to edit file names for photos that site members have uploaded. She wants to rename them for SEO purposes. (e.g. changing name from DSC\_00234.jpg to a-descriptive-title.jpg)

Here is a bit more detail:

* Members each have an account where they can create a profile about their services/products and they can upload multiple photos
* The photos are stored in a Matrix with image input and descriptive caption (which is used in alt text)
* We are concerned with making sure that when an image is renamed it will still be linked properly in the entry in the Matrix field

Other Notes:

* Client would prefer to be able to edit these filenames herself *after* they have been uploaded, rather then *at the time of upload* by site members, so that she has more control.
* A solution that would automatically rename them to something useful (rather than having client edit them herself) would work for us too.
* We did not see anything that would do this with either built-in EE functionality or with add-ons. (Thought it's possible we might have missed an add-on.)

Any recommendations on a decent way to accomplish this?

# Answer
> 1 votes
CE Image will let you provide a filename for the generated image. If you updated your templates to process the images with CE Image, I imagine you could pass in a field value for that, either bundling fields that exist in the entry or Matrix columns or a specific filename field.

If you're going for SEO, I'm not sure how you would automatically rename them without having source data to generate the new names.

# Answer
> 1 votes
Yo can also rename images using Assets 2.

(The muffins were delicious. ;) )

---
Tags: seo, filesystem
---


# Question
Title: Safecracker and RTE: html is double encoded or something?
playing a bit with 2.5.5, I tried to create a Safecracker form with a RTE field. But when I edit an existing entry in this form, the HTML is displayed as HTML in the RTE box (see below), like if the content were double encoded or something.

How can I solve that?

\[EDIT\]: Little precision, this only happened with content saved from the control panel. Entries created or edited with the Safecracker form are correct (no html tags in the RTE).

\[EDIT-BIS\]: It is probably a bug, I posted it here: https://support.ellislab.com/bugs/detail/19157

# Answer
This has been accepted by EllisLab as a bug: https://support.ellislab.com/bugs/detail/19157
> 2 votes

---
Tags: safecracker, rte, v2.5.5
---


# Question
Title: Mail list edit confirm pages and post backs
I'm currently using the mail list extension (http://ellislab.com/expressionengine/user-guide/modules/mailinglist/index.html) on one of my sites and I have a few questions which I couldn't find the answer too using google and the documentation.

I wish to edit the Post back page so that it can be branded up with the rest of the website. And I plan to handle the form posting using AJAX.

So I need away to edit the return when i post the email address to the server and i need a way of editing what the user sees when they return to the site to confirm there registration.

I hope this makes sense,

Thank you in advance.

# Answer
> 1 votes
Sounds like you want to customize the system message look and feel.

You can edit the native **User Message Template** in EE

OR

Use the **Custom System Message** addon which gives you a ton more control.

---
Tags: ajax
---


# Question
Title: How do I add jquery animation to the pagination in Matrix?
How do I add jquery animation to the pagination in Matrix? I got help from P&T Support and they showed me how to add pagination to Matrix in Expression Engine. I was wondering how to add jquery animation/fade/slide to the Matrix row changes?

# Answer
> 1 votes
If you want animation for the pagination, you should use jQuery. Here are **10 jQuery Pagination Plugins** to look at.

---
Tags: add-on, matrix, jquery
---


# Question
Title: Pulling in Matrix cells in Records tag pair using Link Vault
I need a little help on a project that's using the addon Link Vault from Masuga Design (http://masugadesign.com/software/link-vault/) in conjunction with Matrix.

The site has a channel called ‘Topics’, each topic has an entry that has a Matrix field with the columns ‘Link’ and ‘File’. The topic pages are setup so they list all the files per topic entry from the Matrix field.

The field is a Matrix field called 'download' and has the cells 'File Name' and 'File'.

We're using this code so far:

```
{exp:link_vault:records limit="5"}<a href="{directory}{file_name}">Download</a>{/exp:link_vault:records}

```

I can get the file to link up and work, but not pass the 'File Name' field from a row to the template. The download count also needs to be unique to each Matrix row, too (not covering all files from the single entry.)

# Answer
Ended up sorting this out...

Through a combination of an add-on update and what turned out to be my misreading of some of the documentation. Completely missed defining the Link Vault custom fields to be able to specify them in the Matrix rows in the first place... So this one was definitely user error.
> 1 votes

---
Tags: matrix
---


title: Uploaded module not appearing in list

text:
# Question
Title: Uploaded module not appearing in list
I have created a module on my local installation which appears correctly in the Modules list. I can install and uninstall it without a problem.

However, when I upload it via FTP to the remote web server, it does not appear in the list of Modules. I uploaded it into the correct location (/system/expressionengine/third\_party/) and the folder structure is correct.

Has anyone else come across this problem?

# Answer
As unlikely as it sounds, if you're sure the the location is correct I'd try checking permissions. I've run across a few times where either the directories or the add-on files themselves were not set to be readable at all and therefore EE didn't recognize they were there.
> 1 votes

# Answer
As Mike mentions above check permissions as that can be the main problem here. The only other thing I can think of would be some erroneous white space at the end of a closing **?\>** PHP tag in one (or possibly more) of the modules files. That could also cause the problem.
> 0 votes

---
Tags: add-on, module
---


# Question
Title: Need to move several hundred Structure entries to a new template/template_id
A component of a site I am building has changed and as a result I need to move the entries over to a new template. It looks like this template data is stored in exp\_sites \> site\_pages.

How would you approach this? Not looking to manually update 300+ entries.

# Answer
We also provide this script in the docs: http://buildwithstructure.com/documentation/how\_can\_i\_batch\_update\_templates\_for\_existing\_entries/
> 6 votes

# Answer
I suggest copy/pasting the serialized array from the `site_pages` column and using an **online generator** to unserialize it. Then copy the unserialized array over to a text editor to find/replace the old `template_id` with the new the `template_id`.

The array contains a URI array & Template array. The template array is the last array. So look for `[1] => 4` which is `[entry_id] => template_id`

I would do a find and replace just for `template_id`: `=> 5` to `=> XX`

As far as serializing the array, I haven't found a online generator to make it easy. You may just need to create a template and enable PHP to serialize it for you, then copy/paste it back into the `site_pages` column.

Always backup first!

### Update

I just found this script to **batch update entries**.

### 2nd Update

Added the two lines of code for the updating the old template id with the new. Should save a couple clicks

```
<?php
/**
* Batch reset template_id for Structure entries
*/

$str = base64_decode("PASTE-VALUE-FROM_site_pages_FIELD-HERE");
$arr = unserialize ($str);
$old_template_id = PASTE-OLD-TEMPLATE-ID-HERE; //e.g. 3;
$new_template_id = PASTE-NEW-TEPLATE-ID-HERE;//e.g. 24;

// Set new template_id
foreach( $arr[1]['templates'] as $key => $template_id )
{
   if ($template_id == $old_template_id)
      $arr[1]['templates'][$key] = $new_template_id;
}

// Output
print '<pre>';
print_r($arr);
print '</pre>';

// Serialize & encode
$new_arr = serialize($arr);
$new_str = base64_encode($new_arr);

// Output for copy/paste
print "<textarea rows='100' cols='80'>";
print $new_str;
print "</textarea>";

exit;
?>

```
> 3 votes

---
Tags: database, structure
---


# Question
Title: How to protect a digital directory but allow downloads?
First time setting up a digital purchases online and would like some pointers/tips on how to protect the directory where all the digital items are stored so someone can't access the file directly like: `http://domain.com/some/digital/file.zip`?

I'm using CartThrob, so I will either use the `get_download_link` or `download_file_form` tags which will handle link protection & obfuscation.

I just want to make sure I have all my ducks in a row. Thanks!

### Update

I have directory browsing turned off with `.htaccess` rules, so this fixes listing any files. I saw a couple solutions with adding rules to the directory, but wasn't sure if this would allow CT tags to access the file since I can't access it over the browser:

```
Order Deny, Allow
Deny from all

```

# Answer
> 5 votes
We keep all of our downloadable files above web root, so they're not directly accessible, similar to this setup:

```
/public_html
/system
/files

```

And of course, we use Link Vault to obfuscate, protect against hot linking, and track the downloads.

# Answer
> 0 votes
If you've obfuscated your links using CartThrob's tags, I typically just include a blank `index.html` file in any files/assets directories, as seems to be the EE convention. Then that's displayed instead of a directory index.

---
Tags: cartthrob, htaccess, security
---


# Question
Title: Membership system - parents purchasing for children
I am currently extending an ExpressionEngine site to include a membership system.

I'm trying to find a way to allow parents to purchase memberships for their children, ideally multiple children in one transaction. It is for a sports park where the target age group is 6-16.

We are currently using CartThrhob for simple transactions for booking an individual session, so it would be good to make use of this.

We have looked at Membrr however it doesn't look like you can purchase on behalf of another person. I suppose in a way it is like a gift membership system with a cart for mulitple memberships.

Has anyone achieved this type of system? Or can point me in the right direction?

The logic seems straightforward but can't quite work out the best approach with EE.

Many thanks, Martyn

# Answer
I think what you need is simply some system that would allow "one-to-many" parent-child relations between members.

If you're using Provile:Edit or Zoo Visitor, then Playa would work great for that (there are other add-ons that you might find satisfactory, some of them are much cheaper or free).

If you're using only native EE membership system, then you probably need to develop usch addon yourself. Or perhaps use an affiliate system, such as Affiliate +, but you will also need custom code to query database.

Then, set up your templates in a way that children could access files that relate to their parents purchases. (You don't probably want to give access to full purchase information, such as invoices, but only actual downloads/tickets, or whatever you are selling)
> 1 votes

---
Tags: members, cartthrob
---


# Question
Title: Expresso Store - Related entries within {items} loop
Under my basket page (based on the sample 'checkout.html) I want to suggest any accessories that might be associated with the products in the basket.

I've tried two ways to achieve this, neither is really working for me at the moment. My first attempt was to use PHP to capture the {entry\_id} of each item in the first loop and then use that below. Problem I encountered is that I need PHP to be rendered both on InPut and Output on the template (one to capture the id's, the other to make using them possible).

My second attempt is just to have a second {items} loop under the first. Within this loop I try to get the exp:channel:entries with the {entry\_id} of each item then within the exp:channel:entries loop get the related\_entries (there are 4).

This logic seems sound to me, but I am new to expression engine and store so I am sure I am missing something obvious!

My code is below, any help you can offer is very much appreciated.

```
<h2>Suggested Accessories / Related Products</h2>

{items}
    {exp:channel:entries limit="1" dynamic="off" entry_id="{entry_id}" }
        {related_entries id="related_product_1"}
            A {title} - {entry_id}
        {/related_entries}<br/>
        {related_entries id="related_product_2"}
            B {title} - {entry_id}
        {/related_entries}<br/>
        {related_entries id="related_product_3"}
            C {title} - {entry_id}
        {/related_entries}<br/>
        {related_entries id="related_product_4"}
            D {title} - {entry_id}
        {/related_entries}

    {/exp:channel:entries}
{/items}

```

# Answer
> 3 votes
It's probably a parsing issue. Try an embed.

In your main template set:

```
{items}
    {embed="embeds/related" id="{entry_id}"}
{/items}

```

Then create a new template called "related" in an "embeds" template group (or use your own naming). In that template set:

```
{exp:channel:entries limit="1" dynamic="off" entry_id="{embed:id}" }
    {related_entries id="related_product_1"}
        A {title} - {entry_id}
    {/related_entries}<br/>
    {related_entries id="related_product_2"}
        B {title} - {entry_id}
    {/related_entries}<br/>
    {related_entries id="related_product_3"}
        C {title} - {entry_id}
    {/related_entries}<br/>
    {related_entries id="related_product_4"}
        D {title} - {entry_id}
    {/related_entries}

{/exp:channel:entries}

```

If the `{entry_id}` in your related loop needs to be the one you are passing to the embed, then change to `{embed:id}`.

---
Tags: expresso-store, related-entries
---


# Question
Title: How to list new entries and entries with new comments?
Looking for a way to list new entries, from multiple channels, and existing entries that have received comments - in the last n days. I'd be really grateful for any leads on how to do this!

Best wishes Lee

# Answer
> 7 votes
ExpressionEngine does have an easy way to display recent comments, but it sounds like that's not quite what you're looking for. You need a list of distinct *entries* having at least one comment in the last N days.

One way to accomplish this is with the Query module:

```
{exp:query sql=
    "SELECT title
    FROM exp_channel_titles
    JOIN exp_comments
    ON exp_comments.entry_id = exp_channel_titles.entry_id
    WHERE FROM_UNIXTIME(comment_date, '%Y-%m-%d') > DATE_SUB(CURDATE(), INTERVAL 10 DAY)
    GROUP BY exp_channel_titles.entry_id"
}
    <li>{title}</li>
{/exp:query}

```

This will give a list of entries with comments in the last 10 days.

The key pieces are the last two lines of the query where we compare the comment date against a time interval based on the current date, and then group by entry to prevent duplicates due to multiple qualifying comments on the same entry.

---
Tags: comments
---


# Question
Title: Classes on list items with GWCode Categories
I've just started using GWCode Categories for the first time, and have seen it oft-cited as a go-to solution here.

I need to rely on nested output for navigation, but I need classes on the `<li>` (similar to Structure's output). I see that there are variables to check for "has children" and I could compare cat\_url\_title to my segment vars to get the "here" status, but I don't see a way to get those onto the `<li>`.

Are those sorts of classes supported on the `<li>` and I'm missing something? Or is there a way to get nested output and write my own `<li>` tags?

Thanks!

# Answer
You can use parameter style="linear" and can out the

- according to your preference. Take a reference from this example at the add-on website: http://gwcode.com/add-ons/gwcode-categories/examples/example11
> 1 votes

---
Tags: categories, gwcode-categories
---


title: field editor with Matrix

text:
# Question
Title: field editor with Matrix
I have an EE 2.5.3 build with Field Editor 1.0.3 and Matrix 2.5.2 installed.

When I try to configure the Matrix field from the field list, it looks like it's loading but then craps out.

I get this from the console on load initially

```
Uncaught TypeError: Object #<Object> has no method 'rowCallback'

```

and when I click to configure the Matrix field I get

```
Uncaught ReferenceError: MatrixConf is not defined
Uncaught ReferenceError: Matrix is not defined

```

Works fine when I'm in the default channel fields view and not Field Editor.

# Answer
> 0 votes
Turned out to be an issue with the themes path. The site is using MSM and the primary site isn't yet live (DNS points elsewhere at the moment) so we were using the ip address as the theme url.

We copied the themes folder from the primary domain to the secondary domain and we're sweet.

---
Tags: matrix, field-group, field-editor
---


title: SEO & SEO friendly URLs

text:
# Question
Title: SEO & SEO friendly URLs
My Channel entry page's URL is something like the following:

```
http://site.com/template_group/entry_id/{field_1}-{field_2}-{field_3}...

```

The `{field_1}-{field_2}-{field_3}...` part is actually just something I add to the links I generate. They aren't actually being used on the Channel entry page. Only the `template_group/entry_id/` matters (from what I can tell).

I'm adding those additional details at the end to hopefully generate SEO friendly URLs. Am I on the right track or is there a better "EE way"?

Also, I want to offer some SEO features when making a Channel entry. I'm not well versed into SEO, but the only 2 fields I can think of are `meta keywords` (which is pretty much useless from what I know), `meta title` (same as `<title>`?), and `meta description`. Should I just add these 3 fields and let the SEO person fill these out? Or is there a better approach than this? It would be nice if there was some logic I could implement that would auto populate these fields in case the user doesn't populate them.

# Answer
> 6 votes
In general, your best bet for SEO is to synchronize "the trinity" –

* Page title
* URL
* H1 heading

If you had a blog entry, on a single-entry page, called "One More Blog Entry" –

* Page title (the `<title>` tag): One More Blog Entry
* URL: /blog/post/one-more-blog-entry
* H1 heading: One More Blog Entry

If this were the About Us page, it would be:

* Page title (the `<title>` tag): About Us
* URL: /about-us
* H1 heading: About Us
* Navigation link: About Us

This is a big reason why ExpressionEngine generates the URL title (`url_title`) from the Title field: It's for SEO benefits. Stringing together fields to generate a URL is not going to match the content.

I typically use NSM Better Meta to allow clients to edit meta descriptions and page titles, and to set up my own page title rules. (Those are typically `<title>{title} : Site Name</title>`.) You could set up your own meta description field in your fields and load that in. Note that meta keywords are now ignored by search engines because they were abused. Meta descriptions don't factor in much either, but they're valuable on Search Engine Results Pages (SERPs) because they tell the user what the page is about.

Considering that you were looking at building your URL by stringing together fields, you might want your title to be a composite of those fields. In that case, I would recommend looking at MX Title Control to generate your title when you're loading your entry, and to have the url\_title based on that.

Making your url\_title/page URLs different than your title/`<title>`/page heading is going to hurt SEO.

Note that you can also hide the URL Title field, making it so the user can not edit it, and keeping it in synch with the Title field.

Also note, to expand on built-in support for SEO, one of the benefits of using Structure is that it outputs navigation as I described: With the Title field as the linked value, matching the entry/page title and URL.

**Updated:** By default, your `{exp:channel:entries channel="some_channel"}` tag will load the corresponding entry if there's a `url_title` match on the last segment. Entries will automatically load based on a match for `entry_id` or `url_title`. See `{title_permalink}`.

**Updated:** To hide the URL Title field, use Publish Layouts. Click the little "Show Toolbar" link in the top right corner of the Publish screen for that channel. In the list of fields on the right, click the "eye" to the right of URL Title. Save that Layout and the field will be hidden. MX Title Control will hide your Title field if you configure it to build the Title value from other fields in the entry.

# Answer
> 2 votes
Regarding adding metadata I have you looked at the following:

SEO Lite & Better Meta http://devot-ee.com/add-ons/seolite and http://ee-garage.com/nsm-better-meta (inc sitemaps)

For no follow links theres: http://devot-ee.com/add-ons/no-follow (though it's straigtforward to add yourself)

For sitemaps there: http://devot-ee.com/add-ons/sitemap-module

And I assume you've been over to Google Webmastertools and read their stuff

I see your adding stuff to the url - nothing wrong with this method but always remember that content is for humans, SEO specialists can often (not always) be charlatans.

# Answer
> 1 votes
I don't think you should be appending random keywords to the end of your URLs. You should educate the client to use appropriate URL Titles when they publish content.

Duplicate content will affect your site negatively in terms of SEO.

Take the following URL for example: http://site.com/news/article/1/keyword1/keyword2/keyword3

In your template, it sounds like you might be doing something like this:

```
{exp:channel:entries entry_id="{segment_3}" ...}
...
{/exp:channel:entries}

```

But your page could also be reached by:

Google sees these as separate pages with the same content. Not good.

Other people have already touched on the topic of `<title>` and `<meta>` tags as well as appropriate headings.

# Answer
> 0 votes
IFor your url's i'd recommend using switchee, as this addon will give you good control over your url's, templates and performance.

I would not use the entry\_id in the url, rather use the url title, as this is better for seo. my url's are typically: http://domain.com/template-group/template/url\_title/ and with switchee it's pretty easy to have more segments when needed.

There are a lot of possible things you can do with channel fields. First it's always a good idea to create fields for browsertitle, description and keywords. Also, you can create fields for link-title's, alt text etc.

In your template you can check if a field is empty, and if so, parse some default text, a global variable or other information from the entry. It's a good idea to use switchee here too, intstead of {if} statements.

Also, be sure to use your h1's, h2's etc wisely. Content is still most relevant, more so than technical structure.

# Answer
> 0 votes
I'll give a thumbs up for SEO lite. Configured correctly, it can make light work of matching your page title, H1, etc, and do it automatically from channel fields, or when needed, can be overridden in the publish cp.

I've had good search results from it, and pages in google are getting found well.

I would also agree that

domain.com/template-group/template/url-title is the way to go for a nice easily readable, friendly url.

# Answer
> 0 votes
Have you looked at your traffic sources? Does it really make sense to work hard on SEO-friendly URLs. What´s the difference between

```
www.mysite.com/index.php/blog/entry/my-cool-title-with-a-fancy-twist

```

and

```
www.mysite.com/entry/my-cool-title-with-a-fancy-twist

```

when a significant portion of your users arrive via

```
short.ly/dr8Y1

```

anyway. With social and mobile usage un the rise the URL-shorteners won´t go away anytime soon. Mobile users very often don´t see the URL at all on their device and Google is pretty smart, when it comes to figure out URLs. EE has solid SEO capabilities build in (see answers above). I would use them and not try to customize EE too much here, as it all comes with a cost. \- You need to come up with a URL-scheme \- Implement it \- Maybe buy an add-on like NSM htaccess \- Make sure, that you have the same environment in stageing and production The more stuff you have to manage, the higher the chance, that something will break.

I´d rather make sure, that Google sees me as a distinguished author (get a G+-account, add a decent photo and link back fromm every Single Entry with rel="author" to that profile).

To boost click-throughs on Google I would focus on

* creating a snappy headline (there is a reason, why the guys from Upworthy rewrite headlines 25 times.
* having a photo next to the article (the G+-stuff)

---
Tags: channel-entries, seo
---


title: Low Replace problem inside a snippet

text:
# Question
Title: Low Replace problem inside a snippet
Here is my code in a snippet. Basically what low\_replace does is just to convert spaces to dashes.

```
{exp:low_replace find="SPACE" replace="-"}
    {permalink="product"}/
    {field_a}-
    {related_entries id="foo"}
        {foo_name}
    {/related_entries}
    -{field_b}
    {if bar != ''}-{bar}{/if}
    {related_entries id="test"}-
        {test_name}
    {/related_entries}/
{/exp:low_replace}

```

When I tried it, I got this error

```
Parse error: syntax error, unexpected T_STRING in /home/test/public_html/system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 1

```

Any idea why this is the case?

# Answer
Parse order strikes again. The conditional inside the tag is an advanced one and will be parsed *after* all the tags. That means it is still present when the replace tag is processed, creating code like this:

```
{if-bar-!=-''}-{bar}{/if}

```

Which is likely to cause the template parser to choke when it tries to parse it.
> 2 votes

---
Tags: low-replace
---


# Question
Title: Is it possible to create categories outside control panel
Wondering if it's possible to create categories outside control panel. I know its not possible with safecracker. Any add-ons or hack to achieve this?

Thanks in advance.

# Answer
The categories table structures are fairly simple. With EE's ability to run PHP in templates, you can enable PHP, and then use its Database class to insert new data.

```
$data = array('site_id' => 1, 'group_id' => 2, 'parent_id' => $parent_cat, cat_url_title => 'some_new_category_name', $cat_name => 'Some New Category Name', cat_order = 5);

$sql = $this->EE->db->insert_string('exp_categories', $data);

$this->EE->db->query($sql);

```

A few things you'd need to do:

* Dig into EE's code to find a function that converts a `cat_name` to a `cat_url_title`, or write your own.
* Get the `MAX cat_order` of the categories under the parent category you're in, add 1 to that for the new `cat_order`. Note that if there's an existing `cat_url_title` that matches, you'll need to add a number at the end.

You could build any sort of front end you want: A nested display of all categories with "Add Child" links next to each would work. Clicking that link could send you to a form page with the parent ID on the URL. You could do a `Select` query with that parent ID to find the details you need. (By enabling PHP on output, you can get the ID from the URL using its segment variable, and read that into your PHP.) Then let the user enter a category name, and upon submitting the form, run those values through PHP to create the new category. You could also send that link to a lightbox/modal so that the user doesn't leave the page, and set that up to refresh the page when you close it. Their new category would then be in the list.

We've written PHP code similar to this, with the lookups for existing categories, to batch load categories from CSV files (along with other data), creating categories on the fly as they're needed.
> 2 votes

---
Tags: categories
---


title: Can't Get RSS to work (Empty_feed)

text:
# Question
Title: Can't Get RSS to work (Empty_feed)
I've tried adding `dynamic="no"`.. removing curly brackets.. adding `status="publish"` since that's the status that a blog post has to be to display.. all no luck so far. Here's the rss file

**code removed due to update**

I'm using structure, so that would explain the `{page_url}`

**Update**

My blogs channel is "blog" but i switched the channel to "personal\_trainer\_directory" just to see if other channels would work, and it did.. So what could be causing the issue with this now?

Current code:

```
{preload_replace:master_channel_name="blog"}
{exp:rss:feed channel="{master_channel_name}"}

<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">

        <channel>

        <title><![CDATA[Blog]]></title>
        <link>{channel_url}</link>
        <description>{channel_description}</description>
        <dc:language>{channel_language}</dc:language>
        <dc:creator>{email}</dc:creator>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        <admin:generatorAgent rdf:resource="http://expressionengine.com/" />

{exp:channel:entries channel="{master_channel_name}" limit="10" dynamic_start="no" disable="member_data|pagination"}
        <item>
            <title><![CDATA[{title}]]></title>
            <link>{page_url}</link>
            <guid>{page_url}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
            <description><![CDATA[{article_body}]]></description>
            <dc:subject><![CDATA[{categories backspace="1"}{category_name}, {/categories}]]></dc:subject>
            <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        </item>
{/exp:channel:entries}

        </channel>
</rss>

{/exp:rss:feed}

```

**final working rss feed:**

```
{preload_replace:master_channel_name="blog"}
{exp:rss:feed channel="{master_channel_name}" status="open|publish"}

<?xml version="1.0" encoding="{encoding}"?>
<rss version="2.0"
        xmlns:dc="http://purl.org/dc/elements/1.1/"
        xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
        xmlns:admin="http://webns.net/mvcb/"
        xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
        xmlns:content="http://purl.org/rss/1.0/modules/content/">

        <channel>

        <title><![CDATA[Blog]]></title>
        <link>{channel_url}</link>
        <description>{channel_description}</description>
        <dc:language>{channel_language}</dc:language>
        <dc:creator>{email}</dc:creator>
        <dc:rights>Copyright {gmt_date format="%Y"}</dc:rights>
        <dc:date>{gmt_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        <admin:generatorAgent rdf:resource="http://expressionengine.com/" />

{exp:channel:entries channel="{master_channel_name}" limit="10" dynamic_start="on" disable="member_data|pagination" status="open|publish"}
        <item>
            <title><![CDATA[{title}]]></title>
            <link>{page_url}</link>
            <guid>{page_url}#When:{gmt_entry_date format="%H:%i:%sZ"}</guid>
            <description><![CDATA[{article_body}]]></description>
            <dc:subject><![CDATA[{categories backspace="1"}{category_name}, {/categories}]]></dc:subject>
            <dc:date>{gmt_entry_date format="%Y-%m-%dT%H:%i:%s%Q"}</dc:date>
        </item>
{/exp:channel:entries}

        </channel>
</rss>

{/exp:rss:feed}

```

# Answer
> 3 votes
I copied and pasted your template code into a new template in a site in my dev environment. The only value I changed was the `master_channel_name` value to match one of my channels.

I see all entries being output.

You mention:

> adding status="publish" since that's the status that a blog post has to be to display.

I would closely examine your custom Status values, or stick with open|closed to try to troubleshoot this further.

---
Tags: rss
---


title: Dynamic data in channel fields

text:
# Question
Title: Dynamic data in channel fields
Trying to figure out if this is possible using currently available add ons.

I have a client who wants to be able to pick from a pre-defined list of items in a channel entry field (or fields). He may have a list of 10 requirements to choose from, displayed with checkboxes. Only the ones that he ticks will be displayed on output in the template.

That's easy enough using the checkboxes fieldtype...

This is where it gets complicated - The list of checkboxes are the same across all channel entries (with only selected items being shown) but he wants to be able to inject further data (which differs between entries) into the pre-defined list within the publish page.

For example, if the following were a list of checkbox items:

1. This is an item with static data
2. This is an item with **{dynamic}** data
3. This is an item with static data

Where **{dynamic}** appears he wants to be able to input fresh data, essentially a field within a field. Does anybody know of a way to achieve this, or possibly a work around?

Or, possibly a way to map another field to this 'placeholder'?

Many thanks

# Answer
I can only think of using FIND and REPLACE. Something like:

```
{exp:low_replace find="{replace_field}" replace="#holder_text"}{checkbox_field}{/exp:low_replace}

```

The problem with that solution is, I'm not certain if Low Replace or any of the replace add-ons will allow you to use contents of one field to replace contents of another. It should be doable, but generally speaking, I've generally only used it to remove {segments} or to replace with predefined text, like:

```
{exp:low_replace find="this" replace="that"}{my_field}{/exp:low_replace}

```

But I'd give it a try. I don't see any reason why it wouldn't work. All the field data should be available by then, so parsing shouldn't be an issue.
> 1 votes

---
Tags: channel-entries
---


# Question
Title: Freemember email validation for specific domain using jQuery
I'm trying to verify a Freemember registration form email input using jQuery to check for a specific domain. Below is the jQuery I'm using, ultimately my goal is to prevent the form from being submitted unless they are an example.org email address.

```
      $(document).ready(function() {
      $('form#example-register input#register').submit(function() {

                $(".error").hide();
                var hasError = false;
                var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/;
                var emailLegalReg =  /^([\w-\.]+@(?!example.org)([\w-]+\.)+[\w-]{2,4})?$/;

                var emailaddressVal = $("input#email").val();
                if(emailaddressVal == '') {
                    $("input#email").after('<span class="error">Please enter your email address.</span>');
                    hasError = true;
                } else if(!emailReg.test(emailaddressVal)) {
                    $("input#email").after('<span class="error">Enter a valid email address.</span>');
                    hasError = true;
                } else if(emailLegalReg.test(emailaddressVal)) {
                    $("input#email").after('<span class="error">No eamil other than example.org.</span>');
                    hasError = true;
                }

                if(hasError == true) { return false; }
                else {
                    $("input#email").after('');
                    return false;
                }
    });
});

```

Here is the template code for the Freemember registration form.

```
    {embed="included/html_head"}
    {embed="included/page_header"}
         <div id="content" class="register">
         {if logged_out}
            <h1>Registration</h1>
            <p>Fill out the form below to register, once submitted your account will have to be approved the Administrator.</p>
         {/if}
            <div id="login-form">

            {exp:freemember:register return="/example/" form_id="example-register" error_handling="inline" error_delimiters='<span class="error">|</span>'}

                    <label for="email">Email</label>
                    {field:email}
                    {error:email}<span class="error" style="display: none;">You must register using an example.org email address.</span>

                    <label for="password">Password</label>
                    {field:password}
                    {error:password}

                    <label for="password_confirm">Confirm Password</label>
                    {field:password_confirm}
                    {error:password_confirm}

                    <input type="submit" value="" class="register" />

            {/exp:freemember:register}
            </div>
         </div>
   {embed="included/page_footer"}
   {embed="included/html_footer"}

```

# Answer
> 2 votes
Your problem is your selector: `$('form#example-register input#register')`. The submit event is tied to the form, not the submit button. Try changing your selector to `$('form#example-register')`. Also adding a `console.log('submit')` into the function is good to even see if the event is getting called.

Also, while input\[type="submit"\] is accepted, IMO it's better to use a button, since it's a button. This really isn't an error, but I like to be able to call $('input') on any document and be able to omit the buttons.

Also, your last conditional seems a little off. Try breaking the return false; out of that conditional onto it's own. You are technically repeating yourself anyway. If you ever put the same code into an IF as you do the ELSE, it doesn't need to be in the conditional since it gets triggered either way. Be as DRY as possible to make debugging easier.

---
Tags: ee2, jquery, validation, freemember
---


# Question
Title: Displaying entries listed within a category, strange!
I have a strange issue, that I am hoping is something simple, and I'm just missing it.

I have two channels, that have different sets of categories.

In my first channel, I display what child cat it is in via GWcode categories.

```
{exp:gwcode_categories style="linear" last_only="yes" channel="walks" entry_id="{entry_id}"}

<span class="location"><i class="icon-location"></i> <a href="{path='walks/category/{cat_url_title}'}">{cat_name}</a></span>

{/exp:gwcode_categories}

```

This gives me the Url of `domain.com/walks/category/categoryname`

Then I have a template via Switchee, that displays these entries in this category. It uses segment 2 as the case value {category) and then displays the following channel entries tag.

```
{exp:channel:entries channel="walks" status="open|new" disable="member_data|category_fields" show_expired="yes" paginate="bottom" limit="10"}

{lv_walkdetails_main}
{lv_pagination}

{if switchee_no_results}

<p>Sorry, no results!</p>

{/if}

{/exp:channel:entries}

```

Now, as I said this displays all the entries that are listed within that category, however when I perform nearly exactly the same thing on another channel, "news", it displays every single entry, regardless as to whats in the URL.

Am I doing something wrong here? Whats the preferred way to showing a list of entries that belong to a certain child category?

# Answer
From the looks of it, you have no `category` parameter set in the `entries` tag. So right now, the `entries` tag is listing all entries in the channel `walks`.

To make the `entries` tag dynamic based off the current category, I suggest using a addon like Low Seg2Cat or URL Helper (which I prefer for the extra helpful variables) to dynamically set the `category` parameter in the `entries` tag.

So, based off your example URL, the category name is in the third segment:

```
{exp:channel:entries
    category="{segment_3_category_id}"
    channel="walks"
    disable="member_data|category_fields"
    dynamic="no"
    limit="10"
    paginate="bottom"
    show_expired="yes"
    status="open|new"
}

```
> 2 votes

---
Tags: categories, gwcode-categories
---


# Question
Title: Embedding Channel Entry Tag Pair within another Channel Entry Tag Pair
I am using ExpressionEngine 2.5.2.

I am trying to set up an instance where one channel entry is embedded within another. I found this question on StackOverflow and tried the method described in the answer. However, when I try this method on my site, the page is not recognizing the embedded channe. Anyone see any errors here?

**Main Template (Simplified)**

```
{exp:channel:entries  channel="events" limit="1" url_title={segment_2}}
    <div class="video-box">
       {embed="event_video"}
   </div>
{/exp:channel:entries}

```

**Embedded Template (Simplified)**

```
{exp:channel:entries  channel="news" limit="1" url_title={segment_2}}
    <a href="http://www.google.com">{title}</a>
{/exp:channel:entries}

```

# Answer
I have discovered what was happening, and it turns out I was actually having two different problems. The embedded template was not showing up because I needed to add the parameter dynamic="no":

```
{exp:channel:entries  channel="events" limit="1" url_title="{segment_2}" dynamic="no"}
<div class="video-box">
   {embed="templategroup/event_video" the_id="{video_id}"}
</div>
{/exp:channel:entries}

```

However, I found that what I was looking for was using Relationships, not embedded templates in this case, like this:

```
{exp:channel:entries  channel="events" limit="1" url_title={segment_2}}
<div class="video-box">
   {related_entries id="pre_event_video"}
      <a href="http://{video_player_url}?autoplay=1"><img class="placeholder" src="{pre_event_video_thumbnail}" width="336" height="305" alt="image description" /></a>
   {/related_entries}
</div>
{/exp:channel:entries}

```

Thanks for all the help, and I hope that this helps someone else out as well!
> 2 votes

# Answer
Are those your actual templates?

I see that you're trying to access entry with same url\_title ({segment\_2}) but in different channels. It is unlikely that two entries with same URL title would exist.

As suggested by Andy, try adding {if no\_results} no results {/if} to each loop.
> 2 votes

# Answer
I believe your answer is a combination of the other answers/comments here, so I'll try to summarize. You have three potential problems:

First: `url_title={segment_2}}` needs to be `url_title="{segment_2}"}`

Second: Unless your embed is in the same template group, `{embed="event_video"}` won't find it, so check that.

Third, the URL segments are not going to work like this. When you call an embed, your last URL segment is the template name itself, nothing after it. In this case, if you are using a `/event_video` and that's the last thing in that URL. You can, however, use variables within the embed tag to pick what entries the embed shows. In the example below, I'll assume you are passing an entry ID that would pick a specific video.

Main Template (Simplified)

```
{exp:channel:entries  channel="events" limit="1" url_title="{segment_2}"}
    <div class="video-box">
       {embed="templategroup/event_video" the_id="{video_id}"}
   </div>
{/exp:channel:entries}

```

Embedded Template (Simplified)

```
{exp:channel:entries  channel="news" limit="1" entry_id="{embed:the_id}"}
    <a href="http://www.google.com">{title}</a>
{/exp:channel:entries}

```
> 1 votes

# Answer
I haven't tried it yet, but you may want to give More Entries a shot to avoid the embed.
> 0 votes

---
Tags: channel, embeds
---


title: Orderby Custom Date Not Working

text:
# Question
Title: Orderby Custom Date Not Working
I am using ExpressionEngine 2.5.2 and am unable to get my entries to sort by a custom date field. I have two sites through the Multisite Manager that I am pulling entries from. On both sites, the custom date field short name is the same - "event\_date". Here's the code:

```
{exp:channel:entries  site="site1|site2" channel="events" orderby="event_date" sort="asc" status="next event|open"  limit="7"}
<li>
    <span class="event-name"><a href="#">{title}</a></span>
    <span class="date">{event_date format="%d %M %Y"}</span>
</li>
{/exp:channel:entries}

```

Here is the result in the browser:

---

Berlin 2013 ... 05 Mar 2013

Tokyo 2013 ... 13 Feb 2013

London 2013 ... 17 Apr 2013

Los Angeles 2013 ... 16 May 2013

---

Berlin is a part of Site2, and its status is "Next Event". Los Angeles, London, and Tokyo are a part of Site1, and their statuses are all set to "open". Anyone know what's wrong?

# Answer
You need to specify the field for each site individually:

```
orderby="site1_shortname:event_date|site2_shortname:event_date" sort="asc|asc"

```

What's happening right now is that it's matching the field name `event_date` to site 1 and ordering by that field for site 1, but using the default `orderby` (`entry_date`) for site 2.

(Docs.)

However, thinking about this further, this is actually expected behaviour. When specifying multiple `orderby` fields, it's sequential. So first you're ordering by field\_id\_X (whatever `event_date` is in `site1`). Well, site 2's entries are `0` in that field, so they come first.

You'd have to use a common field, like `entry_date`, to order entries from both sites sequentially *together*. (Check out EEvent Helper, which allows you to clone a custom date field to the Entry Date, among other things.)
> 1 votes

---
Tags: channel-entries, custom-fields, date, list
---


# Question
Title: How can I solve a PayPal IPN (Instant Payment Notification) error with Expresso Store?
I got this message from PayPal recently about a site that I use for a site that includes an Expresso Store.

```
Please check your server that handles PayPal Instant Payment Notifications (IPN). Instant Payment Notifications sent to the following URL(s) are failing:

/en/?ACT=31&H=48849e7094c749963e181a1e04b13b16

If you do not recognize this URL, you may be using a service provider that is using IPN on your behalf. Please contact your service provider with the above information. If this problem continues, IPNs may be disabled for your account.

Thank you for your prompt attention to this issue.

```

and Store has stopped registering my PayPal payments (it lists them as pending after they have been paid). Do you know if this is a Store problem, or has PayPal changed the way it deos IPNs? I did not change anything myself.

EE 2.5.3 Store 1.6

Good idea with support on EE Stackexchange by the way!

# Answer
> 1 votes
Your best bet would be to transition over to the PayPal Express gateway as it still uses the PayPal Standard account (no monthly fees) but it uses PayPal's newer API which is more reliable then requiring an IPN notification to be sent. It also allows for guest checkout and transferring address details from your site to PayPal.

---
Tags: expresso-store
---


# Question
Title: Safecracker Matrix only publishing one row, even if more are added
I am trying to use Matrix within a Safecracker field. I am able to submit entries successfully. However I can only submit one row to the custom matrix field. Even if I have added more than one row in my form and return a successful submission.

Here is the HTML, JS and appended HTML code in question. Help is extremely appreciated. I'm under a serious time crunch and it's the last thing on my list.

**HTML Code:**

```
<h4>Add attendees</h4>
<input type="hidden" data-field="ug_reg_attendees" name="ug_reg_attendees[row_order][]" value="row_new_0">
<div class="attendee_group">
   <div class="input-prepend">
      <span class="add-on"><div class="validation-circle"></div></span>
      <input type="text" name="ug_reg_attendees[row_new_0][col_id_52]" placeholder="First Name" />
      <div class="message"></div>
   </div>

   <div class="input-prepend">
      <span class="add-on"><div class="validation-circle"></div></span>
      <input type="text" name="ug_reg_attendees[row_new_0][col_id_53]" placeholder="Last Name" />
      <div class="message"></div>
   </div>

   <div class="input-prepend">
      <span class="add-on"><div class="validation-circle"></div></span>
      <input type="email" name="ug_reg_attendees[row_new_0][col_id_54]" placeholder="Email Address" />
      <div class="message"></div>
   </div>
</div>

<div class="btn pill blue" id="add_attendee">
   <div class="topping">Add Attendee <strong>+</strong></div>
</div>

```

**JS:**

```
$("#add_attendee").live("click", function(e) {
   e.preventDefault();
   var $row = $(".attendee_group:eq(0)").last();
   var size = $(".attendee_group").length;
   var $clone = $row.clone().html().replace(/row_new_0/g, "row_new_"+size);
   $(".attendee_group:last").after("<div class='attendee_group'>"+$clone+"</div>");
});

```

**Outputted code:** *(when at least 1 row is added)*

```
<div class="input-prepend">
   <span class="add-on"><div class="validation-circle"></div></span>
   <input type="text" name="ug_reg_attendees[row_new_1][col_id_53]" placeholder="Last Name">
   <div class="message"></div>
</div>

<div class="input-prepend">
   <span class="add-on"><div class="validation-circle"></div></span>
   <input type="email" name="ug_reg_attendees[row_new_1][col_id_54]" placeholder="Email Address">
   <div class="message"></div>
</div>

```

# Answer
I'm looking at an example where we did this. We did a .load in jQuery, pulling in the HTML from another template that was set up to build the HTML for the new row.

I'm seeing that we passed an updated value for each to that URL, and used that value on each -- `field_name[row_new_0][col_id_X]` -- for the input name, with 0, 1, 2, etc creating a new rows.

Your outputted code only shows an example of row\_new\_1 for the new rows, so I can't see that the other rows have incremental values..

Try switching to row\_new\_0, row\_new\_1, row\_new\_2 for all new rows?

**Updated:** We also included:

```
<input name="field_name[row_order][]" value="row_new_0" type="hidden" />

```

In each added row. I'm not sure what that is for, but I don't see it your code. We incremented that each time too. (`row_new_0`, `row_new_1`, etc)
> 1 votes

# Answer
Lucas,

The best way to include Matrix in your SafeCracker form is using the {field:my\_field\_name} variable:

`{field:my_field_name}`

That way it'll include all of the necessary setup for Matrix to work correctly in SafeCracker and avoids what you are running into.

-Lisa
> 1 votes

---
Tags: safecracker, matrix, custom-fields, jquery, pixelandtonic
---


# Question
Title: Playa Filters failing with Force SSL module in place
We are experiencing the same issue as: https://getsatisfaction.com/pixelandtonic/topics/https\_and\_playa\_in\_cp

We're wanting to use the playa module along with force-ssl(http://devot-ee.com/add-ons/dm-force-ssl). Due to various constraints we were unable to apply SSL without this module.

The force-ssl module controls the "URL to your "themes" folder" among other variables. So despite setting it to /themes/ the playa plugin 'filter' feature still does not work.

We experienced the same issue with channel videos. After talking to them they were able to issue a patch that resolved this issue. We're wondering if you could also facilitate integration of the playa and force-ssl module?

I've also tried this and had the same result without force-ssl and just a simple rewrite for the control panel only:

```
    RewriteCond %{HTTPS} off
    RewriteCond $1 ^(admin.php) [NC]
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

```

Taylor

# Answer
> 4 votes
If it’s just the search/filters that aren’t working, Playa uses Ajax to apply those things, which goes through your Site URL, not your themes folder.

If you don’t want to set your main site URL to use SSL, you can give Playa an alternate URL to use by opening up system/expressionengine/config/config.php and adding this:

```
$config['playa_site_index'] = "https://example.com/index.php";

```

---
Tags: playa, ssl
---


# Question
Title: Cartthrob order editing -- save order in draft status?
I need to be able to easily add, change, and delete items from finished orders. The most ideal solution to this would be to have all orders saved in some kind of 'draft' status and only finalize them after they're processed by staff, as has been mentioned on CT's forums.

I'm currently attempting to hack something together using javascript to allow staff to add and configure products (and then use Cartthrob's inventory reduce tag) but wondering if anyone else facing this problem has come up with a way to keep orders in the cart until after staff has finished with them? Or to put it a different way, is there any way to give a staff member access to the cart prior to it being submitted?

We don't use any kind of payment gateway so there's no reason the order needs to be finalized before staff gets to it.

# Answer
What version of CT are you using? I can see in the admin that under settings/orders you can set the status under 'payment being processed'.

Maybe there some way you can use that to hack a solution? I haven't done it myself but it looks like there may be a way.

I hope this is helpful!
> 2 votes

---
Tags: cartthrob
---


# Question
Title: Click to Load More Entries / Vertical Pagination
I am using ExpressionEngine 2.5.2 and would like to create, for lack of a better phrase, "vertical pagination" for my channel entries. This would be similar to infinite scrolling, but instead of more entries loading automatically, I would like the user to have to click a "more entries" link. Currently my homepage shows 6 blog posts, and when someone clicks "more entries," I'd like 6 more entries to show up below the 1st 6.

My reason for this is that I would like to user to always be able to reach my website's footer containing links no matter how far down the page they are, but also not have to have another page load like regular pagination does.

I have no clue where to even start with this, and I am not fluent with jquery. Is there a plugin that does this? Is there a tutorial I can check out? Thanks for the help.

# Answer
> 1 votes
Justin Long posted an article a while back about how to add infinite scrolling to paginated pages.

http://iamjustinlong.com/blog/single/implementing\_infinite\_scroll\_in\_your\_expressionengine\_site/

Near the end he explains how to add the extra entries when clicking a link, as opposed to just scrolling.

# Answer
> 0 votes
You can do this with jQuery's .load().

If you have an ExpressionEngine template/URL for your blog that supports pagination, the output of which is just the HTML of the entries with no outer HTML/DOM, you're just loading chunks of HTML in per "page".

You could increment a counter each time the user clicks the link, and multiply that by your offset for your pagination offets.

```
click = 1;
pagination = click*10 = 10;
.load('/blog/more-entries/P'+pagination);
click++;

```

That would load the following URLs with each click:

```
/blog/more-entries/P10
/blog/more-entries/P20
/blog/more-entries/P30
...

```

# Answer
> 0 votes
Maybe you could use this: Infinite Scroll http://devot-ee.com/add-ons/infinite-scroll

---
Tags: channel-entries, pagination
---


# Question
Title: Upgrading and moving a site at the same time
I have a huge website which gets a lot of traffic so it can't be down for very long. The site is still running 1.6.7 (I know, shame on me!). I'd like to move it to a new directory on my server and take my time upgrading the back end before going live with it. Do I need to install 1.6.7 in this new directory and then upgrade from there? I've been putting this off for ages because frankly, I'm terrified of it.

Also, assuming it takes me a month to get the new site the way I want it (I'm redesigning as well), when I switch to the new site, all of the information that's been added to the live site in the meantime will be missing. Is there any way to prevent this other than doing double entries using the two different dashboards?

# Answer
The way I do it is to copy everything, the files and I make a duplicate database for the dev site. Make sure you upgrade your database settings in the config file! Then I do the upgrades on the duplicate site while the live site remains in tact.

I have done a couple of these EE1 to EE2 upgrades and they are tricky if you have 3rd party plugins involved. If you have structure installed, DO look at their instructions before you upgrade. You have a process to go through in EE1 before moving to EE2.

**Please PLEASE PLEASE make sure that you have a backup.**

As far as I know the live site content changes can not be updated to the new site, unless you copy them by hand.

Good luck!
> 1 votes

# Answer
> Do I need to install 1.6.7 in this new directory and then upgrade from there? I've been putting this off for ages because frankly, I'm terrified of it.

I haven't tackled any big upgrades, but I think you need to copy the current site and perform the upgrade on that, test everything, update add-ons, and probably update some code where things have changed. I'd recommend doing this in dev, as I outlined here.

> Is there any way to prevent this other than doing double entries using the two different dashboards?

I suspect so. There is no way to merge the two. Your options are probably to keep up with duplicate entry, or document everything you did, and reproduce those steps on a fresh copy of the live database prior to re-launch, swapping that database in for the live database.
> 0 votes

---
Tags: ee1, upgrade
---


title: SEO Lite & Switchee

text:
# Question
Title: SEO Lite & Switchee
OK, so i've had a great deal of help on here on the rebuild of my site, and I'm onto the last part which is to make sure my pages meta, titles etc are working well.

I have switched (pun) a lot of my templates to using Switchee, and its been really great.

So far I have a few templates that have a global head embed, that inserts basically just the `<head>`. Then the main structure of my page with Switchee controlling what content is shown within the main content area.

I have normally used SEO lite, and I like it, but I'm starting to think what the best way to use it with multiple content within a single template is?

Do you think it is best to run a conditional on the embed to determine what content is passed through with the embed to SEO Lite. Or to maybe include a different global head embed with each Switchee case?

Just trying to get my head around the best way to do it, without needlessly repeating things!

Any thoughts appreciated, or if anyones utilised the two together, I'd be interested to hear what they think.

**UPDATE**

OK, thanks for that tip. I've actually tried it just now, and I can see the benefits. However I am a bit unsure as to how to deal with a certain scenario.

Lets say I have my 'news' index page. This consists of an instance of Switchee, that determines if it is the

* default {latest articles) index page (domain.com/news)
* category page. {domain.com/news/category)

Now, my template is something along the lines of

```
{embed="includes/_head"}

{lv_page title}

<div class="container">

 <div class="main-content">

  {exp:switchee variable="{segment_2}" parse="inward"}

  {case value="" default="yes"}

  {exp:channel:entries channel="news" status="open" paginate="bottom"}

    {lv_news_article_details}

  {/exp:channel:entries}

  {/case}

  {case value="category"}

  {exp:channel:entries channel="news" category="{segment_3_category_id}" status="open" paginate="bottom"}

    {lv_news_article_details}

  {/exp:channel:entries}

  {/case}

  </div>

{lv_sidebar_news}

</div>

{lv_footer}

```

That's a very simplified version. Now my template shares the same global head embed, but I will want the Title to be "Latest News" for the first case, and "Category News" for the second case. What would be the best way of passing that information to the embed, more conditionals?

# Answer
We use this code in our header embed; allows us to do something like `{embed="site/_header" meta_title="Example Title"}`; alternatively we can specify an entry ID, and SEO Lite will figure out the correct info, or, we can just let it rely on the last segment, which works 95% of the time.

It's worth noting that we're also using Mark Croxton's IfElse add-on here to keep things nice and speedy.

```
{exp:ifelse parse="inward"}
    {if "{embed:meta_title}"}
        {exp:seo_lite title_override="{embed:meta_title}"  default_keywords="{embed:meta_keywords}" default_description="{embed:meta_description}"}
    {if:elseif "{embed:entry_id}"}
        {exp:seo_lite entry_id="{embed:entry_id}"}
    {if:else}
        {exp:seo_lite use_last_segment="yes"}
    {/if}
{/exp:ifelse}

```
> 4 votes

---
Tags: embeds, seo, switchee, seo-lite
---


# Question
Title: How to get just the image file name from a file field?
I'm setting up an xml page in which I need to have just the file name of an image from a file upload field. What I currently have is:

```
<picture>
    {exp:xml_encode}{image}{/exp:xml_encode}
</picture>

```

but what this results in is:

```
<picture>
http://domain.com/uploads/images/11-january-006.jpg
</picture>

```

When what I only need is 11-january-006.jpg

any ideas on the best approach for this?

# Answer
Use the file field tag pair:

```
{image}{file_name}{/image}

```

No add-on required!
> 4 votes

# Answer
Does the filename variable not work for you?

```
{filename}

```
> 0 votes

---
Tags: templates, file-uploads, xml
---


# Question
Title: Including php code in Postmaster message
Has anyone experience in using php code in postmaster messages?

I am developing a weekly email using parcels and have tried to include code as simple as echoes and prints but there has been no output. Is there a preference somewhere that I can update?

# Answer
> 1 votes
Investigated this further as suggested by Justin Kimbrell above. As it turns out, embedded a template which allows php leads to the message (at least in the preview) being broken and the processing of the message cuts out as soon as any information is echoed etc using the embed. I am now developing a plugin which I will have to use to print out the relevant information.

# Answer
> 2 votes
I don't think PHP code in the email template works with my template parser. I need to test to be sure, but I don't think it works. I personally never use PHP in templates, instead I just roll anything I need into a simple plugin.

I can add this to list of things to add in the next release, but I don't have any ETA on v1.3.

---
Tags: email, php, postmaster
---


title: SSL form action issue - Zoo Visitor

text:
# Question
Title: SSL form action issue - Zoo Visitor
I am using the Zoo Visitor login form within a secured environment and the form action being output is **http://** instead of **https://** \- even when I put a full path like: `return="https://www.site-name.com/account"` the form action is: `action="http://www.site-name.com/account"`.

How can I make the form submit to a secure URL?

# Answer
You can use the `secure_action="yes"` and `secure_return="yes"` parameters from safecracker in the Zoo Visitor login form tag. There's a Zoo Visitor support post on Devot:ee. I've also tried this on my own Zoo Visitor login form and can confirm that it works.
> 2 votes

---
Tags: zoo-visitor
---


# Question
Title: Expresso Store - Optionally automatically register members during checkout
In the summary of features of Store at: https://exp-resso.com/store it states you can "Optionally automatically register members during checkout"

But I can't find the setting in the control panel or any documentation on how to set this up...

Can anyone point me in the right direction please?

-- EDIT -- Figured this one out -\> This is possible via the register\_member parameter of the checkout form or by using a register member field in the form. Adrians answer below has full details.

Thanks for your help!

# Answer
> 3 votes
To enable member registration, you can either use the `register_member="yes"` tag parameter, or submit a the `register_member` field (e.g. as a checkbox) in your checkout:

```
{field:register_member} <label for="register_member">Register Member Account?</label>

<!-- These fields are optional -->
<div class="toggle">
  <div>
    <label for="password">Password</label>
    {field:password}
  </div>

  <div>
    <label for="password_confirm">Confirm Password</label>
    {field:password_confirm}
  </div>

  <div>
    <label for="username">Username</label>
    {field:username}
  </div>

  <div>
    <label for="screen_name">Screen Name</label>
    {field:screen_name}
  </div>
</div>

```

Complete documentation on registering members during checkout is here:

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

# Answer
> 1 votes
I just found the 'register\_member' parameter in the checkout tag documentation.

---
Tags: expresso-store
---


# Question
Title: FreeMember - logout tag redirecting to a blank page
When attempting to logout using the freemember logout URL tag the page is re-directing to a blank page with the desired url path output: https://www.site-name.com/?ACT=56&return\_url=%2F

I have also tried other paths, that is other than redirecting to the home page.

Any ideas?

# Answer
> 2 votes
Blank page usually means there is some PHP or MySQL error, but it is suppressed by EE debugging level. Try setting "Show error to everyone" in Output Preferences and see if you get any message.

# Answer
> 1 votes
Try setting `$debug = 1;` in your `index.php` file.

This will force EE to display any PHP errors that might be being hidden on that page.

Alternatively, you might have some crazy htaccess rules which are breaking the `?ACT` URL (this is an EE action URL used by FreeMember, in this case to log out the current user).

# Answer
> 0 votes
Are you using the {exp:freemember:logout\_url} trying setting return="example/page"

```
{exp:freemember:logout_url return="example/page"}

```

---
Tags: freemember
---


# Question
Title: Linking to Structure Pages in Wygwam: How to not use full URL?
I have a staging site running at a URL like client.clearbold.com.

I'm using FocusLab's Config, so all my paths and domains are dynamic.

When I link text in a Wygwam field, and choose a Structure Page or a Structure Listing entry, the full URL, including http://client.clearbold.com, is stored in the Wygwam field's contents.

How do I keep this from happening? We'll end up with a site with 100s of links to a Staging subdomain instead of the live URL.

**Updated:** I've confirmed this is fixed in 2.7. Surprised I haven't seen this before, though I'm wondering how many links were applied within content fields on previous projects.

# Answer
> 1 votes
It's all handled auto-magically. As long as you don't create links in source mode, it'll work when you change the domain/address/environment as of Wygwam 2.7.

See Also: Dynamic Filepaths to Assets Files in Wygwam Fields

# Answer
> 0 votes
I had a similar but different issue in my environment. Because my site is being reverse-proxied into another domain and uses CE-Cache, all links created with the "Structure" link type in Wygwam were getting cached with the Origin domain.

My fix was to add a line to wygwam/helper.php right after line 948:

```
$urls[] = str_replace("origindomain.com","destinationdomain.com",$page[4]);

```

This effectively ensured that all of those full-path Structure links generated within Wygwam fields rendered the destination domain rather than the Origin that's read by Akamai.

---
Tags: structure, wygwam, links
---


title: Slow display of Channel entries

text:
# Question
Title: Slow display of Channel entries
I have a page that displays the top 10 most recent entries in a particular channel. When I add an entry to the Channel and load this page, it takes forever to load. However, subsequent loads go faster. I think it's faster due to the MySQL query being cached.

What things can I do to troubleshoot this problem? Why are the initial loads so slow? What params can I pass to `exp:channel:entry` to speed up queries? Any other suggestions why things might be slow?

NOTE: this particular channel has a lot of relationship field types. I'm wondering if that's potentially a problem.

**UPDATE 1:**

Initial page load: `Total Execution Time 218.7162`. Subsequent page loads are like this: `Total Execution Time 1.7793.`

# Answer
First off it would be a good idea to establish how slow your template is rendering and how many database queries are being performed. I would then strip back your template and add each element back into it individually seeing how many additional queries are needed and how much additional time they take.

Turn on the Output Profiler by going to Admin \> System Administration \> Output and Debugging. This will show a bunch of useful information including execution time, memory usage and the number of queries performed.

The relationship fields are probably the main issue in your template as each one will be adding about 3 additional queries per entry. Times that by the 10 entries in your channel entries loop and you are potentially using 30 queries for each relationship field that is being displayed.

If you have to display relationships or any add-on that uses it's own database table in a listing there are a few things you can do to reduce the number of queries. I will commonly write a plugin with my own custom queries to get the information I need more directly. Greg Aker wrote a good article on creating Expression Engine plugins. Stash is also very helpful when you need to use query intensive tags more than once.

Unfortunately there's not really a magic bullet when it comes to performance. One of the great things about Expression Engine is that's easy to construct and template quite complex websites. However you can get yourself into a bit of trouble if you don't understand what's going on behind the scenes. Familiarising yourself with the output profiler and the database queries that are being run for each tag will go a long way when thinking about how you can build a site with performance in mind.
> 5 votes

# Answer
You might use the parameter disable="categories|category\_fields|member\_data|custom\_fields|pagination|trackbacks" within the channel entry tag.
> 2 votes

---
Tags: channel-entries
---


# Question
Title: Advance form - show a field from field group of the channel
I am new to ExpressionEngine and trying to create an advanced form.

I have displayed the channel and categories associated with it as below as checkboxes:

```
{exp:channel:categories channel="books"}
<label for="cat1">
  <input type="checkbox" id="cat1" name="category[]" value="{category_id}">{category_name}
</label>
{/exp:channel:categories}

```

I am now trying to create checkboxes that show a particular field from the channel field group that is associated with the channel, so it adds an extra filter on the search for the user to search.

Can this be achieved or is there a plugin to help with this detailed search criteria?

# Answer
This is a little tricky but Low Search's relationship filters may be able to do what you require. They essentially allow you to limit your search results based on the child or parent entries defined in the search form.
> 1 votes

---
Tags: forms
---


# Question
Title: Matrix total_rows variable not updating after adding rows manually
I have a custom add-on which adds a row to the exp\_matrix\_data DB table. Everything works well with the exception that the `{field_name:total_rows}` tag is no longer returning the correct number of matrix rows.

Are there any places other than exp\_matrix\_data where my add-on needs to make changes when programatically adding/deleting matrix rows in this way?

# Answer
oops, not to worry I think I figured it out - I needed to set `field_id_##` in `exp_channel_data` to `1`.
> 0 votes

---
Tags: matrix, pixelandtonic
---


# Question
Title: How to use images from themes/third_party folder in a plugin?
I am writing a simple plugin and I want to use some images within the plugin. I assume that the \*themes/third\_party\*-folder is the right place for those. How can I use them? I cannot link to them directly (e.g. `<img src="/themes/third_party/..."`) because the folder is not directly accessible.

# Answer
> 3 votes
ExpressionEngine have Path Constants. You can use PATH\_THIRD\_THEMES. You should have image path like:

```
$img = "<img src='".PATH_THIRD_THEMES."IMAGE_NAME' />";

```

I hope, it would help you.

---
Tags: plugin, image, themes
---


title: If author/screen_name

text:
# Question
Title: If author/screen_name
I have a list of channel entries written by different authors.

How can I create a conditional to display a link if it is a certain author?

For example I want to display a link to a specific author's Twitter account.

So: if screen\_name = Bob Smith then Link

Any help appreciated!

N

# Answer
> 1 votes
Seems like you've already answered your own question:

```
{if screen_name=='Bob Smith'}link{/if}

```

---
Tags: conditionals
---


# Question
Title: How do I render a matrix field in search results?
When I do a simple search on my site, I am searching across three channels. One of them is an image gallery set up using Matrix. In the Matrix field for that channel there is a column called "img\_caption", which is, obviously, a caption for the image.

In my search results, I try to trap which channel a search result row is coming from and display the appropriate field (as the "excerpt") using conditionals, like this:

```
 {if summary!=""}{exp:ce_str:ing remove_html truncate="150"}{summary}{/exp:ce_str:ing}{/if}
 {if rick_summary!=""}{exp:ce_str:ing remove_html truncate="150"}{rick_summary}{/exp:ce_str:ing}{/if}
 {if img_caption!=""}{exp:ce_str:ing remove_html truncate="150"}{img_caption}{/exp:ce_str:ing}{/if}

```

I do have "custom\_field" set to "yes" in the search results tag:

```
 {exp:search:search_results switch="resultRowOne|resultRowTwo" custom_fields="yes"}

```

This is working for {summary} and {rick\_summary} but not for {img\_caption}.

I've edited a few entries in the gallery and resaved them, thinking that might be the issue. And, the img\_caption column as well as the matrix field is set to be searchable.

Search is finding results from the gallery, at least based on the entry title, so I am getting results, just nothing I can use as an excerpt.

Any ideas for me?

# Answer
> 3 votes
You can display custom field data, including Matrix fields, within the exp:search:search\_results tag. In this case it just looks like you have the incorrect syntax.

Your `img_caption` field is a Matrix column. Matrix columns are only available within the Matrix tag pair, so the column name alone won't display anything.

So instead try:

```
{matrix_custom_field_name}{img_caption}{/matrix_custom_field_name}

```

Where matrix\_custom\_field\_name matches the short name for your Matrix field.

As an aside.... Depending on how many rows are in your gallery and what you'd like your excerpt to look like, you may want to put `limit="1"` on the opening Matrix tag to prevent loading multiple captions.

# Answer
> 1 votes
I'm not sure if EE's native search module provides an ID variable. If it did, you could use it in an embedded template to pull the matrix data in with a normal channel entries tag.

Looking at the docs for the search module ID doesn't appear to be a valid variable although it might still work, you'd have to test it out. If it doesn't, Low Search does give you access to all the variables that work with the Channel entries tag, so you might need to consider that as an alternative.

---
Tags: matrix, simple-search
---


# Question
Title: Is there an EE plugin that gives greater control over channel permissions?
I have to build a site for a client that requires 9 different content editors admin groups and 3 publisher admin groups. A lot of what I want to do **could** be done by allowing certain groups access to categories rather than closing them off to whole channels.

Does anyone know of a third party plugin that makes admin user permissions more powerful or easier to use? I searched Devot-ee and couldn't find anything.

An example of what I want to do is a news channel:

This website has 5 different categories of news - some editors will only be allowed access to 2 categories, but still need access to the news channel. So as far as I can tell, I'll need to make 2 different news channels to block the users' access to the 3 categories they are not allowed to post to. Obviously I'd rather have one channel and close access to the categories, not the other way round.

Thanks for your help,

Ant

# Answer
> 2 votes
Can you use Safecracker? Then there would be no need give the editors access to the CP at all. After logging in they would see the Safecracker form and can add an entry. You could then set the available categories in the form in regard of the user group. If editor1 is part of the editor\_group\_2 he´ll get access to the news\_category1 and news\_category\_4. This would solve the editor issue. Do the publishers also need to have this granular access to the categories?

As a second option Better Workflow might be able to solve your problem.

# Answer
> 1 votes
One more vote for Safecracker. This would allow much more flexibility.

You then might use complex conditionals as well as add-ons like Member Categories and Entry Access

Remember that the restrictions you set in Control Panel still have effect if you use Safecracker, so member's group should still have access to publish to the channel - even you restrict that somehow on actual entry form page.

---
Tags: module, users, admin, permissions
---


# Question
Title: How to find out what class/function has invoked extension hook?
I have an extension that relies on certain extension hook.

The hook can be invoked either by function from EE core or third-party module.

I need to be able to tell what function / class has invoked it. Is there a way I can find that?

# Answer
You should loop through the output of PHP's debug\_backtrace() method.

For example, I just called it inside an extension using the `channel_entries_query_result` hook (truncated a little). The `object` or `class` parameters would be most helpful to you to figure out which extension called the hook:

```
Array
(
    [0] => Array
        (
            [function] => channel_entries_query_result
            [class] => Store_ext
            [object] => Store_ext Object
            [type] => ->
            [args] => Array
        )

    [1] => Array
        (
            [file] => /path/to/system/expressionengine/libraries/Extensions.php
            [line] => 241
            [function] => call_user_func_array
            [args] => Array
        )

    [2] => Array
        (
            [function] => universal_call
            [class] => EE_Extensions
            [object] => EE_Extensions Object
            [type] => ->
            [args] => Array
        )

    [3] => Array
        (
            [file] => /path/to/system/expressionengine/libraries/Extensions.php
            [line] => 119
            [function] => call_user_func_array
            [args] => Array
        )

    [4] => Array
        (
            [file] => /path/to/system/expressionengine/modules/channel/mod.channel.php
            [line] => 3315
            [function] => call
            [class] => EE_Extensions
            [object] => EE_Extensions Object
            [type] => ->
            [args] => Array
        )
    [5] => Array
        (
            [file] => /path/to/system/expressionengine/modules/channel/mod.channel.php
            [line] => 324
            [function] => parse_channel_entries
            [class] => Channel
            [object] => Channel Object
            [type] => ->
            [args] => Array
        )
)

```
> 2 votes

---
Tags: add-on-development, php, extension
---


# Question
Title: Simplest/Most Efficient Way to create a Definition List in channel fields
I want to create a definition list and it's overkill to create a whole separate channel for this.

Ideally in my channel entry there would be a field to create a definition list.

What's the best way to input the data?

```
<dl>
  <dt>Client:</dt>
  <dd><a href="http://website.com" target="_blank">Company name</a></dd>
  <dt>Creative Director:</dt>
  <dd><a href="http://personalsite.com" target="_blank">Team Member</a></dd>
  <dt>Developers:</dt>
  <dd><a href="http://http://companysite.com" target="_blank">Company</a></dd>
</dl>

```

# Answer
> 2 votes
Matrix is an excellent option if you can put this content inline in a given entry and not need to re-use it.

If you need to, for example, add a filter down the line with only those entries that have client company of ABC Company, for example, it may be ever so slightly harder to achieve without having that content at the entries level (without having to get into some custom queries, anyway) - so if setup as entries, you could then use a relationship field (or a Playa relationship field if multiples of any of your assignments would need it).

Another option would be categories, but also not quite as user friendly on the admin end.

# Answer
> 1 votes
Decided to use Matrix. Perfect for what I need. So versatile.

# Answer
> 0 votes
P&T List from Pixel and Tonic is also great for doing something like this if you have fixed Definition Terms but need your user to be able to add multiple Definition Descriptions. Just define a new channel field for each DT/DD combo. It's nice and light weight and also free.

---
Tags: channel-entries, .html
---


title: iStockPhoto Lightbox-type extension

text:
# Question
Title: iStockPhoto Lightbox-type extension
Has anyone come across an extension that will allow a user to create multiple "lightboxes" of their favourite channel entries?

I am aware of the Solspace Favourites module, but that only allows users to create a single list. I need the user to be able to create multiple "lightboxes" or favourites lists, as used by iStockPhoto.

# Answer
There is also Bookmarks module, but it also does not allow you to create sets of bookmarks.

I would use different approach:

* create a channel named "Lightboxes" with custom field that will hold relationships with entries
* use Safecracker to create a lighbox
* have some code that will add entries to relationships custom field in lightbox entry
> 3 votes

# Answer
CartThrob Wish List is a little known add-on that allows you to create lists of entries. It's a module they developed for a client of mine and then refined and added a bunch of features to. I've never tried to use it outside of a CartThrob ecommerce site, but I don't see any reason that it should be dependent on it. You would simply not need to take advantage of the flipside of the module, which is allowing third parties to buy items from the wish list, thereby debiting the "wanted" volume of the given entries. But that's what immediately came to mind based on your need.

The other one that came to mind is Joel Bradbury's Shortlist \- but currently it doesn't offer multiple lists to users either. It may be something he's working on for a future release perhaps.
> 0 votes

---
Tags: add-on, extension
---