# Question
Title: Addon to handle data too complex for Channels/Playa/Matrix
I need to be able to add/edit/delete records whose data structure is somewhat complex and involves a lot of business rules for each database operation. For example:

* Some inserts are simple INSERTs, while others may be INSERT IGNORE depending on certain conditions
* Delete operations may or may not trigger addition DB operations
* etc

Furthermore, due to the complexity of the data structure and a few other reasons (e.g. not wanting this to be coupled to EE so that other CMS can interact with it in the future), I want all this data to be on a separate database.

I'm still not completely sure what an addon can or cannot do. So, here are some questions I have before getting too deep into this:

1. Is it possible to create some sort of addon whose data is stored on a different database?
2. Since this won't be using Channels, how would I make my back end interfaces appear in the Control Panel?
3. Will I be able to loop through the entries like I do with Channel entries (using tag pairs)?

# Answer
> Is it possible to create some sort of addon whose data is stored on a different database?

Sure, I'm pretty sure this should work (based on the CodeIgniter docs):

```
$config = array(
    'hostname' => "localhost",
    'username' => "myusername",
    'password' => "mypassword",
    'database' => "mydatabase",
    'dbdriver' => "mysql",
    'char_set' => "utf8",
    'dbcollat' => "utf8_general_ci"
);
$this->EE->custom_db = $this->EE->db->load->database($config);
// Now use $this->EE->custom_db->query(), etc

```

> Since this won't be using Channels, how would I make my back end interfaces appear in the Control Panel?

You'd have to build the interfaces yourself, using "view" files inside your add-on, which can then use EE's helper classes to build forms, tables, etc for display. (See the module tutorial for some guidance.)

> Will I be able to loop through the entries like I do with Channel entries (using tag pairs)?

Yes, the key to that is just having your data in a multi-dimensional array, and using `this->EE->TMPL->parse_variables()` (see docs).
> 3 votes

---
Tags: add-on, channel-entries, channel, playa, matrix
---


# Question
Title: A way to limit the number of categories with `exp:channel:categories`?
Is it possible to limit the number of categories that are returned by the `{exp:channel:categories}` tag? If not is there an alternative (or dare I say add-on :P)

Obviously I could just use an SQL query for this, but if possible I would prefer to use one of the more standard built-in tags for this if possible.

**Use Case:**

* Categories have been manually ordered using the control panel.
* Only want the first 10 to be displayed.

# Answer
> 7 votes
The `{exp:channel:categories}` sadly does not have a `limit` parameter. GW Code Categories does have a `limit` parameter though (along with many other useful features when working with categories).

---
Tags: templates, categories
---


title: Mailing list submit in Safecracker

text:
# Question
Title: Mailing list submit in Safecracker
I'm looking for a way to submit to a mailinglist (standard ee mailing list module) when submitting a safecracker form. Basically a user will click a checkbox "yes, send me the newsletter".

Thanks!

# Answer
> 2 votes
I don't think there's a way to do this out of the box with Safecracker. However, you can write an extension that responds to the safecracker\_submit\_entry\_start or safecracker\_submit\_entry\_end hooks.

```
    $data = array(
            'class'     => 'Mailing_list_ext',
            'method'    => 'add_to_mailing_list',
            'hook'      => 'safecracker_submit_entry_end',
            'settings'  => '',
            'priority'  => '10',
            'version'   => $this->version,
            'enabled'   => 'y'
    );
    $this->EE->db->insert('extensions', $data);

```

Basically, you'll want your extension to check for the custom field you're using for the newsletter signup, then you'll have to insert your user's email address into the exp\_mailing\_list table:

```
function add_to_mailing_list($data) {
    if($this->EE->input->post('add_me_to_list') == 'yes') {
        //get the email address from the safecracker form
        $email = $this->EE->input->post('email');

        //either hardcode the list id from exp_mailing_lists or lookup with a query
        $list_id = 1;

        //generate the auth check
        $code = $this->EE->functions->random('alnum', 10);

        //insert a new row into exp_mailing_list

        $this->EE->db->query("INSERT INTO exp_mailing_list (list_id, authcode, email, ip_address)
        VALUES ('".$this->EE->db->escape_str($list_id)."', '".$code."',
        '".$this->EE->db->escape_str($email)."',
        '".$this->EE->db->escape_str($this->EE->input->ip_address())."')");
    }
}

```

To learn more about creating EE extensions, you can view the Extension Development docs here

---
Tags: safecracker
---


# Question
Title: ExpressionEngine 1 Query Module and Ordering SQL UNION
I'm receiving a MYSQL Error on this code in ExpressionEngine 1.6.4 (very old version)

```
{exp:query  limit="10" paginate="bottom"
    sql="SELECT 'gallery' AS `content_type`, `cat_id` AS `entry_id`, `recent_entry_date` AS `entry_date`
        FROM `exp_gallery_categories`
        WHERE `gallery_id` = 9 AND total_files > 0
        UNION
        SELECT 'video' AS `content_type`, `entry_id`, `entry_date`
        FROM `exp_weblog_titles`
        WHERE `weblog_id` = 6 ORDER BY `entry_date` DESC"

}
<p>{content_type} - {entry_id} - {entry_date format="%d %F %Y"}</p>
{paginate}{pagination_links}{/paginate}
{/exp:query}

```

MySQL returns this:

```
MySQL ERROR: Error Number: 1054
Description: Unknown column 'entry_date' in 'order clause'
Query: SELECT COUNT(*) AS count FROM `exp_gallery_categories` WHERE `gallery_id` = 9 AND total_files > 0 UNION SELECT COUNT(*) AS count FROM `exp_weblog_titles` WHERE `weblog_id` = 6 ORDER BY `entry_date` DESC

```

It seems like EE is modifying my query before MySQL and making it fail (On a SQL client this works smoothly).

# Answer
> 4 votes
### What's Going Wrong

You've already spotted the problem but here's a quick explanation of why the error is occurring. If you enable pagination EE1's query module will issue two queries - one calculates the total number of results sans-pagination and the other issues the query itself with an additional `LIMIT` parameter.

The total results query is generated by rewriting the `SELECT` portion of your query as `SELECT COUNT(*)`. This means that the `entry_date` alias is no longer created, so MySQL trips up as soon as it hits the `ORDER BY` part of the query.

Another problem is that even if you remove the `ORDER BY` parameter the union query results in two different count values being returned - one for each table. Presumably EE would ignore all but the first value.

### How To Fix It (Hopefully)

I haven't tested this patch but it's the same approach that EE2's query module uses so it should work. Open up mod.query.php and find the following line:

```
$query = $DB->query(preg_replace("/SELECT(.*?)\s+FROM\s+/is", 'SELECT COUNT(*) AS count FROM ', $sql));

```

Replace it with this:

```
$query = $DB->query("SELECT COUNT(*) AS count FROM ({$sql}) AS query");

```

This approach leaves your original query intact, so it should return accurate total results counts and won't be anywhere near as easily tripped up by aliases or unions.

# Answer
> 1 votes
Tell MySQL which entry\_date you want to use. Something like:

```
{exp:query  limit="10" paginate="bottom"
    sql="SELECT 'gallery' AS `content_type`, `cat_id` AS `entry_id`, `recent_entry_date` AS `entry_date`
        FROM `exp_gallery_categories` g
        WHERE `gallery_id` = 9 AND total_files > 0
        UNION
        SELECT 'video' AS `content_type`, `entry_id`, `entry_date`
        FROM `exp_weblog_titles` t
        WHERE `weblog_id` = 6 ORDER BY `t.entry_date` DESC"

}

```

It's been awhile, but I'll assume that the gallery also has an entry\_date field and you just haven't specified which field you need or want.

---
Tags: module, ee1, mysql, query
---


# Question
Title: Logging into CP returns to Site Homepage
I have a live site that I used to be able to login to without any issue. I hadn't tried logging in for a month or so and when I tried to login again, it just redirects me to the homepage of the website. I'm using EE 2.2.2 with some 3rd party addons including structure and some others. I've checked their support forums and can't seem to find anything similar to the issue I am having.

Trying to figure out if its an EE issue or an add-on issue...

# Answer
My first suggestion is to clear browser Cookies and Cache.

The second step is to add the following into your config.php file:

```
$config['cookie_domain'] = "";
$config['cookie_path'] = "";
$config['cookie_prefix'] = "";
$config['admin_session_type'] = "s";
$config['user_session_type'] = "c";
$config['require_ip_for_login'] = "n";
$config['require_ip_for_posting'] = "n";
$config['secure_forms'] = "n";

```
> 5 votes

# Answer
If you have your cookie domain set to something other than the actual domain of the site in your config then this can happen, and some security settings can also cause this too.

You could try adding the following lines to `config.php` file in order to get into the control panel and then debug further from there:

```
$config['require_ip_for_login'] = 'n';
$config['require_ip_for_posting'] = 'n';

```

Here is a link to a post on the ExpressionEngine forums where I had a similar issue previously...
> 4 votes

# Answer
Sometimes its as easy as clearing your browser cache or trying on another browser to see what happens. Also, try clearing your cookies for the domain. Has anything changed in the environment recently?
> 2 votes

# Answer
Also you're a few versions behind the most recent build. It certainly wouldn't hurt to upgrade.

But clearing your cache and trying another browser is also a great idea. I'd try that first.

Refreshing your files with an update is one way of making sure there is no file corruption.
> 1 votes

# Answer
I have run into this several times, doing all three of these usually clears up the issue:

1. Clear cache
2. Clear all cookies
3. Close all browser windows and re-open

If this does not solve the issue then you probably have a bad redirect in your .htaccess file, and/or a bad path set in your config.php file.
> 1 votes

---
Tags: login, control-panel, admin
---


# Question
Title: How to create blog listing with categories using structure?
I am using structure for the pages of a site and am curious as to how the "Listings" type is supposed to work. It seems to allow me to provide a listing template and to specify the template that is used for each individual article.

However, there doesn't appear to be a way to have categories and archives.

How can this be achieved or can Structure not be used to do that?

# Answer
> 4 votes
You'll need an additional addon like Freebie, which allows the system to ignore certain segments.

There's a reasonably complete walkthrough in the Structure documentation and this blog post on 3 Roads Media also covers the same idea.

# Answer
> 4 votes
Freebie is good, but Zoo Triggers is better, and a hell of a lot easier.

# Answer
> 1 votes
While you can use Structure to manage blog entries, you don't have to.

I have a number of blogs on Structure-enabled sites where the blog entries themselves are not managed through Structure, only the blog's main page is.

The blog's main page is managed as a page, and the blog entries are set as a listing under it. Creating and editing blog entries is handled through EE.

This allows you to use categories and tags without Structure interfering, and without the need for other plug-ins. Although those plug-ins are top-notch.

Again, a number of ways to skin that cat with EE.

---
Tags: ee2, templates, structure
---


# Question
Title: Upgraded 2.1.3 to 2.5.3 and now can't access the CP
upgraded a site from 2.1.3 to 2.5.3 and once the upgrade successfully completed I tried to access the CP and get a blank page.

I checked .htaccess and found an old method for removing index.php

```
RewriteEngine on
RewriteCond $1 !^(favicon\.ico|info\.php|index\.php|path\.php|php\.ini) [NC]
# Exclude EE folders
RewriteCond $1 !^(system|images|img|fr|themes|media)/ [NC]
# Exclude 3rd party folders
RewriteCond $1 !^(css|js|uploads|ca_en|ca_fr)/ [NC]
# Remove index.php
RewriteRule ^(.*)$ /index.php/$1 [L]

```

which I commented out and replaced with the official method \- no change. The front end of the site loads fine, but I can't get into the backend. Any ideas?

# Answer
Okay,

So I also submitted an urgent ticket with EllisLab and found the issue after Dan Decker inspected. It turns out it was a legacy 3rd party module causing the problem. NDG Flexible Admin was installed, however you can't upgrade this without access to the CP since the name has now changed to Zoo Flexible Admin. The key was to go into phpmyadmin and delete all tables with ndg in them. Once I did this I could access the CP again.

Now I have to re-create the menus I had before, but that shouldn't be too much trouble as I have a backup site I can look at. The key here is if you are upgrading an old site running ndg flexible admin, upgrade that addon before upgrading EE.
> 2 votes

# Answer
I usually document this stuff on my own (for the next time) so I'm racking my brain trying to remember. However, I think for me, there was an add-on (probably accessory) that wasn't compatible, and it blanked the whole thing out. I ended up disabling until it started working. You might just update all of your stuff to see if that helps.
> 8 votes

# Answer
Check the settings in the database and config files for the path to the themes directory. That used to get me all the time.
> 2 votes

# Answer
Is the system path in admin.php different from index.php? Another option is to set PHP error reporting on admin.php and see if you catch any exceptions

```
error_reporting(E_ALL);

```
> 2 votes

---
Tags: ee2, upgrade
---


# Question
Title: How to add cache headers to EE responses?
I have found that caching templates has greatly improved performance. But how can I further improve performance by having EE include cache headers to prevent the browser making the same requests time after time?

Ideally I would like to explicitly mark the templates where this is acceptable.

# Answer
> 4 votes
I don't think there are any add-ons available currently modify the headers for caching. There is, however, HTTP Header, by Rob Sanchez that you could use as a basis to do this.

It wouldn't be very difficult to modify HTTP Header to include additional header options, or you could turn on PHP for your templates and place the code directly in the templates, but I'd suggest the plugin route.

The CodeIgniter output class has a built-in method for setting headers, which can be accessed from a plugin like this:

```
$this->output->set_header("Cache-Control: somevalue");
$this->output->set_header("Expires: somevalue");

```

# Answer
> 0 votes
My general advice would be to forego EE's native caching and turn to something a little more powerful like CE Cache: http://devot-ee.com/add-ons/ce-cache which gives you a host of options as far as caching is concerned, including static page caching. It's one of those add-ons where once you used it, you wonder how you got along before :)

---
Tags: templates, cache, caching
---


title: Use core EE class in an add-on

text:
# Question
Title: Use core EE class in an add-on
I've got a custom plugin that I'm using to do some PHP work for a project.

I'm looking for a way to run some of the category methods in the `Admin_content` class. Are add-ons able to use this class? If so, how?

Basically, I want to run the re-order categories (alphabetically) functionality outside of the CP, inside my add-on.

# Answer
Admin\_content extends the CI\_Controller class, which is not designed to be instantiated like models and libraries within the MVC paradigm. You can however reuse the libraries within that controller. Unfortunately, the best method here may be to copy and paste your code into your own add-on do what you need. Obviously only copying the bare minimum amount of code needed. And of course, if you can do it without copying, that's always best.

You really have 3 options, none of which do entirely what you want. But this is at least something to get you in the right direction.

1. Use the Category Model

`$this->EE->load->model('category_model');`
2. Use the Category API

```
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_categories');

$category_tree = $this->EE->api_channel_categories->category_tree($cat_group = 1);

```
3. Use Channel Data

https://github.com/objectivehtml/Channel-Data
> 7 votes

---
Tags: categories, plugin
---


title: How do you do HTML tables?

text:
# Question
Title: How do you do HTML tables?
I wonder how you guys do tables in ExpressionEngine? Sometimes there's a clear need for tables - semantically.

Matrix is not an option since it can only have a predefined amount of columns.

I used markdown tables, but most of the time I don't need a header. The only usable thing I found was textile tables, but I want to get rid of textile and use markdown wherever I can.

Any ideas? cheers stefan

# Answer
**Content Elements** contains an option for tables that lets the user create columns on the fly. Haven't tried it yet but it looks pretty awesome and seems to have useful template tags for the table element.
> 16 votes

# Answer
Email support\[at\]objectivehtml.com. I have a new add-on that I have been developing since Spring 2012 that does exactly this. Like everything I build, its focus is on a rock solid and configurable API. It's still not ready for a public release, but it's used on a number of our clients' sites (in production). I am happy to let you install it and give it a shot to see if fits your needs.
> 15 votes

# Answer
The Redactor.js has a nice table builder if you want a WYSIWYG field type.

You can demo it here: http://imperavi.com/redactor/

All of the Redactor field types should come with this feature:
> 4 votes

# Answer
Are you talking about using tables as a fieldtype? There's no table fieldtype in EE, but you can use Wygwam and configure it to show the options for building a free-form table in the editor.
> 3 votes

---
Tags: .html, table
---


# Question
Title: Repeating entries within a Structure tree
I'm trying to create a category-like hierarchy using only Structure, but am having issues with the requirement of each entry having a unique url\_title.

For example...

```
Category1
  Sub1
    Item1
    Item2
    Item3
  Sub2
    Item4
    Item5
    Item6

Category2
  Sub1
    Item7
    Item8
    Item9
  Sub2
    Item10
    Item11
    Item12

```

The issue is that Sub1 and Sub2 have to have unique url\_titles, which effects the URL.

I realize this is not a Structure-only issue, it's essentially EE's limit, but the Structure tree in the CP - organized as above - is so easy for clients to manage, I prefer to go this way instead of using categories. And, I can simply use {exp:structure:nav} to output the entire listing.

Is there a way to allow Sub1 and Sub2 to exist as '/sub1/' and '/sub2/' but be used throughout the Structure tree, across multiple Categories (ie: Category1, Category2, Category3, etc.)?

# Answer
In EE, all pages require unique URL Titles. However, in Structure, if the pages have different parents, they can share the same Structure PAGE URI.

In your case, so long as you are using the full Structure URIs to display the pages, you shouldn't have any issue reusing "sub1" and "sub2" in each category tree.

So while EE will create unique URL titles for each entry, such as sub1, sub1-1, sub1-2, sub1-3, etc, it won't matter, because in your templates, you will use dynamic="no", and simply allow Structure to render the page based on the full Structure URI. For example, your rules would look like:

/category1/sub1/page-title/

/category2/sub1/page-title/

/category3/sub1/page-title/

Should work fine, and without Freebie.

Let me know if you need clarification.

* Ira @ The Red Eye
> 9 votes

# Answer
I had a need for this same usage. Here is what I ended up with that really helped in my situation. With mine, there were multiple markets which had similar software packages. They wanted to :

* Distinguish the markets and keep them separate
* List the software by the same name in the URL (Which was the entry)
* Maintain a single entry for all changes to copy for marketing

I created a fieldtype that was a simple checkbox which was named, in this case 'Universal Product?' =\> 'prod\_universal', which when selected, would trigger the embed of the common entry.

I had to rethink my main template and create a router of sorts. I had a section for the menu(nav), body, and footer. In the body, it would start like this:

```
<!-- MAIN BODY -->
    {if prod_universal}
        <!-- Universal Product -->
        {embed="group/template" universal_title="{title}" entry_id="{entry_id}"}

```

This then embed the template needed for that entry. (Nothing major, just handled differently)

I was then able to use the Structure navigation as normal like:

```
{exp:structure:nav_sub start_from="/market" css_class="subnav" status="not No Nav"}

```

But when the regular (routing) template saw that the entry was universal, it was routed through the other template pulling the common entry.

As far as the same URL issue, that is all handled by the URL building and routing operations done from within Structure. the normal EE URL's can be whatever1, whatever2, whatever3... Just click on the structure tab and name them the same. Now they will traverse the same in the nav bar and read the same in the navigation.

Hope this helps.
> 1 votes

# Answer
I'm not *quite* sure what you're trying to do - but I suggest you have a look at this add-on: Freebie http://devot-ee.com/add-ons/freebie \- a lot of devs use this to make the url structure more flexible.
> 0 votes

---
Tags: categories, structure
---


# Question
Title: Can’t seem to use Playa fields correctly in Zoo:Visitor Member Details
I’m having an issue getting my Playa fields to render properly inside of a `{exp:zoo_visitor:details}` tag.

```
{exp:channel:entries
 channel="implementation_notes"
 disable="categories|category_fields|member_data|pagination|trackbacks"
 dynamic="off"
 search:implementation_note_segment="{embed:segment_entry_id}"
 author_id="NOT_CURRENT_USER"
}
<div class="implementation-note">
 <header>
  {exp:zoo_visitor:details member_id="{author_id}"}
   <p>{school}{title}{/school}</p>
   <p><b>Classes</b>: {visitor:member_classes}{class}{title}{/class}, {grade_level:label}{/visitor:member_classes}</p>
  {/exp:zoo_visitor:details}
  <p class="time">{entry_date format="%l, %F %j, %Y at %g:%i %a"}</p>
 </header>

</div>
{/exp:channel:entries}

```

The fields `{school}` and `{class}` are not rendering the title for the Playa children, but rather the title of the current implementation\_note channel entry. If I try adding visitor: to the playa field, I get the exact same issue. I can get the data as it’s presented in the field in the db by using *just* the field name, but that gives me the usual Playa string of information that is unusable on the front end.

This is already inside of one embed, I’d really rather not make a separate embed for these children. Am I crazy, and just missing something simple here?

# Answer
It looks like the problem here is that `{exp:zoo_visitor:details}` is actually a channel entry unto itself. I placed it inside of its own embed, and it worked like magic. The next step is going to be getting it out of this embed and into a Stash template.

The other problem that I had was simple user error. I forgot that `{school}` was actually `{member_school}`. Oy.
> 2 votes

# Answer
I don't use Playa very much but don't you have to use the {exp:playa:children} tag?

```
  {exp:playa:children field="school"}
    {title}
  {/exp:playa:children}

```

**Playa Docs:**
http://pixelandtonic.com/playa/docs/templates#playa:children

---

If you are sure the tags are correct, try adding parse="inward" parameter to your zoo\_visitor or Playa tag.
> 0 votes

---
Tags: add-on, playa, zoo-visitor, member-details
---


# Question
Title: How can I use Expresso Store Search within dropdowns?
Is there a way to create the following menu with Expresso Store search tag. I can't seem to get my head around how to do this. I really need a simple way to start filtering products. Very confused.

```
<select name="range:regular_price">
    <option value="">All</option>
    <option value=";99">$0.00 - $99.99</option>
    <option value="100;199">$100.00 - $199.99</option>
    <option value="200;399">$200.00 - $399.99</option>
    <option value="400;799">$400.00 - $799.99</option>
    <option value="800;">$800.00 and over</option>
</select>

{exp:store:search channel="products" search:price:min="0" search:price:max="99"}

```

Hi folks. I'm so stinken confused with this. Here's an image of what I'm trying to do with the Expresso Store module. I really want to have a dropdown menu to filter results. I would love it to refresh on the same page. I would even be OK if it used a submit button for the refresh. Is there any easy way to do this. I apologize for my lack of knowledge. Really struggling ;(

# Answer
> 7 votes
Going off Adrian’s comment, this is how I would approach it. I haven’t used Expresso Store (yet) so I can’t give you the exact code. But hopefully it will get you going in the right direction?

I would take your form and update it like this:

```
<select name="range:regular_price">
  <option value="/products">All</option>
  <option value="/products/price/-/99">$0.00 - $99.99</option>
  <option value="/products/price/100/200">$100.00 - $199.99</option>
  <option value="/products/price/200/399">$200.00 - $399.99</option>
  <option value="/products/price/400/800">$400.00 - $799.99</option>
  <option value="/products/price/800/10000">$800.00 and over</option>
</select>

```

You’ll need to add some javascript to the part to make it update upon selection, such as (sorry, my JavaScript isn’t the best… - I can't figure out how to put that into SE, so here is a link). Basically, every time the user changes the dropdown, redirect to the appropriate URL.

You could also just use standard `<a>` links to get the user to the correct URL.

Then I would have a template in the Products folder called “price” (or you could call it “filter” if you already have one). Pass the prices through to the search tag as segment variables:

```
{exp:store:search channel="products" search:price:min="{segment_3}" search:price:max="{segment_4}"}

```

Then proceed with the rest of the code to display the results.

---
Tags: add-on, ee2, expresso-store
---


# Question
Title: Zoo Visitor not sending forgot password email
I have a basic zoo visitor forgot password form and the email's aren't being sent out.

```
        {exp:zoo_visitor:forgot_password error_handling="inline"}
        {if password_sent}
            <h3>A password reset email has been sent to the provided email.</h3>
        {if:else}
            <fieldset>
            <p>
                <label for="email" class="form-label">Your email:</label>
                <input type="text" name="email" id="email" class="form-text" value="" />
                <input type="submit" value="Retrieve password" class="button" />
            </p>
            {error:email}
            </fieldset>
        {/if}
    {/exp:zoo_visitor:forgot_password}

```

Emails are being sent from the member registration form so i've ruled out server issues. Any ideas?

# Answer
It's possible that all the emails are getting blocked by the ISP spam. Emails sent with PHP are very unreliable in the long run, and why services like SendGrid and Mandrill are so useful. One recommendation would be to try to send your emails using a proper service. SendGrid and Mandrill both have free accounts, and you get like 12,000 emails a month (so it's free for most of our clients).

I helped Christopher track the issues down before, but I can't 100% remember what he concluded. Postmaster is always a viable option to sending forgot password forms with SendGrid or Mandrill, but it's possible to use SMTP and do it without Postmaster.
> 3 votes

# Answer
Have you tried it without your conditional statement?
> 0 votes

---
Tags: zoo-visitor
---


title: issue with fixed_order and embed query

text:
# Question
Title: issue with fixed_order and embed query
I’m having some issues with the fixed\_order parameter.

I’m running a query to order by a matrix col

```
{embed="_includes/_ajax_results"
    entry_ids="{exp:query sql="SELECT entry_id FROM exp_channel_titles
        INNER JOIN exp_matrix_data using(entry_id)
        WHERE channel_id ='4'
        AND field_id ='13'
        AND status ='open'
        ORDER BY col_id_21 DESC "}{entry_id}|{/exp:query}"}

```

If I head to my embed template… and print {embed:entry\_ids} I get my list of entry\_ids in the correct order I need them

```
90|94|89|91|95|93|86|92|87|88|79|

```

However as soon as I use this in a channel tag, it gets ignored and the order reverts to the default date order.

```
{exp:channel:entries
 channel="strand"
 dynamic="no"
 disable="member_data|pagination"
 cache="no"
 fixed_order="{embed:entry_ids}"}

   {strand-overview}

{/exp:channel:entries}

```

If i hard code my entry\_id embed into the param, the order works…

```
{exp:channel:entries
 channel="strand"
 dynamic="no"
 disable="member_data|pagination"
 cache="no"
 fixed_order="90|94|89|91|95|93|86|92|87|88|79|"}
   {strand-overview}
{/exp:channel:entries}

```

so for some reason my {embed:entry\_ids} isn’t working… Any ideas?

EE 2.5.3

# Answer
> 2 votes
I suspect it has something to do with the parse order of the tags. Could you try adding `parse='inward'` to your `{exp:channel:entries}` tag.

You can check if it is embedding the values or the entire `{exp:query}` tag if you turn on template debugging and look at how the entries tag is parsed.

– Wouter

# Answer
> 1 votes
First check to make sure your query is printing correctly outside of the embed code.

If it is returning results correctly, next look at your quotes. Try removing the quotes for the entry\_ids parameter, so `entry_ids="QUERY"` becomes `entry_ids=QUERY`.

---
Tags: embeds, query
---


# Question
Title: Simple channel entries call, limit by category, not working
Simple as can be, my code, but I am getting all the entries, not just those in category 42.

```
{exp:channel:entries channel="patient-services"
disable="member_data|pagination"
dynamic="no" sort="asc" orderby="title" category="42"}
    <li><a href="{url_title_path=patient-services}">
    {title}
</a></li>
{/exp:channel:entries}

```

**UPDATE** I stripped it down to this, but it's showing that every entry is in category 42, even though the CP shows otherwise. Maybe I hit a bug?

```
{exp:channel:entries id="18" dynamic="no" category="42"}
    <li><a href="{url_title_path=patient-services}">{title}</a>Category id
    is: {categories}{category_id}{/categories}</li>
{/exp:channel:entries}

```

# Answer
> 2 votes
Your code is correct so I'd start troubleshooting with these three things:

1. Make sure your channel short name is correct (copy and paste it to be sure)
2. Make sure your category id is correct
3. Add dynamic="no" parameter to your channel:entries tag
4. **EDIT** Check your URL paths. A entries tag can seemingly misbehave if you have a misspelling in the template name. Let's say your template is /blog/entry but you are calling /blog/entryy by mistake. EE will not find the "entryy" template because it doesn't exist and so will try to load the index template in the blog template group instead. A good test would be to create a "test" template group and insert your code into that index template. If it works here, then something related to the URL may be in play.

---
Tags: channel-entries
---


# Question
Title: Safecracker Registration, Zoo Visitor, Profile:Edit - not Matrix compatible?
I'm looking into developing a membership site using Membrr (http://www.membrr.com). The member details I want to store require line item entries, such as:

```
1 hour, Web Development, $100
1 hour, Web Design, $125

```

In order to support line item entries, I think I need to get Matrix.

Now, in order for my member fields to use Channels, I think I need to use Safecracker Registration, Zoo Visitor or Profile:Edit. However, none of them are listed as "Matrix compatible" on Devot-ee site.

Am I on the wrong path? Is what I'm wanting to do impossible?

Also, any suggestions to do membership other than using Membrr? The addon is a bit expensive.

# Answer
You are on the right track moving member functionality into channels. It gives you infinite control over what you need to set up and you can use fieldtypes that aren't available with native member fields.

As of today, Membrr is the only addon for setting up subscriptions of which I'm aware. BUT... **CartThrob** is on the verge of launching an update to their store module and it will include an additional subscription addon that you can also buy for an additional price. It might even be released this week... there were some pages up on their site yesterday that indicated it was coming very soon... those pages are now off the site though from what I understand.

If you don't need to make a decision today, I'd wait till early next week to see if the CartThrob version is released and then compare the addons.

With that said... The cost of CartThrob and the additional Subscription addon will be more expensive than Membrr. I've heard some grumblings about Membrr being difficult to work with... but I haven't used it myself... It's possible that paying the extra money will save you lots of development time. I just don't know. CartThrob has a history of putting out a solid and extendable cart so I'm sure their Subscription addon will be the same. The docs can be a little dense (because it can do a ton) but they may be refreshing those too with this new version launch.
> 4 votes

# Answer
You can definitely use Matrix with all of these add-ons. The all use Safecracker at the core, which is compatible with pretty much all fieldtypes (unless the developer did something to make it not work).

That "Matrix compatibility" setting is rather new on Devot:ee, so I would be willing to bet the other developer over looked it, as I did. I just updated my page on Safecracker Registration to display Matrix compatibility, thanks for pointing that out.
> 5 votes

---
Tags: matrix, zoo-visitor
---


# Question
Title: Is there a way to add logic operand to the search parameter?
I am looking for a way to isolate entries based on a {event\_time\_start} and {event\_time\_end} custom field. For instance the first one contains 930 as a value and the second one 1200 meaning the event start at 9:30 and ends à 12:00.

I am trying to display which event is on right now by doing something like :

**search:event\_time\_start="\<930" search:event\_time\_end="\>1200"**

But this outputs sweet nothing. I had a look at this entry about the search param and I see there is no support for \< and \> but I was wondering if an extension / add-on / something would support add this feature.

# Answer
I would check out Low Search, you should be able to search by range on a custom field. Solspace's Super Search is another option, but it's a bit pricier.
> 4 votes

# Answer
There is no add-on to add support for this since there is no way to hook into that particular part of the channel-module by means of an extension-hook.

There used to be a solution for EE1 made by (I believe) Mark Huot, but that required hacking the EE code directly... which is not advisable.

– Wouter
> 1 votes

# Answer
It might be possible to use a snippet that checks the search range and returns a bool. This way you can run the range through whatever query you need.
> 0 votes

---
Tags: add-on, ee2, templates, channel-entries
---


# Question
Title: Specifying currency on a per-product basis in CartThrob
I've got a site where each product will be sold in either Pounds or Euros (depending on the supplier of the product). How would I go about specifying the currency on a per-product basis in CartThrob?

I'm looking through the CartThrob settings but it seems geared up for specifying a single currency for the entire site.

# Answer
You should be able to use the set config tag if you have two different price fields, e.g.

```
{exp:cartthrob:set_config}
{if euro_price_field}
{set_price_field channel="products" field="euro_price_field"}
{if:else}
{set_price_field channel="products" field="pounds_price_field"}
{/if}
{/exp:cartthrob:set_config}

```
> 2 votes

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


title: Expresso Store Buy Now Button

text:
# Question
Title: Expresso Store Buy Now Button
On my product page I want to have a single button that combines 'add to cart' and 'checkout'. I'm finding the documentation a bit hard to follow. Currently my button looks like this and just adds the item to the cart:

```
<input type="submit" name="submit" value="Add To Cart" class="btn btn-primary" />

```

# Answer
> 1 votes
You can add a return parameter to your product opening tag to force the user to a specific page when they add the item to the cart.

```
{exp:store:product entry_id="{entry_id}" return="checkout/template"}
 <input type="submit" name="submit" value="Checkout Now" class="btn btn-primary" />
{/exp:store:product}

```

Since you control the entire process you can direct them to your checkout templates. You can not however send them to the gateway automatically when they add an item to the cart. So you could not have a user add an item to the cart and direct them to PayPal automatically.

---
Tags: expresso-store
---


# Question
Title: Zoo Flexible Admin + MSM Needs Hard Refresh - how to avoid?
This is based on this Support Thread: http://devot-ee.com/add-ons/support/zoo-flexible-admin/viewthread/4202

In short: the menu in MSM doesn't change without HARD refreshes every time.

It looks like no one has managed to crack this nut yet and it's partially due to the ExpiresHeader, but I have no idea how to exclude a certain path by the expires header rule or any other way.

Thoughts? Client keeps emailing me saying she can't find things due to switching sites -- irony, since the Flexible Admin is meant to make it easier.

# Answer
> 6 votes
I suspect that you're running into an issue whereby your server sets content expiry headers for javascript and that's resulting in the addon's output being cached. I recently submitted a bug report for this issue, with the proposed fix being to explicitly set a `no-cache` header for javascript generated via the `cp_js_end` hook. The fix has been accepted for a future release but who knows when that will be. In the meantime you can apply it manually:

Open up controllers/cp/javascript.php and locate the `_ext_scripts()` function. Within that function locate this line:

```
$this->output->set_header("Content-Type: text/javascript");

```

Immediately underneath it add this:

```
$this->output->set_header("Cache-Control: no-cache, must-revalidate");

```

This will override your default headers and should ensure that a fresh copy of the `ext_scripts` output is retrieved with each page request.

# Answer
> 3 votes
Is the ExpiresByType an htaccess rule you've added via HTML5 Boilerplate or something similar? I'd just comment it out. If it's from EE or an addon, try overriding it via an htaccess file that is closer to the files in question.

E.g., public\_html/control\_panel/.htaccess will be trump public\_html/.htaccess

The files are cached by type so I don't think you can manually override a specific path.

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


# Question
Title: Development: how to know current site selected in Control Panel
I'm developing a custom extension that should work also in Control Panel. In an EE MSM environment I need to know which site is selected (site\_id). Is there any variabile?

I can't find anything in EE Development Doc.

# Answer
```
$this->EE->config->item('site_id');

```

Or

```
config_item('site_id');

```
> 20 votes

---
Tags: extension, multi-site-manager, development
---


title: Autocomplete Field Type?

text:
# Question
Title: Autocomplete Field Type?
Is there a way to have a field with autocomplete values that are based on the input from another field? The values would be a result of previously entered data in the Channels (along with some other custom logic possibly). Is there an addon for this already? Or a native way to do this in EE?

# Answer
Have you looked at the Suggest Field fieldtype? It uses previous values entered in the same field (previous entries), but it could be easily modified to look at another field instead.
> 5 votes

# Answer
Your best bet is probably going to be to develop your own Fieldtype add-on. Using Pkg.io to generate the boilerplate will kickstart the process for you.

That said, if you want to use an existing add-on then Playa could come close to what you need. It has autocomplete when using single-select mode. The multiple-select mode (called drop panes) has match-anywhere filtering using a search input built right into the field. And you have a lot of control over what channel entries are available in the field by pulling entries only from specific channels, statuses, authors, and/or categories.

Update: Even better, see the answer posted by Derek to check out the Suggest Field!
> 1 votes

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


# Question
Title: Where Can I Adjust CSS for this Menu Option?
I'm using Expresso by Put Your Lights On. The issue we are having is demonstrated in the image below. When a pop-up window is generated to add links, images, etc. The entered text is partially cut off, because either the field box is too small or the text is too big.

I'm more than willing to edit this myself, but I can't seem to find where and what is controlling the input field size. I'm using:

I'm just not certain which item, would control the input field size for this. Is it the basic EE CSS, Espresso, Responsive CP or somewhere else. The expresso.css file does not seem to contain the info, I need to modify.

# Answer
Chrome's Inspector should be your best-friend. Inspect the element (right-click on it and click "Inspect Element"), go to "Computed Style", find the height and toggle it down to see the source-file.
> 3 votes

# Answer
First step would be to make sure your browser isn't zoomed in on the text by resetting the zoom level. Here are FireFox instructions:
http://support.mozilla.org/en-US/kb/font-size-and-zoom-increase-size-of-web-pages

---

If you want to inject custom CSS into the CP, you can use this **CP CSS & JS** extension to do so.

---

Using your browser's inspect tool will help you track down the exact CSS and CSS file causing the issue if it's a CSS problem.
> 2 votes

---
Tags: css, wysiwyg, expresso-toolbar
---


# Question
Title: Are there alternatives to MSM for running multiple sites / sharing channels & templates across sites
Are there other options for EE MSM? I'd like to use MSM, but the licensing restrictions that EE places on it won't allow me to do it. For example, I wanted to develop real estate agent website and sell it to several real estate agents. I'd like to reuse Channels, Templates, etc. across the sites. Apparently, that's not allowed by EE since MSM needs to only manage sites that are owned by the same entity. Leasing the sites (so that I remain the owner) is also not allowed.

If I have 20 sites and want to change an h1 to an h2 in one of my templates, I don't want to have to do it in 20 sites. I want to do it from one place. I can't use EE MSM. What are my choices?

# Answer
Bluntly: **not many**. There are no software alternatives to the MSM available that I know of. Further if they did exist, I strongly doubt that they would be compatible with the core EE license, specifically:

> An ExpressionEngine license purchase **allows a single “live” installation in a production environment** and ancillary “development use only” installations as needed to support the live installation (such as development and a staging servers). **Additional installations require additional license purchases**. If you have specific installation needs not covered by this license, please Contact Us.

Furthermore the license also states:

> Unless you have been granted prior, written consent from EllisLab, Inc., you may not:
>
> * Reproduce, distribute, or transfer the Software, or portions thereof, to any third party.
> * **Sell, rent, lease, assign, or sublet the Software or portions thereof.**
> * Grant rights to any other person.

*(Emphasis mine)*

The only extension/exception to this is if you purchase the MSM.

However, **if you are willing to purchase a separate EE license for each of your sites, but want to share template code between them**, you could easily manage that at the file level, either via symlinks (if all sites on the same server) or via site specific branches in a Git repository. Though that doesn't resolve the shared schema/fields/channels issue.

There are a number of experimental addons/products that seek to address that issue in varying ways (eg NSM Site Generator & Site Manager), but none (that I'm aware of) that are production ready.

Lastly. in my experience EE **is not the best choice for a SaaS, multi-instance application** for precisely the reason that channels and fields are implemented as DB data not as part of the schema. That makes for great flexibility and rapid development, but it also makes sharing site structure across installs much more difficult that with a lower level framework.
> 6 votes

# Answer
depending on how you want to setup your server, you may be able to save templates as files and then symlink your template directory so that the same template groups/files are used throughout your sites.

All of your sites would need to be on the same server of course.
> 1 votes

# Answer
I've setup multiple sites from the same install without MSM, it can be done and this was mentioned in the wiki. These are now unreachable with the new site :-( It is also unsupported and has a few glitches:

* Unable to save template as files
* No way to separate mailing lists (but this is with MSM the same) and a few more things (which I don't recall I'm afraid).

But here it goes:

Copy index.php from the ee root to the folder from the site (setup with DNS on the same server)

Change:

> $system\_path = 'absolute path to ee system folder';

At ‘CUSTOM CONFIG VALUES’:

> $assign\_to\_config\['template\_group'\] = 'name off the template group'; $assign\_to\_config\['template'\] = 'index'; //name of the start template

Lately I've been using MSM, because its better supported with add ons like wygwam, assets etc.
> 1 votes

# Answer
Unfortunately this isn't really possible. In this case I would recommend looking at a different CMS that has a more compatible licensing scheme for your particular project.
> 1 votes

---
Tags: multi-site-manager, licensing
---


# Question
Title: Exp:resso Store not returning to correct URL from PayPal
EE 2.5.3 and Store 1.6.1

I have an issue where it looks like PayPal is not returning the customer to the correct specific Exp:resso Store order confirmation page after successful PayPal Express payment. This is odd as I tested this installation with no problem, it seems to have just recently started occurring. It happens with either PayPal account payment or credit/debit card. The page where it returns the customer to is (wrongly) http://www.example.com/about . The PayPal account 'Auto Return' setting is 'off' as I suspect the return URL should be passed to PayPal by Store.

Here is the EE template code for the final /checkout3 page before transfer to PayPal:

```
{exp:store:checkout
    form_class="form-horizontal"
    return="music/order/ORDER_HASH"
    error_handling="inline"
    payment_method="paypal_express"
    error_delimiters='<span class="help-inline">|</span>'}...

```

Here is the code generated:

```
<form action="http://www.example.com/music/checkout3"; method="post" id="" name="" class="form-horizontal" data-order-total="10" >
<div style="margin:0;padding:0;display:inline;">
<input type="hidden" name="return_url" value="music/order/ORDER_HASH" />
<input type="hidden" name="payment_method" value="paypal_express" />
<input type="hidden" name="ACT" value="20" />
<input type="hidden" name="RET" value="music/checkout3" /> ...

```

Thanks a million for any help!

# Answer
There was a stray 301 Redirect on /music/order/ in the .htaccess file which was sending the customer back to the wrong page after successful PayPal submission.
> 3 votes

# Answer
Try adding the domain to your return\_url variable:

```
<input type="hidden" name="return_url" value="http://www.example.com/music/order/ORDER_HASH" />

```
> 1 votes

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


# Question
Title: Creating a Typekit search functionality with EE and Solspace Super Search
Typekit has a nice dynamic search feature on their site which i would like to try and include in a project i am working on, www.typekit.com/fonts.

I don't mean the search box with the auto suggest, i am referring to the sidebar on the right

I have used Super Search by Solspace before and thought it would be a suitable add-on to use.

I am going to have 2 groups that i need to search / filter by, these are 'Country' and 'Sector' So it would be like Typekit have it, just with 2 filter sections

If anyone could shed any light on how this would work and/or how i may go about this, that would be great.

Thanks

# Answer
> 2 votes
This tutorial might get you started http://blog.aaronmbushnell.com/post/23434803999/creating-an-ajax-filter-using-solspace-super-search

If it's just 2 groups you might also consider using dynamic parameters: http://ellislab.com/expressionengine/user-guide/modules/channel/dynamic\_parameters.html

---
Tags: ee2, ajax, search, supersearch
---


title: Conditionally load JavaScript

text:
# Question
Title: Conditionally load JavaScript
I wish to load some javascript in the footer, but only if a certain condition is met. I was wondering what the best option might be for this?

For example, if an entry has some related entries further up the page, then add the javascript in the footer.

The reason being that i don't want to include the javascript on every page.

# Answer
Something like SWITCHEE would be useful to sort out conditionals without the information being loaded unless the condition is met. It is a little bit better than a straight conditional because the native if..then still looks for the item, just doesn't load it in.

```
{exp:switchee variable="{condition}" parse="inward"}
  {case value="x"}
     load js file
  {/case}
  {case value="y"}
     another js file
  {/case}
{/exp:switchee}

```
> 2 votes

# Answer
Take a look at the **String** or **Variables** plugins. Should do the trick.

> The **String plugin** allows you to create and manipulate variables in your templates. This plugin is designed to take advantage of ExpressionEngine's unique way of parsing templates. Because the main template is executed to completion before any embedded templates are processed this plugin can be used to create a variable in the main template and output the value of the string in any embedded template... even an embedded page header template that comes before the point where you built the string!

or

> The **Variables plugin** gives the possibility to create variables (either static or dynamic) and use them later on. This means that for example you can set certain data and use it in the head (if it's embedded) without having to re-create a tag pair for the specific channel.
> 2 votes

# Answer
Inside your entries tag perform a conditional looking for those related entries. Wrap it in a stash tag.

Then in your footer call the stash.

This should work. I'm a little unfamiliar with stash so can't give you a code sample guaranteed to work.
> 0 votes

---
Tags: javascript
---


# Question
Title: Difference between quoted and unquoted comparison syntax
In general, when comparing variables in templates, I use unquoted variable names. e.g.,

```
{if segment_3 == category_url_title}

```

If comparing to an actual value (not a variable), I quote the value. e.g.,

```
{if count == "1"}

```

But in some cases (within a Matrix or Playa field, for instance), the comparisons only work if you quote the parsed variable. e.g.,

```
{if "{row_count}" == "{total_rows}"}

```

So my questions is - why is this? Does it have to do with strings containing spaces vs those that are space-free (like segment variables, integers, and booleans)? Often it just seems random, which I don't like.

I've also read that there is a performance hit when comparing using quoted vs unquoted syntax. Any truth to this?

# Answer
As I have noticed a lot, you mainly have to use quoted values when working with third party modules/plugins.

I believe it has something to with the fact that not all developers call the `prep_conditionals` method in their code, so the values are parsed by the method that also replaces the normal tags in your template (not in conditionals).

If you look at the `prep_conditionals`-method it internally adds the quotes around values and `!= false` when using a boolean check (no 2nd part in your conditional) before the template parser is called.

So I generally use the 'clean' version when working with EE native values, but add quotes when working with third party values.

– Wouter
> 13 votes

# Answer
Using quotes makes it an advanced conditional which has a different parse order than simple conditionals.

This is a simple conditional.

```
{if segment_2 == "category"}

```

While this is parsed as an advanced conditional.

```
{if "{segment_2}" == "category"}

```

I think that explains why you have to put quotes around the P&T variables. Basic conditionals are parsed before module and plugin tags, so the value of {total\_rows} won't be determined in time.

Advanced conditionals are parsed after module and plugin tags, so by then you'll know the value of {total\_rows}.

More on conditionals here.

Here is more on parse order from the parse order master.
> 21 votes

# Answer
Here is a FAQ on it - from the Wayback machine:

http://web.archive.org/web/20101020213825/http://expressionengine.com/forums/viewthread/130537/

I link to it because there is a security factor when you have quoted and braced conditionals:

> 5) Are you comparing a quoted variable to a value? This is not supported and depending on the source of the variable, may even have security implications. By doing this, you are allowing the tag that “owns” that variable to parse and replace it with its unfiltered contents. Doing so is trusting that it has no bad characters, no javascript, and no need for error checking that is normally performed when the conditional is used with the proper syntax outline above. Unsupported, possible security risk: `{if "{custom_field}" == "foo"}`

So you want to be really careful with that syntax any time you have user input information (ie: segments!)

-Lisa Wess
Pixel & Tonic
> 6 votes

# Answer
When you put quotes around a variable/tag, the template parser first needs to parse the variables and then it will execute the conditional.

Module tags/variables (what do we call them these days?) always have to be done with quotes since the template parser first needs to parse the variable/tag to find out it's value.

This will force the conditional to be parsed at a later stage in the parse order. Otherwise known as: Advanced Conditionals
> 5 votes

# Answer
This is simply to do with parsing in my understanding. putting quotes around it seems to make a difference (from recollection during my days doing P&T Support) - however, I don't pretend to understand *why*.
> 2 votes

# Answer
My way: always single quoted!

{if '{my\_variabile}' == '1'}

{if '{segment\_3}' == '{category\_url\_title}' }

{if '{count}' == '{1}'}

It' about EE parsing order.
> 1 votes

# Answer
Interesting points. I'm not too sure on the reasoning behind it, but I personally take the stance that when comparing strings you should use quotation marks (as with PHP) and checking numerical or Boolean data should be without.

I wonder if this has anything to do with the parse order? Another possibility could be that these 'basic' data types have been developed so they automatically wrap a quotation mark when used in this context where as the Pixel & Tonic ones haven't been written in this way.

That's a stretch!
> 0 votes

---
Tags: comparison, ifelse, syntax, conditionals
---


# Question
Title: Allowing individual users to hide entries
I've got an Intranet with a list of job postings (each of which are channel entries), and I need to give each logged-in user the ability to click a button to hide an individual entry from their listings.

Each user has their own user profile channel entry (I'm using Profile:Edit for this), so I imagine that adding a custom field to their profile named 'My Hidden Entries' is the way to go. I'm thinking that a field which saves entry ID's in a pipe-separated list would be good, as it'd mean I can use them in a channel entries tag to hide their hidden entries (entry\_id="not {cf\_user\_hidden\_entries}"), as well as being able to use the opposite method to generate a list of entries a user has hidden (entry\_id="{cf\_user\_hidden\_entries}").

My question is, does this approach sound good? And if so, what fieldtype would you recommend to use that would save entry ID's in a custom field in this format, and allow me to easily add/remove entries from their list? It's the adding and removing of entries that I'm particularly concerned about, as this will be done outside the CP.

# Answer
To be honest, I would suggest using an addon like 'LikEE' which allows you to toggle an entry in some way. Obviously the natural suggestion is for 'liking' entries - however, you could use it whereby, you list the jobs and when a user 'likes' it - it's the indication to remove it.

Then inside your exp channel loop - simply do something like the following:

```
{exp:channel:entries .... }
    {exp:likee entry_id="{entry_id}"}
      {if "{like}"}
       // They've liked it, so don't do anything
      {if:else}
      // Put your job logic here
      {/if}
    {/exp:likee}
{/exp:channel:entries}

```

You might need to fiddle with the syntax - however, this would potentially be an easy way of doing it without messing with posting entries and channel updates etc.
> 4 votes

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


# Question
Title: How can I customise the publish/edit screens, or provide a custom UI for editing entries?
I'd like to provide my users a prettier UI to publish and edit/delete content (compared to what is provided by EE's control panel). For example, say I wanted to divide my entry form into tabs, etc. What are my options?

# Answer
You can build a custom "My Account" area in your EE templates to handle all editing of content. The primary addon you'd use is the **Safecracker Module**.

Here are some global variable conditionals you'll use a lot with a custom "My Account" area:

There is also **alternative syntax** for some of the above if you are trying to use the conditional inside a channel:entries tag... variable names get prefixed with "logged\_in\_"
> 1 votes

# Answer
You already can use tabs in your publish layout:

**Edit an entry \> click "show toolbar" \> add/remove tabs in this section:**

More info in the EE documentation: Publish Page Layouts
> 7 votes

# Answer
I've done this using an entry that uses Ajax calls via jQuery and SAEF. Basically just hold all the changes in a json string and pass them when everything is collected that you/they need.

I didn't use tabs though. I used modals and steps.
> 1 votes

# Answer
In addition to customizing the layout of the publish screen as per janvl's answer, you can have a look at one of the available third-party themes for the control panel.
> 1 votes

---
Tags: channel-entries, control-panel
---


# Question
Title: Better way to define "Date Published" field for channel field?
I would like to add a field called "Date Published" to a channel field group. Naturally I selected the "Date" field type but this is useless because:

* It takes too long to navigate to past years.
* It confuses the user by placing the time into the field.

Is there a way to improve upon this?

Note: It is important that it will be easy to perform a custom channel query that shows entries that are `>= N` years old.

# Answer
> 1 votes
I haven't used it, but maybe DropDate is what you need.

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


# Question
Title: Cart Throb - live rates and disable shipping
I am running CartThrob and using Live shipping rates. The problem I have run into is if I have one product in the cart and I have Shipping Disabled for that product the live rates plugin is still showing shipping options.

How do others get around this?

CartThrob 2.2.2 EE 2.5.3

```
Shipping: <select name="shipping_option">
{exp:cartthrob:get_shipping_options}
    <option value="{rate_short_name}" {selected}>{rate_title} - {price}</option>
{/exp:cartthrob:get_shipping_options}

```

# Answer
You might need to wrap your code for the live rates in a cart\_info tag and then check the value of shipping first, e.g.

```
 {exp:cartthrob:cart_info}
   {if cart_shipping>0}
       live rates code here
   {/if}
 {/exp:cartthrob:cart_info}

```
> 2 votes

---
Tags: cartthrob
---


# Question
Title: Should the channel data table have so many columns?
I have noticed that each custom field takes up 2 columns in the channel data table.

* The second column often seems to have little value.
* Existing columns do not seem to be recycled for new channel field groups with the same field type.

This seems like quite a wasteful design because:

* It increases the size of rows in other channels.
* Must surely come with various performance penalties (like full-text search perhaps).

Are there ways to optimize this? am I worrying unduly? what is the realistic maximum number of custom fields for an ExpressionEngine site?

# Answer
What you are seeing in this table is how EE handles data storage in the database. There isn't a way to change this data structure. The second column tells EE how to format the content in the main data column.

The structure of the table doesn't become an issue unless you have an enormous number of custom fields or a high traffic site with lots of data rows.

This post sheds some light on the **maximum number of EE custom fields** you can have in an install.

I've personally never had an issue with maxing out columns in that table during my 7+ year coding with EE.
> 3 votes

---
Tags: custom-fields, database, optimization
---


# Question
Title: Is there a way to define snippets in the index.php or config.php file?
I'd like to define snippets dynamically in the index.php file.

Is there a way to do this?

# Answer
You can't set up Snippets, but you can set up Global Variables in your config.php file.

Below is a code example from this blog post titled **ExpressionEngine config.php**.

```
$default_global_vars = array(

    // Tag parameters - Short hand tag params
    'global:disable_default'   => 'disable="categories|pagination|member_data"',
    'global:disable_all'       => 'disable="categories|custom_fields|member_data|pagination"',
    'global:cache'             => 'cache="yes" refresh="10"',
    '-global:cache'            => '-cache="yes" refresh="10"', // disable by adding a '-' to the front of the global

    // Date and time - Short hand date and time
    'global:date_time'          => '%g:%i %a',
    'global:date_short'         => '%F %d, %Y',
    'global:date_full'          => '%F %d %Y, %g:%i %a',
    'global:isipad'             => (bool) strpos($user_agent,'iPad'),
    'global:isiphone'           => (bool) strpos($user_agent,'iPhone')

);

// Make this global so we can add some of the config variables here
global $assign_to_config;

if(!isset($assign_to_config['global_vars'])) {
    $assign_to_config['global_vars'] = array();
}

$assign_to_config['global_vars'] = array_merge($assign_to_config['global_vars'], $default_global_vars, $env_global_vars);

```
> 7 votes

# Answer
No, you can't generate them dynamically but you can use Snippet Sync or Libraree to use snippets as files and port them into other projects.

I use Libraree as part of my base install with a couple base snippets for a header and footer that I carry through projects. Using config overrides (Focus Lab's Master Config) I set where to store the files and edit away when I set up new projects

```
// Libraree
$config['libraree_basepath'] = $base_path . '/../snippets/';

```
> 4 votes

---
Tags: php, config, snippets, dynamic
---


# Question
Title: Something similar to the Acronym module for EE 2?
Before I upgraded to EE 2, I used the Acronym module quite a bit on EE 1. Not so much for acronyms, but I used the fact that I could make convenient link shortcuts for frequently reused links with it. For example, I would define the acronym for a particular site as Site A-Link and I would set the text that it would replace to as Site A.

Are there any add-ons for EE 2 that could be used to accomplish something similar?

# Answer
> 1 votes
The **Shortcode** addon was just released today and may work. I posted the answer below for another SE question but it wasn't what he was looking for. It might do the trick for your scenario so I'm reposting the answer...

> **Shortcode** aims to allow for more dynamic use of content by authors and editors, allowing for injection of reusable bits of content or even whole pieces of functionality into any field in EE. Shortcode provides two types of codes for use in any content in EE: user-defined Macros specific to each author and each site, as well as a simple API for third-party plugins and modules to expose their tags through the shortcode Rich Text Editor dialog (or manual entry in any type of field) - complete with automatically rendered options forms.
>
> **Two Types of Codes**
>
> Macros - User defined, author and site specific bits of reusable content - basically just like Snippets but can they can be embedded directly in any field type by your content Editors!
>
> Shortcodes - Plugin/Module defined tags that can be injected into the middle of content, such as a ProForm form or other piece of functionality. This works similarly to the WordPress Shortcode API.
>
> **Features**
>
> Macros defined by each user for their own use - each author could have the same macros defined with the same names, with different values that are dynamically replaced based on the assigned author of an Entry.
>
> Macros defined by Super Admins for the entire site and usable in all content for each site (MSM compatible with separate sets of Macros for each site).
>
> Macros and Shortcodes can be inserted manually in any fieldtype, or automatically through the included Rich Text Editor tool.
>
> Simple Shortcode API that allows for any Plugin or Module to provide custom Shortcodes complete with automatically generated configuration dialogs
>
> Existing plugins and modules can be converted to shortcodes with very little code. Assistance in the forum is available for anyone who wants to add support to their own add-ons.
>
> Assistance writing glue code for existing plugins or modules is also available - just post a request for support for the plugin in the forum.

# Answer
> 0 votes
Wouldn't that be right up global variables or snippets' alley? You could do that with no need for any add-ons.

An answer to another question pointed out this addon which seems like it may be even closer to what you are trying to accomplish http://devot-ee.com/add-ons/crosslinking

---
Tags: add-on
---


# Question
Title: How to add a custom JavaScript to the "New Entry" control panel?
How can I add a custom script to the "New Entry" control panel page to interact with the input form. The script does not need to be added to the "Edit Entry" page and certainly should not be added to any other control panel pages within ExpressionEngine.

How is this achieved? Can I write an extension which utilises a particular hook?

# Answer
A quick solution is to pop the code into the field's instructions. It will show on adds/edits if you do that. You might be able to create a conditional based on the url to not run it on edits.

**EDIT:** Added screenshot
> 3 votes

# Answer
I'm not quite as trusting with the way the fields labels handles JavaScript over say the way it handles HTML which, by the way, handles nicely.

Anyways, I will add another option here for future reference as I think it could be helpful either way:

As I mentioned in a comment on another question you could write an extension which uses the cp\_js\_end hook

You said:

> The script does not need to be added to the "Edit Entry" page

But I assume you mean it *does need* to be added to the Publish Entry page.

If that is the case then what you could do is check if you are in fact on the publish entry page by using a conditional in your extension similar to this:

```
if ($this->EE->input->get_post('D') == "cp" && $this->EE->input->get_post('C') == "content_publish" && $this->EE->input->get_post('M') == "entry_form" )
{
    your code
}

```

(Not sure you need all three checks but you get the idea.)

What the code above is doing is checking for any query strings in the URL and if they match do something. Obviously it's just a start to get you going.

Also, check out this add-on from Pixel & Tonic if you want some ideas on how to use this particular hook (and or cp\_css\_end) in an extension. In fact, you could add my conditional strait to that add-on unless I'm reading the license wrong. The code I'm thinking of is around line 141 which you'd wrap my conditional example around that line.

The add-on: https://github.com/pixelandtonic/cp\_css\_js
> 5 votes

---
Tags: add-on, control-panel, javascript, extension
---


# Question
Title: Is there a way to search just a specific channel field without searching the title field?
Using ExpressionEngine 2's native search module, is there a way to search just a specific channel field without searching the title field? From what I can determine from the EE 2 docs, there are only 3 options with no way of keeping the title field from being searched.

quoted from EE docs:

1. entries: The search will be conducted in the entry fields and **titles** of your channel. The associated comments will not be included.
2. everywhere: The search will be conducted in the **title**, entry fields, and in associated comments.
3. titles: The search will be conducted in the **title** of your entries. The channel entry fields and any associated comments will not be included.

My client wants a search to look only within a tag/s entered within a custom channel field, and exclude a keywords from the title tag.

# Answer
I think you are right, that isn't possible with a core EE install. Low search and solspace's super search do that, but it also seems like this free add-on does it too in a very limited way: http://devot-ee.com/add-ons/search-fields
> 5 votes

---
Tags: search
---


# Question
Title: In EE Store, how to disable the add-to-cart button after a single stock item has been added to the cart
Assume my store sells unique items, like antiques. By definition, stock for each article is only one item. When a buyer adds such an item to their cart, store prevents them from adding more than one item to the cart, but does not reduce the stock (not until the item is sold) and does not prevent the add-to-cart button from being pushed again.

I would like to have a way to hide the button for this user while the item is in their cart, AND give some indication that a single item cannot be added more than once, even though the item is still in stock until it is sold. This is only needed in relation to the local terminal holding the item in the cart.

Is there a way to do this, natively or by whatever means?

# Answer
> 3 votes
It sounds like what you need to do is test how many of that particular SKU are currently in the customer's cart.

It's not possible to do this using native tags, however there is an extension on Devot:ee which appears to let you create conditionals on whether a product is currently in your cart:

See: Store: In\_Cart Conditionals

**UPDATE:** As of Store 1.6.2 there is a `{qty_in_cart}` variable which allows you to do this on a per-entry basis (though not if your entries contain multiple SKUs).

```
{exp:store:product entry_id="{entry_id}"}
    {qty_in_cart}
{/exp:store:product}

```

# Answer
> 0 votes
I'm trying to get this to work as well but not having any luck. Say I just used the following snippit of code

```
{store:entry_id_in_cart:{entry_id}

```

If the item is in the cart the output should be:

```
1

```

Is that correct?

Currently it just outputs the string "{store:entry\_id\_in\_cart:{entry\_id}" which makes me think that either I'm not using the code properly or I haven't installed the extension properly.

Thanks

---
Tags: expresso-store
---


# Question
Title: setting 'site_name' in config doesn't seem to work
Having read through this discussion Config Bootstrap Options, and settled on using the method described on nettuts here, I've got myself a base build for EE with all my usual addons etc. That's all working very nicely, with one annoying exception.

Setting `site_name` in config seems to have no effect what so ever!

```
$config['site_name'] = "Base ExpressionEngine Install";

```

Is there anything I'm doing wrong, or does this just not work? I've tried clearing the cache via the CP, but that made no difference.

These are just stand-alone sites, not MSM.

Here is the rest of my config file for reference:

```
<?php

if ( ! defined('EXT'))
{
exit('Invalid file request');
}

/**
* THIS FILE WILL NEED PERMISSIONS SET TO 400 OR SIMILAR SO EE DOESN'T OVERWRITE IT.
*/

/*
|--------------------------------------------------------------------------
| ExpressionEngine Config Items
|--------------------------------------------------------------------------
|
| The following items are for use with ExpressionEngine.
|
*/

/* Universal Variables */

$config['app_version'] = "253";
$config['license_number'] = "0000-0000-0000-0000";
$config['debug'] = "1";
$config['install_lock'] = "";
$config['system_folder'] = "sys";
$config['doc_url'] = "http://expressionengine.com/user_guide/";
$config['is_system_on'] = "y";
$config['cookie_prefix'] = "";
$config['site_name'] = "Base ExpressionEngine Install";
$config['allow_extensions'] = "y";

/* General
-------------------------------------------------------------------*/
$config['site_index'] = "";
$config['site_url'] = "http://".$_SERVER['HTTP_HOST'];
$config['server_path'] = $_SERVER['DOCUMENT_ROOT'];
$config['cp_url'] = $config['site_url']."/admin.php";

/* Dynamic database connection settings
-------------------------------------------------------------------*/

switch ( $config['site_url'] ) {
// local
case 'http://dev.example.com' :
    $db['expressionengine']['hostname'] = "localhost";
    $db['expressionengine']['username'] = "admin";
    $db['expressionengine']['password'] = "password";
    $db['expressionengine']['database'] = "dev-db";
  break;

// staging
case 'http://staging.example.com' :
    $db['expressionengine']['hostname'] = "mysql.exampleserver.com";
    $db['expressionengine']['username'] = "admin";
    $db['expressionengine']['password'] = "password";
    $db['expressionengine']['database'] = "staging-db";
break;

// live
default :
    $db['expressionengine']['hostname'] = "mysql.exampleserver.com";
    $db['expressionengine']['username'] = "admin";
    $db['expressionengine']['password'] = "password";
    $db['expressionengine']['database'] = "live-db";
break;

}

/* Universal database connection settings
-------------------------------------------------------------------*/
$active_group = 'expressionengine';
$active_record = TRUE;
$db['expressionengine']['dbdriver'] = "mysql";
$db['expressionengine']['dbprefix'] = "exp_";
$db['expressionengine']['pconnect'] = FALSE;
$db['expressionengine']['swap_pre'] = "exp_";
$db['expressionengine']['db_debug'] = FALSE;
$db['expressionengine']['cache_on'] = FALSE;
$db['expressionengine']['autoinit'] = FALSE;
$db['expressionengine']['char_set'] = "utf8";
$db['expressionengine']['dbcollat'] = "utf8_general_ci";
$db['expressionengine']['cachedir'] = $config['server_path'].$config['system_folder']."/expressionengine/cache/db_cache/";

/* Member directory paths and urls
-------------------------------------------------------------------*/
$config['avatar_url'] = $config['site_url']."/uploads/system/avatars/";
$config['avatar_path'] = $config['server_path']."/uploads/system/avatars/";
$config['photo_url'] = $config['site_url']."/uploads/system/member_photos/";
$config['photo_path'] = $config['server_path']."/uploads/system/member_photos/";
$config['sig_img_url'] = $config['site_url']."/uploads/system/signature_attachments/";
$config['sig_img_path'] = $config['server_path']."/uploads/system/signature_attachments/";
$config['prv_msg_upload_path'] = $config['server_path']."/uploads/system/pm_attachments/";

/* Misc directory paths and urls
-------------------------------------------------------------------*/
$config['theme_folder_url'] = $config['site_url']."/assets/themes/";
$config['theme_folder_path'] = $config['server_path']."/assets/themes/";

/* Templates Preferences
-------------------------------------------------------------------*/
$config['save_tmpl_files'] = "y";
$config['tmpl_file_basepath'] = $config['server_path']."/assets/templates/";
$config['site_404'] = "404/index";
$config['strict_urls'] = "n";

// END EE config items

/*
|--------------------------------------------------------------------------
| CodeIgniter Config Items
|--------------------------------------------------------------------------
|
| The following items are for use with CodeIgniter.
|
*/
$config['base_url'] = $config['site_url']."/";
$config['index_page'] = "";
$config['uri_protocol'] = "AUTO";
$config['url_suffix'] = "";
$config['language'] = "english";
$config['charset'] = "UTF-8";
$config['enable_hooks'] = FALSE;
$config['subclass_prefix'] = "EE_";
$config['permitted_uri_chars'] = "a-z 0-9~%.:_\-";
$config['enable_query_strings'] = FALSE;
$config['directory_trigger'] = "D";
$config['controller_trigger'] = "C";
$config['function_trigger'] = "M";
$config['log_threshold'] = 0;
$config['log_path'] = "";
$config['log_date_format'] = "Y-m-d H:i:s";
$config['cache_path'] = "";
$config['encryption_key'] = "";
$config['global_xss_filtering'] = FALSE;
$config['csrf_protection'] = FALSE;
$config['compress_output'] = FALSE;
$config['time_reference'] = "local";
$config['rewrite_short_tags'] = TRUE;
$config['proxy_ips'] = "";

/* End of file config.php */
/* Location: ./system/expressionengine/config/config.php */

```

# Answer
To be able to actually use the "site\_name" and for it to work,
you need to hack the core
https://support.ellislab.com/bugs/detail/15461/#8283

or install an extension i developed for this.
http://devot-ee.com/add-ons/override\_site\_name

**edit** Instead of in the `config.php` file,
You can override site\_name in the main index.php
`$assign_to_config['site_name'] ='Name'`
> 10 votes

---
Tags: config
---


# Question
Title: Managing database for single site across multiple servers?
Does anyone have any advice on how to deal with separate databases (local, staging, live) for the same EE site on different servers?

The client changes things on live, but I obviously do any site maintenance or updates from my local \> staging versions. I've accidentally overridden the client's changes to the live site before. Any advice on how to avoid this with a module that checks database changes, or even a way to block certain sections of the database from being overridden on import? (like say, any tables dealing with members)

I was looking at Site Manager on github but it is currently in Alpha, so unsure when it can actually be used in production. I have Zenbu installed to check entry edit dates, but no idea how to check for changes elsewhere.

# Answer
You'll find a lot of great info at Migrating between Development, Staging and Production for a pre-existing ExpressionEngine site

As mentioned in one of the answers, remember that content should flow from PROD =\> STAGE =\> LOCAL and code should migrate from LOCAL =\> STAGE =\> PROD.

I have a similar workflow where I work on everything locally and migrate to staging before production. In most cases I'm able to ask the client for a content freeze while I make quick updates to their site locally, have them review on staging, and then migrate them live.

In cases where content freezes aren't possible, and the edits require more than just template updates, then I sometimes add the add-on/channel(s)/channel field(s)/categories/etc by hand on live after hours so not to overwrite the whole DB. Luckily this is pretty rare and I have been using SiteManager a lot for this. It works great!
> 2 votes

# Answer
It does depend on what sort of changes you're making, but one possibility is to connect to the staging or production database from your local installation.

This has the advantage of giving you access to all the latest data that's been created by clients.

But it also means that you might be editing templates on a live site. If you're working on completely new sections with new template groups, or new templates within existing groups, this isn't such a problem.

But if you're doing work that involves structural changes to database tables, then this isn't really an option. Like I said at the start: it all depends on what sort of updates you need to make.
> 1 votes

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


# Question
Title: How to create 170 entries with only one word changing?
I'm working on a large site and one of the sections I'm about to develop has 170 entries, all of them use the same long copy, except for one single word. For example:

Entry 1: All of our experts are native **Afar** speakers and professionally qualified bla, bla, bla.

Entry 2: All of our experts are native **Afrikaans** speakers and professionally qualified bla, bla, bla.

Every entry has to be dynamically created because at some point they will be translated into another language (using Publisher for this).

Is there a way to setup a system without having the client to enter manually every entry in the ExpressionEngine publish window?

It is the same text always with only one word changing and it feels like too much work copying and pasting 170 times.

What would be the best approach to develop this?

# Answer
> 4 votes
You could generate XML with EE templates and import it with an add-on like DataGrab.

Create a template group `xml_import` and the templates `xml_import/entries` and `xml_import/entry`. Set both template types to XML.

xml\_import/entries:

```
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<entries>
    {embed="xml_import/entry" language="Afar"}
    {embed="xml_import/entry" language="Afrikaans"}
</entries>

```

xml\_import/entry:

```
<entry>
    <title>{embed:language}</title>
    <content>
    <![CDATA[
      <p>All of our experts are native {embed:language} speakers and professionally qualified bla, bla, bla.</p>
    ]]>
    </content>
</entry>

```

In the `entries` template add `{embed="xml_import/entry" language="Afar"}` for every language.

In the `entry` template you can edit the title, content or other fields. `{embed:language}` outputs the language name.

Check you XML document http://yourdomain.com/xml\_import/entries.

I have not used DataGrab for myself but I believe it shouldn’t be hard to import the generated XML document and its data into new entries.

Of course you can generate CSV, RSS or other document types this way. The principle is identical.

# Answer
> 1 votes
Why not just wrap the output in a find and replace addon such as LowReplace or any of the others found here: http://devot-ee.com/search/results?keywords=find+and+replace&collection=addons&addon\_version\_support=ee2

---
Tags: long-content
---


# Question
Title: Front-end filtering of entries combining multiple selections
I'm wondering how best to handle providing the user the ability to filter channel entries via the front end with the selection of multiple criteria simultaneously - kind of like some real estate sites do, only in my case, I'm looking to filter entries each of which is a cosmetic surgical case (which is mostly photo content, but there is a little bit of text associated with each as well). The user needs the ability to filter according to procedure, male/female, weeks post-op, and possibly other filters that get added down the line.

I had been planning to have procedures as entries and cases as entries, then using Playa relationships to tie them together, but the fact that i need to be abel to offer multiple filter criteria at once (limit view to facelifts, male, 6 weeks post-op, for example) makes that a daunting task from my perspective.

Should I be looking at categories instead (I'm not a fan of categories normally)? Or should I be using a search add-on like Low search. Very interested to hear from the EE community on what would give me the most flexible solution (not to mention which would be manageable to implement).

# Answer
If you're going the category route, you could use the native Dynamic Parameters, possibly with Dynamo, to filter entries.

However, using Low Search (or Super Search), you can also filter by Relationship fields (including Playa fields), so that would be more flexible. For example, you can use *inclusive* filters, allowing to mimic `category="1&2&3"` as well as `category="1|2|3"`.
> 9 votes

# Answer
You said it's mostly "photo content" which made me think of using something like Quicksand:

http://razorjack.net/quicksand/

You could really filter anything with Quicksand from what I've seen of the demos, including text.

You could then use Tags or native Categories (or both) to setup up the data-id's as per the Quicksand docs to filter off of.

Tag add-ons:

**Update:**

Jason Varga commented about jQuery Isotope appearing to be a more active project and without doubt is definitely a more robust solution. After seeing that I'd say use it over Quicksand if you go this route.

http://isotope.metafizzy.co
> 3 votes

# Answer
```
   <ul id="filters" >
        <li class="title">Filter By</li>
        <li class="bullet-item"><a href="#" data-filter="*">Show All</a></li>

        <li class="bullet-item"><a href="#" data-filter=".filter1">Filter 1</a></li>
        <li class="bullet-item"><a href="#" data-filter=".filter2">Filter 2</a></li>
    </ul>
{exp:super_search:results parse="inward" channel="my_channel" status="open" orderby="entry_date" sort="desc" limit="50"}
....
{/exp:super_search:results}

```

Then for some jquery:

```
$(document).ready(function() {

// masonry stuffzs
var $container = $('.results_list');

$container.isotope({
  itemSelector : '.collection_image',
  layoutMode: 'cellsByRow',
    cellsByRow: {
        columnWidth: 160,
        rowHeight: 300
    }
});

$('#filters a').click(function(){
  var selector = $(this).attr('data-filter');
  $container.isotope({ filter: selector });
  return false;
});

```

});

This is all done by using isotope and super search, but you could just as easily do it with Low Search as well.
> 2 votes

# Answer
If I understand you correctly, we do the following:

1) Use a custom form that submits GET variables in the URL to a "results" template we create

2) A plugin we wrote which changes the GET variables into the segment URL structure https://github.com/amityweb/get\_segment\_redirect

3) Then custom search filters on the channel entries based on the segments:

```
{exp:channel:entries
    channel="restaurants"
    dynamic="no"
    disable="categories|category_fields|member_data"
    search:restaurant_region="{segment_2}"
    search:restaurant_area="{segment_3}"
    search:restaurant_sub_area="{segment_4}"
    limit="10"
    paginate="bottom"
    orderby="random"
}

```

We also have this working via AJAX to update the search results as the form changes.
> 1 votes

# Answer
I would setup the procedures as categories and keep the cases as entries. Maybe even break the procedures up into different category groups to keep it usable. (ie. Gender Cat Group, Recovery Cat Group, Surgery Cat Group)

Re: filtering the entries, this depends on how many cases there are. If there is going to a couple dozen (\<100 or so), I would list all the entries on a page and use the categories as class names on each entry and filter with JS (show/hide). You would then setup a filtering system (selet menus) to drill down on each specific procedures and surgeries.

```
<div class="case {categories backspace="1"}{category_url_title} {/categories}">
    ...case info...
</div>

```

If there is going to be a ton of cases, I would use a faceted approach with Low Search. Then you can append each category as necessary to filter the entries (cases)
> 0 votes

# Answer
Whenever I have looked into this it always come down to I have a large number or records that need to be filtered and I still need pagination so I need to stay with EE's channel entries loop to handle. The Low Search product is great for this if your filter criteria is based on regular fields. Categories is always a bit trickier due more to EE than anything else. But Low Search is still a great option for that as well. Comes down the number of entries you need to filter by (100 - 500 or more int he 10k or more range). In terms of performance, category filtering of entry lists is always going to be slower.
> 0 votes

# Answer
I don't have any experience of this myself, but came across this question asking about Backbone which links to an EE site with filtering that sounds similar to what you're talking about.
> 0 votes

---
Tags: categories, search, playa, filter
---


title: Hide Category in Forum Breadcrumb

text:
# Question
Title: Hide Category in Forum Breadcrumb
Is it possible to globaly hide the category-name in the Forum-Breadcrumb? `{include:breadcrumb}` includes the «Forum Home», Category, Forum and Title — but I wan't to get rid of the category.

What do I have to edit in the modules/forum-folder to delete the category from the breadcrumb?

# Answer
I think I found it in the Code-Snippets in `mod.forum.php` starting at line ~1770 `// Is this a forum view?` AND the snippet starting at line ~1810 `// Is this the thread view?` … just delete or comment-out the code starting with:

```
$crumbs .= $this->_crumb_trail(
…

```

… where you find `forum_path('/viewcategory…` inside.

That's the crumb with the Category in it. If you comment-out the two, you don't have the Category anymore in the `/viewforum` and `/viewthread` views.

Search for other references if you want to get rid of it also on other views.
> 5 votes

# Answer
I'm not sure that this is possible. I just looked at the default theme for the discussion module and in forum\_breadcrumb \> breadcrumb\_trail.html there is the following code, which suggests to me that it's 100% dynamically generated. I know that there is no gui interface to turn on/off various aspects of breadcrumbs.

```
<a href="{crumb_link}">{crumb_title}</a><span class="breadcrumbspacer">  >  </span>

```

You'll probably need to modify the actually php files for the dicussion module to remove the categories. The discussion module is notoriously difficult to theme and customize.
> 0 votes

---
Tags: php, forum
---


# Question
Title: check if an entry has a certain playa parent
I'm looping through my entries, and I want to check if my entry has a certain entry as his playa parent.

Right now I'm using this code, which works, **but I'm wondering if it can be done without PHP.**

```
{exp:channel:entries channel="project"}
    <?php $hasParent = false; ?>

    {project_categorie}
      {if segment_2 == url_title}
        <?php $hasParent = true; ?>
      {/if}
    {/project_categorie}

    <?php if($hasParent){ echo "wooptidoo"; }?>
{/exp:channel:entries}

```

so, this runs through my playa related entries, checks to see if the url\_title matches my quert ( segment\_2 in this case ) and displays this **once**.

Another example of this functionality would be: checking to see if you entry is in a certain category. f.ex:

```
{exp:channel:entries channel="project"}
    <?php $isInCategory = false; ?>

    {categories}
      {if segment_2 == category_url_title}
        <?php $isInCategory = true; ?>
      {/if}
    {/categories}

    <?php if($isInCategory){ echo "wooptidoo"; }?>
{/exp:channel:entries}

```

can this be done without having to use PHP ?

**EDIT:<br>--------------------**

Ok, I have not idea why I didn't think of this before, but this works perfectly..

```
{exp:channel:entries channel="project"}
    {project_categorie}
      {if segment_2 == url_title}
        wooptidoo
      {/if}
    {/project_categorie}
{/exp:channel:entries}

```

stuuupid. :)

# Answer
> 1 votes
You can check if an entry has a parent with the `{exp:playa:parents}` tag, it accepts all the channel entries parameters also. Something like this could work:

```
{exp:channel:entries channel="project"}
    {exp:playa:parents channel="channel" entry_id="{entry_id}"}
        wooptidoo
        {if no_parents} ... {/if}
    {/exp:playa:parents}
{/exp:channel:entries}

```

You could also use a addon like Low's Seg2Cat to filter the entries even more:

```
{exp:playa:parents channel="channel" category="{segment_2_category_id}" "entry_id="{entry_id}"}

```

# Answer
> 0 votes
Take a look at my new free add-on. It's not 100% ready for prime time, but that method should work. I do stuff like that all the time. Let me know if there are methods missing that you need.

http://objectivehtml.com/entries

Edit... Not 100% sure those methods exist currently, but here would be a good proposed API.

```
{exp:entries:has_parent_category entry_id="{entry_id}"}

    {if no_results}
        This does not belong to parent category
    {/if}

{/exp:entries:has_parent_category}

{exp:entries:in_category entry_id="{entry_id}"}
    {if no_results}
        This does not belong to category
    {/if}
{/exp:entries:in_category}

```

---
Tags: ee2, categories, php, playa
---


# Question
Title: Control panel dropdown submenus not expanding?
I can't figure out why my dropdown submenu's aren't expanding? No JS errors either?

I am using Zoo Flexible admin but when I hide the custom menu or reset to default the issue still persists? Any ideas?

EE 2.5.3 Zoo Flexible Admin 1.62

Third Party folders are outside of `system` & `themes` folders

# Answer
I worked with Nico (Zoo) & Manuel (DevDemon) to isolate the issue. The problem was with Editor and the `cp_css` extension hook it was using which cause a PHP error in the CSS. Manuel patched and should be in the next release.
> 1 votes

# Answer
This is usually caused by a JavaScript error or error loading an asset file.

You should turn on your browser's developer tools and look for any 404s in addition to the JavaScript errors you looked for to begin debugging this type of problem.
> 4 votes

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


# Question
Title: Related entries: Auto-complete input instead of select/option?
The relationship feature in ExpressionEngine is fantastic, but quite difficult to manage if a relation points to a channel with hundreds of entries. In said case, the control panel's select/option form element is inadequate.

Is there a add-on that allows to set up a relation through an auto-complete text input field, while honoring the ee-native relation fieldtype?

Would the Playa plugin address this issue?

# Answer
> 3 votes
Playa can solve this. It hasn't got an autocomplete function, but it offers **filtering-as-you-type** and **searching**:

As solution to the problem of selecting amongst hundreds of entries, this approach is **functionally aequivalent** to an autocompleting text-entry field.

# Answer
> 3 votes
**Playa** is what you need. It takes native entry relationships to the next level. It does have live filtering/autocomplete now. It creates a new table to store the relationships and I'm 99% sure will convert over your existing relationships when you change the fieldtype to Playa. You'll want to either confirm this with Pixel & Tonic or test on your own. Make a backup before testing obviously.

---

---
Tags: add-on, ee2, control-panel, playa, relationships
---


# Question
Title: Refused to execute a JavaScript script. Source code of script found within request
In my control panel, I am getting a bunch of javascript errors, starting with:

Refused to execute a JavaScript script. Source code of script found within request.

I read something about XSS filters and attacks - https://stackoverflow.com/questions/1547884/refused-to-execute-a-javascript-script-source-code-of-script-found-within-reque/1547887#1547887 \- I'm not sure how to debug the problem.

# Answer
First, start by making sure the jQuery module is installed on the Module page.

---

Next, try disabling EE's XSS sanitizing.

---

Then, I'd disable Extensions by adding this to your config.php file or by changing the config to "n" if it already exists in config.php.

> $conf\['allow\_extensions'\] = "n";

This will eliminate code in one of the extensions as part of the problem.

If disabling Extensions eliminates the error, then you know it's one of the installed Extensions and you can start uninstalling them one by one to determine which extensions. Note: When you uninstall an extension you will lose any data/settings associated with it so a backup is in order if you don't want to reset up Extension settings when you reinstall.
> 1 votes

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