title: Channel entry not displaying

text:
# Question
Title: Channel entry not displaying
RE: How to display Channel entry page?

The accepted solution doesn't seem to work for me. My "products/index" template has something like this:

```
{exp:channel:entries channel="products" limit="10" orderby="date" sort="desc"}
   <a href=/products/detail/{url_title}">{name}</a>
{/exp:channel:entries}

```

Then in "products/detail" template, I have something like this:

```
{exp:channel:entries channel="products" limit="1"}
   <h2>{name}</h2>
   <p>{description}</p>
{/exp:channel:entries}

```

The "products/detail" page always shows the same record (and when you look at the tag pair, it make sense I think). How is this template supposed to know which record specifically to access? What is it about `{url_title}` that hints to which entry to retrieve? Is there something I need to put in the tag pair to tell it to use the `{url_title}` segment?

# Answer
> 5 votes
Your code is correct, and should work. EE will always look at the third segment for either an `entry_id` or `url_title`, unless you specifically add `dynamic="no"` to your Channel Entries tag. So although the suggestions that you specify `entry_id="{segment_3}"` or `url_title="{segment_3}"` will work, they should not be necessary.

Note that in your first code sample, you should use `{permalink="products/detail"}` or `{title_permalink="products/detail"}` \- more future-proof.

# Answer
> 2 votes
You could add url\_title="{segment\_3}" to the channel entries tag in the products/detail template.

# Answer
> 1 votes
On your details template, you can add two parameters to the entries loop that should solve this - add dynamic="no" and url\_title="{segment\_3}".

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


title: Treeview field type?

text:
# Question
Title: Treeview field type?
I need users to select certain locations from a (possibly) tree view UI. The tree view might contain something like a list of states, with each state with a list of counties, with each county with a list of ... and so on.

Later on, I need to be able to display Channel entries wherein certain items in the tree view were selected. For example, display all Channel entries where "City 1" or "City 18" were selected.

Is there a EE or addon FT solution for this?

# Answer
> 2 votes
If the issue is actually around Cities, States, Countries, then you may want to take a look at REEgion Select, a third party add-on by @Derek Hogue who answers a number of questions here.

If your issue is really more about being able to base one field of the selection of another, than take a look at Query Field. I haven't used it, yet, but do have a project that I've been looking at it for.

Though for your final display issue, I think you may want to either use a filtering system, like Isotope—a javascript filtering method, a tagging system, either Solspace Tag or DevDemon's Tagger. Obviously you could use custom queries as well, but I think one of the above maybe an easier approach. Tagger is free and if you don't need all the features of Solspace's module is a nice way to go.

For Treeview itself, there is no specific add-on or fieldtype that I've heard of, but I'd assume mainly because Treeview is about clustering or hierarchical data. Generally speaking, hierarchical groupings have been category based, meaning you create your list and sublist and subsets of data manually and kind of hope things don't change to much. You can still do this with a combination of categories, subcategories, tags/keywords, and maybe add some javascript.

Distributive classification, tagging, can be more flexible and responsive to your needs, while still allowing for flexible filtering of data. In terms of data entry, I think tags are probably easier, or a mixture of tags and categories (unless you are literally dealing with locations\*).

If you are actually dealing with locations, than I'd recommend something that does assistive auto-completes. Like just allow the user to enter a postal code, then recommend city, state, region, country from that, but allow them to be modifiable.

---
Tags: fields, fieldtype
---


# Question
Title: Get the custom fields for top-level category
I'm trying to get the category description and some custom fields of the currently "active" category. By "active" I mean based on a URL-segment. So if my category-structure looks like this:

* websites
    + design
    + development
    + information-architecture
* brochures

And my url is `http://www.mydomain.com/portfolio/category/development` i want to get the custom fields etc. from the category `websites` (because it's the top-level parent for `development`). What's the best way to do this?

Thanks,

* Steven

# Answer
> 1 votes
I believe ExpressionEngine register the category on display as the active category, so from your example, the active category is 'development' NOT 'websites'. It sounds like you want to be able to pull data from the parent category.

I think the easiest way to accomplish this is to find a third-party add-on. You could probably do it with custom queries, but that may get complicated.

GWcode Categories offers very flexible ways to pull data from categories. You could definitely use that, though it maybe overkill for your needs. But once you get use to it, you may find you want to do more with categories more frequently. Plus its free.

Primary Categories by Solspace should also allow you to accomplish what you want. It's not free, but works more specifically on the issue you describe.

Category Parents Works directly on the issue at hand. Grabs data from the parent category.

Low Seg2Cat may also work. It's free, and allows for you to work with url segments to grab categorical information.

There are a lot of add-ons that deal with categories, over 70 at Devot-ee, you can go for one that works specifically on your issue (parent-child relations) or find a nice all purpose tool like GWCode Categories or others.

Either solution will work. If your site is pretty simple, I recommend just going with something like Category Parent, if you think you'll need more flexibility with categories across the board, then look at GWCode.

---
Tags: categories
---


# Question
Title: Difference $_SERVER['DOCUMENT_ROOT'] on ExpressionEngine and PHP
I'm currently using the $\_SERVER\['DOCUMENT\_ROOT'\] variable inside my config file.

In ExpressionEngine this is returned :

```
/Applications/MAMP/htdocs/devee

```

In PHP (no CMS) this is returned :

```
/Applications/MAMP/htdocs

```

Is there a place, where ExpressionEngine is changing the $\_SERVER\['DOCUMENT\_ROOT'\] ?

Thanks.

# Answer
> 6 votes
I would avoid using DOCUMENT\_ROOT altogether, to avoid issues between servers. The doc root is specified in your apache config, and depending on your apache setup, isn't always guaranteed to give you the correct path to your root folder.

It's much more reliable to use `dirname(__FILE__)` (or `__DIR__` in PHP 5.3+) for the directory of the current script, and go from there. E.g. (in your `config.php` file):

```
$root = realpath(dirname(__FILE__).'/../../../');
$config['theme_folder_path'] = $root.'themes/';

```

# Answer
> 3 votes
I would assume ExpressionEngine is giving you the path to your system folder, since that is were the config.php file is located.

The `$_SERVER['DOCUMENT_ROOT']` provides:

> The document root directory under which the current script is executing, as defined in the server's configuration file.

It doesn't provide the base path to your html folder; it **provides** the path to the executing file/script.

---
Tags: ee2, server
---


# Question
Title: Why would my template not show when channel entry limit parameter is set higher than 1 with Playa parent tag is within?
I have two channels; A and B. Channel B has a Playa field that relates that entry to entries from Channel A.

In my template, I am wanting to show all the entries from Channel A and display the title of entries from Channel B via the Playa Parent tag.

Here is my code:

```
{exp:channel:entries channel="channelA" limit="1000"}
<article id="{url_title}" class="info">
    <h2>{title}</h2>
    <ul>
        {exp:playa:parents channel="channelB"}
        <li><a href="{path='/site/view/{url_title}'}">{title}</a></li>
        {/exp:playa:parents}
    </ul>
</article>
{/exp:channel:entries}

```

If the channel entry limit is set to anything higher than 1, the template is a white screen. But if the limit is set to "1" it works for the most recent entry only.

If i remove the Playa code, the template shows as it should. Is there something I am missing?

Thanks

# Answer
You might be running into PHP’s memory limit. You can read about how to increase that here: http://www.hostucan.com/webmaster-tutorials/increase-php-memory-limit
> 3 votes

# Answer
Just in case... have you tried `dynamic="no"` in your outer entries tag?
> 1 votes

---
Tags: channel-entries, playa
---


title: Problem retrieveing Playa child entries

text:
# Question
Title: Problem retrieveing Playa child entries
I'm having trouble retrieving the child pages when giving the parent id.

```
        {exp:playa:children channel="patient-services" entry_id="422"}
        <li>{title}</li>
    {/exp:playa:children}

```

This yields no results. In the CP, I have several pages with a 'Obstetrics' as the parent (which has id 422). Hopefully the attached images will show what I'm trying to do. I know this would work better in Structure, but this site wasn't planned well.

# Answer
**Here are some ideas:**

* Add the `field=""` or `field_id=""` parameters.
* Do the children entries have a custom status set? If yes, you'll need to specify it with `status=""` parameter.
* Check the entry dates for the child entries. Is the entry date in the future? Is an expiration date set that is causing the entries not to show?
* Try removing the `channel=""` parameter and leave the `entry_id="422"`.
* Confirm `channel="patient-services"` is correct.
> 4 votes

# Answer
In your screenshot, “Obstetrics” is actually the *child*, not the parent, yet in your template code, you’re trying to pull in the children of Obstetrics. That {exp:playa:children} tag pair would only pull in entries if Obstetrics had its own Playa fields with their own related entries.

If you want to see all of the entries that are relating the Obstetrics entry via their own Playa fields, you need to use {exp:playa:parents}, not {exp:playa:children}.
> 3 votes

---
Tags: playa
---


# Question
Title: How to have an entry open into a standalone page
I am working on my first EE site and also my first site in general so I am a bit new to this. However, things have been going fairly well but I need some assistance on this topic.

I am creating a tutorial site so I plan on having recent content quite frequently. I have categories set up so users can go to certain topic pages and also my most recent video is large for viewers to see. However, since the splash page is a little bit of a summary page, I want users to click into a page to view the content. Here is a link to what I am referring to http://greyscalegorilla.com/blog/

As you can see his splash page showcases all of his tutorials, and when you click on the title you go into a standalone page for just that content. I don't know what terms I would type into search engines to even start looking for how to solve this. I saw the Pages module in EE and I am not sure is that something I need to use? Just looking for a little bit of assistance so I can start looking for how to create that effect. Any help is greatly appreciated! Thanks everyone!

# Answer
> 2 votes
You don't need the Pages module for this, what you want is just a standard entry or post page.

You can read, 'How To Display a Channel Entry'- here on StackExchange, it deals with the same issue.

But the basics are, you want your blog links, to link to the display/post template. So from your blog view:

```
{exp:channel:entries channel="blog" limit="10" sort="entry_date" order="desc"}

<h2><a href="{comment_url_title_auto_path}">{title}</a></h2>
{blog}
<hr />

{/exp:channel:entries}

```

The **{comment\_url\_title\_auto\_path}** will provide the correct linking url, if you've set-up the channel details properly. If you haven't or want to just custom build the link, then use…

```
{exp:channel:entries channel="blog" limit="10" sort="entry_date" order="desc"}

<h2><a href="http://mydomain.org/blog/entry/{url_title}">{title}</a></h2>
{summary}
<hr />

{/exp:channel:entries}

```

Where `entry` is a reference to a template in the template\_group, blog. The name can be whatever you like: entry, details, article, post, etc.

Once the basic link is established, you then need to set-up the individual post display template. I'm going to keep calling it `entry`.

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

<h2>{title}</h2>
{blog}
<hr />

{/exp:channel:entries}

```

And that's basically it. Obviously you need to style and format the page. If you aren't using a `{summary}` field, you probably want to limit the number of words or characters displayed on the list view/splash page. But the basic display of a full post is fairly easy, making sure you point to the right template is probably the confusing part for most newbies.

---
Tags: ee2, entry, pages
---


title: How to add new columns in Matrix?

text:
# Question
Title: How to add new columns in Matrix?
I can't seem to find the way to add new columns for Matrix fieldtype.

I am using Expression 2.5.5 and Matrix 2.5.1

# Answer
This is almost certainly caused by the Matrix theme JS not loading/running, either due to a missing file or a JS error preventing execution.

1. Double check that you've uploaded `themes/third_party/matrix` from the matrix download to `themes/third_party/` (If the third\_party folder doesn’t exist yet, create it.)
2. If that doesn't work, check that there are no JS errors on the field config page, if there are, update your question with them.
> 2 votes

# Answer
Just found out that it has something to do with the installation. I uninstalled everything, reinstalled it and I now see the + and - buttons
> 1 votes

---
Tags: matrix
---


title: How to search Matrix?

text:
# Question
Title: How to search Matrix?
Say I have a Matrix that has the following fields:

* Name
* Age
* Gender

How would I find Channel entries like:

* the Channel entry's Age is between 20 and 25
* the Channel entry's Age is between 20 and 25 and Gender is "Male"
* the Channel entry has 1 Matrix entry only
* the Channel entry has 2 Matrix entries
* etc.

# Answer
> 3 votes
I take it you want this to be optimised and not use a whole bunch of conditions inside channel entries loops.

In that case, MySQL queries are your best bet here, IMHO. I would take the plugin route and create a plugin returning an array of entry\_id and accepting the various parameters you need.

For example, you could create a plugin returning the entry\_id of the entries having a matrix field with more than x entries. Such a plugin would be based on the following type of query:

```
SELECT DISTINCT `entry_id` FROM `exp_matrix_data` WHERE `field_id` = 48 GROUP BY `entry_id` HAVING COUNT(`entry_id`) > 2

```

You plugin tag would could easily pass it a parameter called nbr\_matrix\_rows with a value of x.

---
Tags: channel-entries, matrix, search
---


# Question
Title: Is there documentation on the Safecracker object argument on the safecracker_submit_entry_start/_end callback function?
I am using an extension that uses the hook "safecracker\_submit\_entry\_start" and "safecracker\_submit\_entry\_end".

The function that handles the callback has a safecracker object argument.

I am wondering if there was any documentation about what that object does.

I would like to do some things with the safecracker form data and I was wondering if this object has the methods/variables to do it.

# Answer
There is no documentation that I am aware of. I usually open the `safecracker/libraries/Safecracker_lib.php` and reference the class itself. The object can be seen pretty plainly this way so you know all the available methods and properties.

I can almost bet that there is a way to do what you want. You can use the hooks in Safecracker to do just about anything. You can even take a look at my Safecracker Registration extension to see how I manipulated the object.

If you have any more questions, just open another thread about the specific task you are trying to accomplish.
> 2 votes

---
Tags: safecracker, extension
---


# Question
Title: Direct access to exp_store_stock exp_store_stock_options tables via Expresso Store tags?
I was wondering if any tags in Expresso Store just give you direct access to the exp\_store\_stock and exp\_store\_stock\_options tables.

What I want to do, when I display a store item, is filter the entries in the exp\_store\_stock table by associated entry\_id. Rather than using drop-down options, which seem cumbersome as an interface, I want to have a button representing each SKU for the product that (when clicked) adds one of that variation to the cart.

So, obviously, if there's 16 sizes to a t-shirt available in two colours (2 colour variations, male and female variations for each, and four sizes for each of these), then I'd want to grab just the SKUs associated with these.

Then if there's a zero in the stock\_level column, print out a disabled button, and if not, print out an enabled button that (when clicked) adds 1 of that SKU variation to the cart.

What I would like to do -- that's a little trickier -- is filter this list by other product modifiers by modifier\_name, and right now, I don't see how I'd do that. So what I'm looking for is to not only filter the exp\_store\_stock entries by entry\_id, but also by the values of modifier\_name that apply to that SKU.

So for example, because t-shirt SKUs describe subsets of the stock — gender (male or female), size (S, M, L, XL) and colour (red or green) — characteristics which apply to each SKU, I'd like to product some kind of output in a loop.

* colour 1 (red)
    + gender 1 (female)
        - stock of size 1 (small)
        - stock of size 2 (medium)
        - stock of size 3 (large)
        - stock of size 4 (x-large)
    + gender 2 (male)
        - stock of size 1 (small)
        - stock of size 2 (medium)
        - stock of size 3 (large)
        - stock of size 4 (x-large)
* colour 2 (green)
    + gender 1 (female)
        - stock of size 1 (small)
        - stock of size 2 (medium)
        - stock of size 3 (large)
        - stock of size 4 (x-large)
    + gender 2 (male)
        - stock of size 1 (small)
        - stock of size 2 (medium)
        - stock of size 3 (large)
        - stock of size 4 (x-large)

The tricky thing is that while I might be able to accomplish this by filtering by product\_opt\_id, I want to filter an entry\_id's SKU with a common modifier name.

Product\_opt\_id assumes that the modifiers for every product are different between every product -- the IDs refer back to the exp\_store\_product\_modifiers table. But if it were possible to just filter the SKUs by modifier name then I could output and use conditionals on them the way I describe in my loop. My modifier names are common to all my products: size, gender, colour.

So to sum up, I guess I'm looking for a query that says "show me the SKUs associated with this entry ID that have the value of these modifier applied to them. But a way to do this with tags.

Doable, or do I need to write a query? Can anyone nudge me toward the way to go?

I know I may be asking for more than what Store can do -- thanks for everyone's cogitation about this in advance!

# Answer
There are no built in tags to do what you want, but you should be able to achieve this using the EE query module.

It sounds like you have a good handle on the database schema, so I will leave writing the specific SQL query up to you.

Once you have some results from the query tag, you can easily loop through these and output multiple product tag forms (add to cart forms), and create a button for each SKU.
> 2 votes

---
Tags: expresso-store, expresso, queries
---


# Question
Title: Channel Entry - series of "connected" drop down fields?
I need to create a Channel wherein it will have a series of drop down fields. When a user selects a value in the first drop down, the next drop down goes from a disabled state to an enabled state and its options are filtered based on the first drop down's selection.

A good example would be for the first drop down to be a list of states. When a state is selected, then the next drop down might have a list of counties. And when a county is selected, then the next drop down might have a list of cities. My data is not geographic like this example, though.

I don't think EE supports this natively, but I'm wondering if there is an add-on that might do this for me? If so, what would be a good approach to solving this?

# Answer
This is a mostly a javascript issue, not really an ExpressionEngine issue. You can make fields dependent on one another using the Query Field field\_type, I pointed you to before. But the key to this type of interaction is javascript. Using Asynchronous JavaScript (AJAX) for the client-side interaction.

Basically, when you select one option, you need the javascript to look-up the next options. The javascript can limit either the local XML data you've provided or send a query and response to a database, while remaining on the same page. This is mostly the same response as your prior question on TreeViews.

I mention jQuery's Isotope as a potential filtering system, but its more for visual filtering than one drop down menu to the next. You're looking for something more like this example at JSFiddle. It includes both examples of the HTML markup and the sample javascript. You may also want to look at the Chosen jQuery plugin or it's fork, Select2. These both focus on how to display and make the data more accessible, you'd still need something like the JSFiddle example to jump from field to field.

I recommend taking a look at Filtrify, the Single Category Select is possibly close to what I imagine you need, but you can play with all the other demos as well, to see what might work best for you. The Single Category Select example basically allows you to start with a large category and limit it to smaller categories. There example uses music instead of countries, and does it with a single dropdown menu, which may be a nicer user interface. They even have an option that uses Isotope.

Javascript is the key to all these interactions. jQuery is just one javascript framework/library that you can use. There's also Prototype and Script.aculo.us; but jQuery is probably the most popular. The downside to that is you can spend a lot of time looking for a plugin or example that works for you or you can learn to modify it yourself.

As I said before, this is really more about your data and thinking of the easiest way to present it to the user. If you absolutely need data in one field to be a subset of data based on a selection from another field, then start with the Query Field field\_type. If you just have a long list of data in a database, excel, xml, etc., that you are trying to improve user interaction with, then take a look at all the options. The JSFiddle option will give you a starting point for multiple pulldown menus based on user selection, but something like the Single Category Select by Filtrify may present a far better option for the user.

**Update:** Was just at Devot-ee and noticed that someone had created an EE plugin for Chosen. I haven't tried it yet, but it may work for you, and resolve having to get up to speed on Javascript.
> 3 votes

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


# Question
Title: SafeCracker + Matrix, jQuery declaration, and Object has no method 'markItUp'
I'm trying to use SafeCracker with a Matrix field. My jQuery is being included at the bottom of my page, right before the closing `</body>`. My SafeCracker tag is as follows:

```
{exp:safecracker channel="foo" datepicker="no" error_handling="inline" include_jquery="no" preserve_checkboxes="yes" return="foo-manager/" safecracker_head="no"}

```
* `include_jquery` is set to "no" because it will be included at the bottom of the page
* `date_picker` is set to "no" because I don't need it for my form
* `safecracker_head` is set to "no" because I do not want JS being included right after the form declaration; any JS the page needs should be after the jQuery include right before the `<body>`

Problems:

1. In order for the JS associated with SafeCracker to work, jQuery must have been already defined. So I get a lot of errors with my current configuration. However, if I put my jQuery in the `<head>`, those errors go away. How can I make this work such that I can still keep jQuery at the end of my page?
2. When `safecracker_head="no"`, the Matrix table doesn't work. It doesn't even look like the default Matrix UI. So I am forced to set it to `safecracker_head="yes"` (or just remove the parameter). Then the Matrix table looks normal again. However, the parameter adds JS right after the form (and not right before `</body>`). How can I control where the JS is included?
3. Finally, even when I put jQuery in the `<head>` and have `safecracker_head="yes"`, I get `Uncaught TypeError: Object [object Object] has no method 'markItUp'` error. Any ideas why?

# Answer
1) This is a known limitation to Safecracker. Since it injects all the JS in the body of the document, right below the form, you must ensure your jQuery library is loaded before your SC JS gets executed. There is a variable to help with this called the `safecracker_head` variables. I use Stash to solve the problem by manipulating the parse order and forcing the JS to be injected at the bottom of the document. https://github.com/croxton/Stash

*Stash is an advanced utility. You may run into more questions than answers at first when using it, but it's seriously the best EE template add-on.*

**form.html**

```
{exp:stash:set parse_tags="yes"}

    {stash:page_title}Your Page Title{/stash:page_title}
    {stash:page_content}

        {exp:safecracker
            channel="your-channel"
            safecracker_head="no"
            include_jquery="no"
        }

            [YOUR FORM HERE]

            {stash:safecracker_head}
                {safecracker_head}
            {/stash:safecracker_head}

        {/exp:safecracker}

    {/stash:page_content}

{/exp:stash:set}

{!-- Include your site header which is a template object (or template partial) --}

{stash:embed:structure:header}

```

**structure/header.html**

```
<html>
<head>
    <title>{exp:stash:get name="page_title"}
</head>
<body>

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

    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>

    {exp:stash:get name="safecracker_head"}
</body>
</html>

```

*For more information on Stash, there are loads of other good posts here on StackExchange so check those out.*

2) If you use `safecracker_head="no"`, you must include the contents it generates or the `{safecracker_head}` somewhere in your document. Without it, all fieldtypes relying on JS (and CSS) will fail.

3) Probably due to the order the JS is being loaded. I have seen this error too and have always fixed it using the solution I outlined above. A good debugging technique I have used it to do a "view source" and copy the generated markup on the page. Then override (or create a new one) the template with the generated contents. Then begin a process of elimination and reshuffling the code. If you can manipulate the static page to get it to work, then all you have to do is simply restructure your EE template to match.

This is a pretty tedious process sometimes, especially when different add-ons require different versions of jQuery than what you may include in the document. I know jQuery UI causes trouble for me at times and is a constant process of updating and tweaking the integration with new releases.
> 6 votes

---
Tags: safecracker
---


# Question
Title: Channel Short Name Fields Length Limitation
I have a field name with a long "Field Label" name and I want the "Short Name" to be consistent also.

But I notice that ExpressionEngine truncates the "Short Name" to a certain length. So it seems that there is a limit to the number of characters one can put in "Short Name".

Is there a way around this?

# Answer
You'd need to modify the database. The `channel_name` field in `exp_channels` allows up to 40 characters, you could change it match `channel_title` that allows 100 characters, but I'd recommend not doing so.

My recommendation is mostly based on naming logic, field\_names versus the field\_label. Field labels are meant to be flexible and of benefit to the user, field names are to aid the current and future developers of your project.

For example, your project may start off with a single channel of data, let's say `default`. In that channel you might create fields like: summary, description, table of content, keywords, etc.

And that's all great, until you add your second channel, that let's say manages book reviews, and you need the fields summary, review, image, and keywords. Now you have duplicate field names, which can't exist at the database level within the same data table, so you might call summary =\> short and keywords =\> tags. By the time you hit the fifth channel, your naming convention is pretty much a mess.

The problem becomes the lack of a naming convention. Naming conventions are helpful to developers, even if you are the only one, let's say you need some quick assistance, it should only take a few moments for a new developer to understand your naming convention. If it takes much longer, it's probably not an ideal convention.

My preferred convention is using the section\_name as part of the field\_name, so if I have a Book Review section of the website then…

```
channel => books
template_group => books
field_group => books
fields =>   {book_authors}, {book_summary}, {book_review}, {book_rating}, {book_image}, and {book_notes}

```

You don't have to do it this way. There have been a few articles by developers talking about how they name and how this can make things in development easier.

But generally speaking, it's not a `short_name` if it's over 50 characters. Labels can be long and descriptive (but not the actual description, there is a field for that), but short\_names should be succinct and convey information. `{book_summary}` tells me not only that the field will be short, either `varchar`, `tinytext` or probable `text`. But that it's a short, descriptive field, in the field\_group for the section called `book`.

Having fields convey info to other developers is helpful. It removes or at least reduces the need for keeping field\_lists available. As a guest developer, maybe providing you 10 minutes of assistance, if your naming convention used section\_field, I could easily guess that a news section would be

```
<div class="news">
<h2><a href="/news/article/{url_title}" title="{title}">{title}</a></h2>
<p>{news_summary}</p>
<p class="attribution">{news_author} for {news_outlet} on {news_date}</p>
</div>

```

Without having to pull a field list, etc. If, I guess wrong, say `{news_outlet}` was actual `{news_vendor}` then that's a quick and easy fix or adjustment.
> 1 votes

---
Tags: channel
---


title: Stash: setting same variable

text:
# Question
Title: Stash: setting same variable
I have something like this:

```
{exp:stash:set name="name"}John{/exp:stash:set}
{stash:embed name="message"}

{exp:stash:set name="name"}Jane{/exp:stash:set}
{stash:embed name="message"}

```

In the first embed of "message", I want to display "John". In the second embed of "message", I want to display "Jane". Right now, I seeing "Jane" in both rendering of "message". Is there a way to do what I am trying to do?

# Answer
Denver is right that embeds get processed at the end of template parsing by default, therefore the value of the "name" variable will always have the last value. What you could do is use the parameter process="start" so that the embed code is included before template parsing starts.

```
{exp:stash:set name="name"}John{/exp:stash:set}
{stash:embed name="message" process="start"}

{exp:stash:set name="name"}Jane{/exp:stash:set}
{stash:embed name="message" process="start" random}

```

Note that you would need to access your "name" variable as a tag in the embed, and that this tag should not be nested otherwise due to the way EE parses from outwards inwards, the variable would be changed to the later value.

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

```

If you do need the variables to coexist and not overwrite each other regardless of how you nest them in the embed, you could use a dynamic context to provide a namespace and refer to it with the @ pointer from within the embed itself:

```
{exp:stash:set name="name" context="message_1"}John{/exp:stash:set}
{stash:embed name="message" stash:the_context="message_1"}

{exp:stash:set name="name" context="message_2"}Jane{/exp:stash:set}
{stash:embed name="message" stash:the_context="message_2"}

```

In the embed:

```
{exp:stash:context name="{stash:the_context}"}

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

```
> 2 votes

# Answer
Try `{stash:embed process="inline" name="message"}`. Default setting is end which tells stash to parse those values at the end of the parse order.

Passing a variable to the template is also possible this way: `{stash:embed name="foo:bar" process="start" stash:my_var="value"}`

Source: https://github.com/croxton/Stash
> 0 votes

---
Tags: stash
---


# Question
Title: DB Error with Solspace Friends on new Install of EE 2.5.5. Solutions?
I'm testing the code pack from Solspace for the Friends module. This is on a brand new clean install of EE 2.5.5

The error occurs when trying to add a comment. Full error code below

Having done a search it seems that it's an issue on the EE side rather than because of a specific add-on.

Does anybody have a solution that does not involve core hacking?

Thanks.

```
ERROR

A Database Error Occurred
Error Number: 1054

Unknown column 'ip_address' in 'where clause'

SELECT COUNT(*) AS count FROM exp_security_hashes WHERE hash = '9633427c80112996dc4a9da76c64abca2a2482fc' AND ip_address = 'XXX.XXX.XX.XXX' AND date > UNIX_TIMESTAMP()-7200

Filename: third_party/friends/mod.friends.php

Line Number: 8383

```

# Answer
This is happening as the `ip_address` column was dropped in EE 2.5.4 and replaced with column `session_id`

Solspace 'Friends' hasn't been updated since September 20th 2012 so it hasn't been patched to fix this issue. The only way around this is to either wait for an update or 'hack' mod.friends.php

There will be a **pre xid check** in the comments of this file - this section needs to be updated to work with EE 2.5.4+,

You'll need to use **ee()-\>security-\>check\_xid(ee()**

If you have any other solspace modules that have been updated (User / Freeform) you should be able to patch it together.
> 3 votes

# Answer
Got a repsonse from Solspace Support. It's an issue that affects many add-ons and it seems that it's the add-on developers responsibility to modify their code.

http://www.solspace.com/forums/viewthread/15096/
> 1 votes

---
Tags: security, solspace
---


# Question
Title: displaying a flash message after redirect
I'm programming an EE extension, and in the `save_settings()` method, if I `redirect()` (after unsuccessful data validation), the message stored in the `set_flashdata()` method doesn't show. If I comment the redirect and let the method put the user back in the main extensions page, then the flashdata shows up fine. It's *only* if I redirect that the data isn't shown.

This is my save settings method - as near as I can tell I'm not doing anything out of the ordinary - it's mostly boilerplate as near as I can tell. I'd be very appreciative of anybody that can shed light on this...

```
function save_settings(){

    // no unauthorized access
    if (empty($_POST)) {
        show_error($this->EE->lang->line('unauthorized_access'));
    }

    // get the routestring then convert it to an array
    $routestring = $this->EE->security->xss_clean($this->EE->input->post('routes'));
    $results = $this->routes_to_array($routestring);

    // if the conversion was ok:
    if ($results['status'] == 'success') {

        // update db
        $this->EE->db->where('class', __CLASS__);
        $this->EE->db->update('extensions', array('settings' => serialize(array('routes' => $results['results']))));

        // set flash data
        $this->EE->session->set_flashdata('message_success', "Routes updated.");

    // if something went wrong during conversion:
    } else {

        // set flash data then redirect back to edit screen
        $this->EE->session->set_flashdata('message_failure', $results['message']);

        // IF I COMMENT THE FOLLOWING LINE, THE FLASH DATA SHOWS UP FINE
        $this->EE->functions->redirect(BASE.AMP.'C=addons_extensions'.AMP.'M=extension_settings'.AMP.'file=apsdsm_bossyboots');
    }
}

```

OK, this is my view file - as far as I can tell this is as boiler plate as it gets. More boiler plate than a dish that's been held in scalding water for ten minutes.

```
<?php echo form_open('C=addons_extensions'.AMP.'M=save_extension_settings'.AMP.'file=apsdsm_bossyboots'); ?>

<table class="mainTable" border="0"cellspacing="0" cellpadding="0">
    <thead>
        <tr>
            <th>
                Routes
            </th>
        </tr>
    </thead>

    <tbody>

        <tr>
            <td>

                <?php echo form_textarea(array('name'=>'routes', 'value' => $routestring)) ?>

                <?php echo form_submit('submit', 'Update Routes', 'class="submit"') ?>
            </td>
        </tr>
    </tbody>
</table>

<?php echo form_close()?>

```

# Answer
> 1 votes
I'm not positive if this will work or not, but the CodeIgniter Session library has a method for keeping flashdata for more more request, I'd imagine this would help here.

Try adding this before the redirect: `$this->EE->session->keep_flashdata('message_failure');`

---
Tags: extension
---


# Question
Title: Limiting Playa results in loop for use in slider
I want to output my Playa relationship entries into a slideshow. The relationships are linked to a channel field that has one image per listing. The tricky thing is that I want to output 5 images per row for use in the slideshow. Any advice on how I could do this? I've posted my code below, in which all the entries are returned (All images are being spit out in one slide).

```
    <div class="cycle-slideshow"
        data-cycle-fx="scrollHorz"
        data-cycle-timeout="1000"
        data-cycle-slides="> div"
        >
        {exp:channel:entries channel="home" dynamic="off" disable="categories|category_fields|member_data|pagination"}
            <div>
                <ul class="client-list">
                    {exp:playa:children}
                    <li><div style="background: url({exp:ed_imageresizer image="{logos}" alt="{title}" maxWidth="160" maxHeight="80" href_only="yes"}) no-repeat center center; hfive: 98px;" cropratio="116:104"></div></li>
                    {/exp:playa:children}
                </ul>
            </div>
        {/exp:channel:entries}
    </div>

```

# Answer
You'll need to conditionally output your html. You can do this with the `switch` variable (which is supported within Playa loops), or using an add-on you can use modulo.

If I understand your jQuery Cycle setup and and how you want the HTML output to be structured, then the following should do the trick:

Use `switch` to close the list of images and the `div` that represents a slide every 5 child entries. At the same time, open a new slide `div` and image list to contain the next round of children.

```
{exp:channel:entries channel="home" dynamic="off" disable="categories|category_fields|member_data|pagination"}
    <div>
        <ul class="client-list">
            {exp:playa:children}

                <li><div style="background: url({exp:ed_imageresizer image="{logos}" alt="{title}" maxWidth="160" maxHeight="80" href_only="yes"}) no-repeat center center; hfive: 98px;" cropratio="116:104"></div></li>

                {switch='||||</ul></div><div><ul class="client-list">'}

            {/exp:playa:children}
        </ul>
    </div>
{/exp:channel:entries}

```
> 3 votes

# Answer
If the issue is that you only want five list items per ul.client-list, `{exp:playa:children limit="5"}` should work, I think.

Otherwise, you'll need to look at the `switch` option outlined by Alex.
> 0 votes

---
Tags: playa
---


# Question
Title: Set default values for radio, checkboxes, selects, etc
When creating a Channel field, such as a radio field type, is there a way to specify that a certain option should be selected by default? Same question for checkboxes, select dropdowns, etc.

# Answer
There is not - although you could add some javascript to do so (using, for example, the CP CSS & JS add-on).

This would be a good feature request for Pixel and Tonic to add to their P&T Field Pack fieldtypes.
> 5 votes

---
Tags: channel, fields, fieldtype
---


# Question
Title: Expresso Store - White Screen @ checkout
I updated to EE 2.5.5 & Store 1.6.2 and ever since the `{exp:store:checkout} {/exp:store:checkout}` tag pair returns the white screen when any action is completed (update / empty / remove / next)

I quickly uploaded the store\_example templates to test and the same issue was there.

So I backed up the Database, and then ran an uninstall / reinstall on the Store module - the functionality returns but I obviously lose all of the data - order information / products / etc and there are thousands.

I replaced `exp_store_config.store_preferences` with the hash from the reinstalled Store but this didn't help - my guess is that it's a bodged upgrade... I'll try manually changing the version numbers to force an update...

Currently the store is offline as it's impossible to make any purchases so any pointers would be greatly appreciated!

As the post data doesn't submit, it's available in the Output Profiler.

thanks,

J

# Answer
Was a botched upgrade, so I had to run the upgrade over.

To do this, I manually edited the `exp_modules.module_version` table for store to `1.5.0` then hit run module updates in addons -\> modules.

All works as expected now.
> 2 votes

---
Tags: expresso-store, white-screen-of-death
---


# Question
Title: Do username have to be unique in ExpressionEngine?
I am in the process of importing data from another application to ExpressionEngine. I know that EE expects screen\_names to be unique as of Sept 2012.

The question is whether I have to make the username unique too or if I can use a combination of first name and last name (e.g. "johndoe") risking that there might be more then one "john doe" in the imported data.

Thanks for any hints.

# Answer
Yes. If the username isn't important, I've used this for unique usernames:

```
<input type="hidden" name="username" value="whateve_{current_time format="%m%d%Y_%G%i%s"}">

```

This would typically be used in a member registration form or any other add-on that handles the registration process. Just hide the input so the user never sees the field.
> 4 votes

# Answer
Yup; a username is required and must be unique.
> 6 votes

# Answer
Yes.

If you have access to email addresses, they might be unique and could be used as usernames. Some member management add-ons offer this option as well.
> 2 votes

# Answer
after some research I can confirm that the following 3 fields need to be unique

* username
* screen\_name
* email

thanks for the tip with the current time - this and a random string is a good way to go about it.
> 2 votes

---
Tags: members, database, fields
---


title: Cartthrob notification emails and Stash

text:
# Question
Title: Cartthrob notification emails and Stash
This is most likely another Stash parse order issue, but I'm not sure.

I'm trying to stay DRY and use Stash inside of Cartthrob notification emails.

I have my templates set up like so:

```
default_site/
- emails.group/
-- low-inventory.html
- stash/
-- layouts/
--- email.html

```

I've set up Cartthrob to use `low-inventory.html` as the email notification.
I'm intending to use `email.html` as the wrapper layout/view file.

**emails.group/low-inventory.html** looks something like this:

```
{stash:embed:layouts:email}

{exp:stash:set name="title"}Low Stock Notification{/exp:stash:set}

{exp:stash:set name="content" parse_tags="yes"}
  {exp:channel:entries entry_id="{entry_id}"}
    Product ({title}) has a low inventory ({inventory}).
  {/exp:channel:entries}
{/exp:stash:set}

```

**stash/layouts/email.html** looks something like this:

```
{exp:stash:set name="img_url" type="snippet"}{site_url}images/site/{/exp:stash:set}

<html>
<body>
    <table>
        <tr>
            <td>{exp:stash:title}</td>
        </tr>
        <tr>
            <td>{exp:stash:content}</td>
        </tr>
    </table>
</body>
</html>

```

The email I receive in my inbox ends up looking like this:

{f9577b1c0aa0d3ee98693cf99f47a0e01185658551}

I know something like that means something hasn't been parsed properly.
Although, I'm not sure where I've gone wrong or what to change.
Or, if you know that this isn't possible with Cartthrob notifications, let me know.

Any suggestions would be appreciated. Thanks!

# Answer
> 2 votes
You're seeing the placeholder code that should get replaced when the template\_post\_parse hook is called. I guess CT notification templates don't support that hook.

You could either use an EE embed ( assuming CT supports those) or try to get the embed to be processed later in the parse order but without relying on that hook. That would mean using process="inline" parameter for the stash embed and putting it at the bottom of the host template, rather than the top.

# Answer
> 1 votes
I think it basically comes down to this: you need to set, before you get.

What if you add `process="end"` to the `{stash:embed}`? That means that the sets will happen first, and then it will process the embed.

---
Tags: cartthrob, stash, email, parse-order
---


# Question
Title: How do I display a category name based on a segment?
I'm trying to show the `category_name` of `segment_3`. If I use the variable `{segment_3}` it displays the short name, I want to show the Full name. Any suggestions?

Thanks in advance.

# Answer
> 4 votes
I'd check out Cat2: http://devot-ee.com/add-ons/cat2

And you can use it like so...

> category\_name from category\_url\_title

```
{exp:cat2:name category_url_title="{segment_3}" category_group="5"}

```

# Answer
> 5 votes
**Low Seg2Cat** works great for this.

> Low Seg2Cat loops through the segments of the current URI, matches them against existing categories, and registers the matching categories as global variables, which you can use in your templates.

You'd be able to access your category name using `{segment_3_category_name}`

# Answer
> 2 votes
There's also Freebie as well which would allow you to do:

```
{exp:freebie:category_name segment="3"}

```

---
Tags: ee2, segments, category-name, categories
---


# Question
Title: P&T Dropdown - how to display in Safecracker?
I have a Matrix that contains a P&T Dropdown field. I'm trying to control the markup generated by the Matrix, so I am trying to follow breaking up a matrix field for use in safe cracker form.
Though the example has a `<select>` (I'm assuming it represents a P&T Dropdown), it doesn't show how to loop through its list of options. Is there a way to do this?

# Answer
Have you tried using the `{options:field_name}` syntax, as demonstrated in the Safecracker docs?

```
<select name="my_field_name[row_new_0][col_id_14]">
        {options:my_field_name}
                <option value="{option_value}">{option_name}</option>
        {/options:my_field_name}
</select>

```

I'm just not sure it will work with a third-party add-on like PT Select.
> 6 votes

# Answer
I've not used this in a SafeCracker form, but in a Low Search form, I've used the Low Options plugin to output the options from a P&T Dropdown field, so it might be worth a try if you're still having trouble with this.
> 1 votes

---
Tags: safecracker
---


# Question
Title: How do you get Safecracker to display category groups?
I am working on a new version of an existing magazine site. We are re-architecting the category structure, and I have set up a new category group.

We need to go through all existing articles and re-categorize them, and I am trying to build a tool for this purpose using Safecracker.

Unfortunately, this particular snippet doesn't work:

```
{category_menu category_group_id="3"}
    <select name="category[]" multiple="multiple">
            {select_options}
    </select>
{/category_menu}

```

… in fact it goes so far as to render all categories, in all groups, twice. (Using `group_id` doesn't change anything, nor does `cat_group`, both options I found through googling old ExpressionEngine forum posts.)

(I'm in ExpressionEngine 2.5.3.)

# Answer
> 5 votes
I've done something similar with a group of checkboxes using the categories tag:

```
<label for="category-group-name">Category Group Name</label>
{categories group_id="3"}
  <option value="{category_id}"{selected}>{category_name}</option>
  <label><input type="checkbox" name="category[]" value="{category_id}" {checked}=""> {category_name}</label>
{/categories}

```

---
Tags: categories, safecracker
---


title: How to send as gift with Expresso Store

text:
# Question
Title: How to send as gift with Expresso Store
How can I send an order as gift in Expresso Store? I tried the Gift Wrapping add-on but I'm not sure how to make it work.

Appreciate your help in achieving the above. Thanks!

# Answer
> 3 votes
I believe all you need for the basics of a gift order is the ability to have different billing and shipping addresses, which Expresso Store allows. So gifts can be done, you'd just want a custom field to capture 'Is this a Gift?' option.

The add-on, Gift Wrapping, that you mentioned above, seems as if it's more to provide an option, like, well… 'gift wrapping'. I mean, if you were going to charge, like Amazon and other stores do to have the item wrapped and a card added to it, rather than just shipping it to the person.

If you're not offering, gift wrapping— meaning you won't offer to wrap and add a card to a gift item, then I believe you can just add one or more custom fields related to how to handle a gift, such as 'Is this a gift?' and/or 'Include Receipt?'

---
Tags: expresso-store
---


title: conditional markup display

text:
# Question
Title: conditional markup display
I've got a CSS module that I only want to display on the page if there are entries in the channel.

```
{exp:channel:entries channel="staff" dynamic="no" limit="6" orderby="random" {gv_param_disable_default}}

{!-- don't want this part to loop but should only display once if entries exist --}
<section id="staff-module">
    <h2>Meet the staff</h2>
    <div id="staff-photies">

        {!-- this is the part we want to loop --}
        <a href="/about/meet-the-staff/">
            <figure>

                {exp:ce_img:single src="{cf_people_photo}" width="140" crop="yes" alt="{title}"}
                <figcaption>{title}</figcaption>
            </figure>
        </a>
{if count == total_results}
    </div>

</section>
<!-- // staff-module -->
{/if}
{/exp:channel:entries}

```

Am I missing something blatantly obvious in my conditional?

# Answer
> 4 votes
Yes, I was missing something obvious.

```
{if count == "1"}
<section id="staff-module">
<h2>Meet the staff</h2>
<div id="staff-photies">
{/if}

```

---
Tags: channel-entries, channel, loop
---


title: Channel Entries: DISTINCT and COUNT

text:
# Question
Title: Channel Entries: DISTINCT and COUNT
Given Channel entries, is there a way to get a list of unique entries in a text field and how many times that entry exist? For example, say the Channel contains the field `first_name` (FT is text) and there are 100 entries. I need to know how that "John" exist 20 times, "Jill" exist 50 times, and "Jane" exist 30 times.

One possible solution is to nest looping through the channel entries and enabling PHP in the template in order to build the result I need. This seems inefficient. Another option is to probably use the Query module, but that requires knowing which fields the data exist in -- which becomes a maintenance issue when fields are deleted and re-added.

Suggestions?

# Answer
While custom queries using the queries module will provide the most flexibility in designing a report like this, you may also want to take a look at NSM Reports. The goal of NSM Reports is to allow you to create custom reports faster, but store/save reports, and send reports to clients or automatically run a monthly report or so.

I've tended towards custom queries myself, so haven't used it before. But it's probably worth the look, if your going to allow fields to be randomly deleted. I believe it will pull a field list from ExpressionEngine for you.
> 2 votes

---
Tags: channel-entries, query
---


# Question
Title: Any ideas on how to link members to entries?
I'm planning a new site that will have a list of entries and a database of members (nothing unusual there I hear you say).

What I'm trying to work out is how to allow a member to express interest in one or more entries?

**The scenario would be something like this...**

* The member would log in
* They would then browse or search entries
* When they find one they like the could click a button to express interest in that entries
* They could then do the same for other entries if they choose
* Another member could then log in, browse entries and see which other members are interested in that entry

All thoughts will be gratefully received!

Any ideas?

# Answer
> 3 votes
Maybe LikEE, Like, Favorites or Shortlist would fit the bill?

---
Tags: channel-entries, members
---


# Question
Title: Playa and Zoo Visitors conditional to check a match does give an error
I use Zoo Visitors and the Zoo channel has a Playa field which relates to a Customers channel. A logged in user may only see entries he has been assigned to. The conditional to check if the customer entry to list has a parent to the logged in user fails.

```
{exp:channel:entries channel="customers" disable="categories|category_fields|pagination" dynamic="yes"}
{exp:playa:parents channel="zoo_visitor" status="not closed" disable="categories|category_fields|pagination"}
    {if "{username}" == "{logged_in_username"}"}There's a match{/if}
{/exp:playa:parents}
{/exp:channel:entries}

```

The error message says:

```
Parse error: syntax error, unexpected '}' in /serverpath/public_html/system/expressionengine/libraries/Functions.php(683) : eval()'d code on line 12

```

When I replace `{logged_in_username}` with a sample username like `testperson@mydomain.com` then the conditional does not break, it does find the match.

The conditional once worked. There where some software updates like EE to 2.5.5, Zoo Visitor to 1.3.21, Playa to 4.3.3 but reverting back to older versions did not help to solve

I need to find out if the logged in user is a parent in the Playa loop. How would I do this?

# Answer
> 1 votes
Not sure if it's a typo or not, but you've got an extra " in `"{logged_in_username"}"`.

---
Tags: conditionals, playa, zoo-visitor
---


title: Repeating field without using Matrix

text:
# Question
Title: Repeating field without using Matrix
Has anyone got a way to create a "repeating" field without using Matrix?

I kind of need Matrix's ability to create new "rows" but since each row would just have a single bit of text using Matrix seems like overkill.

The data will just be text and I *could* simply let the user add a comma delimited list of items but for the sake of neatness I would prefer them to enter each item in its own textbox then click to add another.

# Answer
Pixel and Tonic has another field\_type called P&T List which might be suitable. If you just need a list of items, I'd look at that. I believe it's free.
> 5 votes

# Answer
Nonprofit\_tech's suggestion of P&T List is a good one. If that is too light-weight, then there is **Grid Lite**, which is a free, pared-down Matrix clone.
> 4 votes

# Answer
Nolan would probably do what you need in that case. My understanding is that it's a Matrix Clone with not as much functionality as Matrix does. I've not personally used it before, but Iain is a pretty solid developer, so I'd be confident in its function.
> 1 votes

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


# Question
Title: Is there a free tool for the Rich Text Editor to embed youtube videos?
I'd like to be able to allow clients to use the Rich Text Editor to paste the embed code from youtube or vimeo. Instructing them to use "View Code" then paste is going to be difficult!

Is this possible natively, and if not does a free tool for the RTE exist?

# Answer
> 6 votes
As far as I'm aware there isn't a free plugin available currently that allows for this feature and it's not catered for out-of-the-box.

However it would be possible for a tool to be developed and added to the tool library - I've just taken a quick look though the `link` plugin - this could easily be adapted to work for YouTube / Vimeo links if you feel so inclined.

The full dev instructions for the API can be found here - http://ellislab.com/expressionengine/user-guide/development/rte\_tools.html \- however it's probably easiest to edit one of the existing tools in this case.

Alternatively DevDemon's Channel Videos is free and allows the user to instantly add videos - http://www.devdemon.com/channel\_videos/ \- however this wouldn't be integrated into RTE.

# Answer
> 2 votes
Channel Videos is a great solution for simplifying the process of embedding videos for clients.It has a visual interface so that the client can see a thumbnail of the video prior to publishing. You can search videos by keyword from the CP or just add the Youtube url - which is a lot easier than customising the embed code and copy/pasting.

Additionally you can set the variables for the video height/width etc within your templates which will prevent the end user from embedding videos that are too large or too small - that's something you could not control with a copy/paste of the embed code.

And it supports both Youtube and Vimeo.

---
Tags: wysiwyg, video, richtext
---


# Question
Title: Safecracker Registration: changing email address?
I'm using Safecracker Registration and was able to create a form with an `email` field. When a new email address is entered in it and the form is submitted, the Member's email is actually updated.

Is there a way to make EE not just instantly update the email, though? Shouldn't it first verify that the email is valid by sending an email with an activation link? That's how I have things set up for initial sign ups.

I don't think this is specifically a Safecracker Registration issue, but rather an EE one. However, I can't seem to find a "Members must verify email change" option in the CP. Thoughts?

# Answer
> 3 votes
This is really a limitation of the EE member module. Safecracker Registration works by converting the existing Member module to use Safecracker and channel entries, but it's all the Member module under the hood.

That is a good feature request and something I would have to implement on my own, since it's not supported by first-party libraries.

---
Tags: members, safecracker-registration, member-details
---


# Question
Title: Mystery {filedir_N} appearing in closing HTML tags
I have been tasked with upgrading EE for a new client. Upon viewing the content directly in the database - I am seeing, within each closing html tag {filedir\_15}.

For example:

```
<h3>This is some content<{filedir_15}h3>

```

It would appear, that at some point - someone created a File Upload Directory with a "URL of Upload Directory" of /. Sigh.

It would APPEAR that EE has replaced all forward slashes in the content with {filedir\_15}.

Has anyone seen this before? Is there any recourse? I'm afraid to simply delete the upload directory, because currently the forward facing site is not BROKEN because those forward slashes in the HTML are being added in (i'm assuming) through the standard replacement of the {filedir\_15} variable. If I remove that reference, the code will likely simply render with the filedir variable in place.

Any help would be greatly appreciated.

# Answer
I haven't seen this before, but we've never had anyone create an upload directory of `/.` before. My thoughts are you can do a FIND and REPLACE on template to correct, FIND `<{filedir_15}` and REPLACE with `</` that should take care of all the closing tags, but I'm not certain if there maybe other '/' that might get skipped.

I included the \< so that you specifically get all closing tags, but any other references to just `{filedir_15}` should remain, incase there are images or pdfs using the tag.

So…

1. Rename the file\_upload directory from / to whatever;
2. Use Find and Replace as specified above;
3. Assuming rename of / directory kept file path `{filedir_15}` your good, if not, you'd need to find the remaining `{filedir_15}` and replace with new `{filedir_xx}`

That should be it. Some tips…

This is relatively straight forward, but **backup your database**, then you can select the ALL TEMPLATES option in the FIND and REPLACE tool.
> 4 votes

---
Tags: file-uploads, wysiwyg, file-manager
---


# Question
Title: How do I remove the second segment from my URL?
I have a template group called "about-us" and within that group are 2 types of templates, one is called "about-content" and the other is called "where-and-when". I've noticed when I navigate to the page it displays this url "...about-us/about-content/where-and-when". But where I actually want the url to point is "about-us/where-and-when". I'm doing something wrong, and I can't figure out what it is. Its probably super simple and I'm going to feel like an idiot when you tell me the answer;)

here's my code:

```
{exp:channel:entries channel="content" disable="categories|member_data|pagination"     url_title_path="where-and-when"}
        <h2 class="section-header">{title}</h2>
        <p>{page_content}</p>
        <img src="{image}" alt="Franklin Vineyard Church" title="Franklin Vineyard Church"/>
        <p>{snp_when}</p>
        {snp_location}

{/exp:channel:entries}

```

I also have this code that displays links in the sidebar to other entries. I'm thinking this may be the problem, because I'm clicking the link in this div to get to the "where-and-when" page.

```
<h2 class="section-header">About Us</h2>
        {exp:channel:entries channel="content" dynamic="off"}
        {if url_title != last_segment}<li><a href="{title_permalink="about-us/about-content"}">{title}</a></li>{/if}
        {/exp:channel:entries}

```

# Answer
> 2 votes
If you're looking to have a URL structure of domain.com/about-us/where-and-when your sidebar would then need to have "about-content" removed as a segment. That should be all you need to change to have the links establish the URL structure you're looking for.

---
Tags: channel, url, url-title
---


# Question
Title: How can I have a username shorter than 4 characters?
I am trying to register a member with a two character username. Is this a possibility? I'd imagine I would need to hack the core, but is this a good idea? Where would I even get started with it?

# Answer
Indeed, not long ago this would require a core hack.

Not sure exactly when this was fixed, but anyway these days you can add the following to your config.php file:

```
$config['un_min_len'] = 2; // allow a username w/only two characters

```
> 5 votes

# Answer
You can override minimum username length with a config variable. You can also change the minimum password length too, but I suggest not:

```
$config['un_min_len'] = '2';
$config['pw_min_len'] = '5';

```
> 1 votes

---
Tags: members, users
---


# Question
Title: Building a set of list items using Stash. Not working as expected
A while back I built a simple image slider that used "featured" entries from an EE channel. This all works great but did mean that I had to run 2 {exp:entries} tag pairs - the first to get the big images, the second to get the thumbnails. The items were ordered by entry\_id so it all worked great.

I now need to randomise the order of the items in the slider - not normally a problem since I can just add an order\_by="random" parameter. The issue comes in that I'm using 2 tag pairs and need the order to be random but the same for both pairs.

I figured I could use a single entries tag pair, ordered randomly and use Stash to build a set of list items that I can use to output the image thumbnails but I'm having trouble getting it to output more than just one item.

Here's a slightly simplified code block showing the basic premise of what I'm trying to do. The only real difference is that I've removed the ce\_image tags for outputting the images themselves.

```
{exp:channel:entries channel="properties" dynamic="off" search:property-featured="=y" orderby="random"}

    {if {count}==1}<ul class="slides" id="slides">{/if}
        {!-- first output the big image --}
        <li><img src="{big-image}" alt="{alt-text}"></li>

        {!-- now I want to append a list item to a Stash variable for use a bit later --}
        {exp:stash:set append="yes" name="thumbs" parse_tags="yes" replace="no"}
            <li><a href="{file}"><img src="{small-image}" alt="{alt-text}"></a></li>
        {/exp:stash:set}

    {if "{count}"=="{total_results}"}
    </ul>

    <div id="slidethumbs">
        <a href="#" id="prev-slide" class="pager-arrow"><img src="/images/leftarrow.png" alt=""></a>
        <ul id="slidethumbs-list">

            {!-- this is where Stash should output the list items --}
            {exp:stash:get name="thumbs"}

        </ul>
        <a href="#" id="next-slide" class="pager-arrow"><img src="/images/rightarrow.png" alt=""></a>
    </div>

    {/if}
{/exp:channel:entries}

```

I haven't used Stash before so may be missing something obvious but I thought this was how Stash worked. Have I got the wrong end of the stick or am I simply overlooking something?

# Answer
> 4 votes
You are running into a parse order issue. Here is a somewhat simplified version of what you did but another way to approach it:

```
{exp:channel:entries channel="properties" dynamic="off" search:property-featured="=y" orderby="random"}
    {exp:stash:append name="big_images"}
        <li><img src="{big-image}" alt="{alt-text}"></li>
    {/exp:stash:append}

    {exp:stash:append name="thumbs"}
        <li><a href="{file}"><img src="{small-image}" alt="{alt-text}"></a></li>
    {/exp:stash:append}
{/exp:channel:entries}

<ul class="slides" id="slides">
    {exp:stash:get name="big_images" process="end"}
</ul>

<div id="slidethumbs">
    <a href="#" id="prev-slide" class="pager-arrow"><img src="/images/leftarrow.png" alt=""></a>
    <ul id="slidethumbs-list">
        {exp:stash:get name="thumbs" process="end"}
    </ul>
    <a href="#" id="next-slide" class="pager-arrow"><img src="/images/rightarrow.png" alt=""></a>
</div>

```

So you set the stashes in the channel entries, and then outside of it retrieve it.

---
Tags: channel-entries, stash, entries
---


# Question
Title: Using a Segment Variable to display all products with the same title in a Playa field
I've created a segment variable for brands that shows in the URL. I want to write an {if} statement that looks at the URL segment for brand and then brings back the products that match the playa field for brand. (ie. If the URL segment says BEAM I want to show all BEAM products that have been selected from the Playa filed). How do I go about doing this? Any suggestions?

Here's a very basic example. This doesn't include the code to only show products with the same name as {segment\_6}. Any suggestions? I hope this helps.

```
<!--I only want to show the code below if segment_6 has something-->
{if segment_6 != ""}
    {exp:store:search channel="products"}
        {exp:store:product entry_id="{entry_id}"}

                <!--I want all of this code to display the products that match segment_6 with the Playa field brand selected in an entry-->
                {exp:playa:children field="brand"}
                    <h1>{title}</h1>
                {/exp:playa:children}

                <!--this should also display based on the brand in the playa field above-->
                {product_description}
            {product_image}

        {/exp:store:product}
    {/exp:store:search}
{/if}

```

# Answer
> 1 votes
This is a shot in the dark as I'm still confused on how you have everything configured.

You could just pass the `{entry_id}` in the `{exp:playa:children}` playa tag and that would give you all related products that that entry created:

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

```

---
Tags: ee2, playa
---


# Question
Title: Auto generate a csv from Freeform 3.x on server.
how would one be able to get data collected in freeform into a csv on the server. So a CRM can access it via FTP.

Is this even possible? I know very little about cron jobs, is there a plugin that could handle this?

Thanks!

# Answer
> 2 votes
Typically when I've been grabbing a CSV from Freeform data, I've created a template and pulled the entries using the `{exp:freeform:entries}` tag, separating each Freeform field with a comma.

I'd then visit that page and 'Save As' while adding .csv to the file. In terms of automating it, have a look at http://devot-ee.com/add-ons/automatee if writing a cron job isn't your forte.

---
Tags: solspace-freeform, csv, automation
---


# Question
Title: Safecracker not creating entries with correct url for Structure
I am currently building a web app that allows users to create a list of their own contacts which are then stored as channel entries. This generally works fine however the Structure URLs are not being generated as expected.

I have created the form as below. The dynamic title is working and is being set on a simple jquery keyup handler. When I submit the form using ajax, the entry is created along with all the relevant data but rather than the entry being accessed at domain.com/channel/john-doe it is found directly at domain.com/john-doe.

I have gone as far as to use the Structure module's suggested additional tags:

```
<input type="hidden" name="structure_template_id" value="21" />
<input type="hidden" name="structure_parent_id" value="{structure:parent:entry_id}" />

```

but there was no joy and I simply experienced the exact same result. Any suggestions? Full code below (not including the additional structure fields).

```
{exp:safecracker channel="contacts" dynamic_title="[contact_name]" safecracker_head="no" include_jquery="no" return="safecracker/ENTRY_ID" json="yes" id="addContact"}

<input type="hidden" name="contact_list_designation" value="A" id="contact_list_designation"/>
<input type="hidden" name="contact_name">

<div class="content-bar bar light shiny top">
  <div class="section">
    <div class="center">
      <div>
        <div class="title">New Contact</div>
      </div>
    </div>
  </div>
</div>
<div class="grid-container fieldset-holder">
  <fieldset class="inline">
    <label class="grid-25">Type</label>
    <div class="grid-75">
      <div data-toggle="buttons-radio" class="buttonset cf block designation_radios">
        <div class="button grid-33 active-primary active"><span>A</span></div>
        <div class="button grid-33 active-primary"><span>B</span></div>
        <div class="button grid-33 active-primary"><span>C</span></div>
      </div>
    </div>
  </fieldset>

  <fieldset class="grid-50">
    <label>Firstname</label>
    <input type="text" name="contact_firstname">
  </fieldset>
  <fieldset class="grid-50">
    <label>Lastname</label>
    <input type="text" name="contact_lastname">
  </fieldset>
  <fieldset>
    <label>Company</label>
    <input type="text" name="contact_company">
  </fieldset>
  <fieldset>
    <label>Email</label>
    <input type="text" placeholder="name@example.com" name="contact_email">
  </fieldset>
</div>
{/exp:safecracker}

```

# Answer
```
<input type="hidden" name="structure_parent_id" value="{structure:parent:entry_id}" />

```

Yup, this will definitely be required for this to work with Structure ... but is `{structure:parent:entry_id}` outputting something usable inside your Safecracker form? Check in your rendered page's source, looking at that hidden field. Otherwise, Structure won't know that you want this entry to be assigned to a parent.
> 4 votes

---
Tags: safecracker, url, structure
---


# Question
Title: Need longer fields than EE natively allows
I have a couple of channels where I need to fit in more text than what EE natively allows. I was able to figure out how to change these fields from Text to Mediumtext, but when I upgraded from EE 1 to EE 2 those fields were reverted to Text and data lost. Fortunately, I was able to restore the missing data after redoing the edits, but I am wonder if there's any way to tell in advance when this will be an issue on an upgrade? Are field lengths reverted only on major version upgrades, for example?

I am also wondering if there are any add-ons available for handling such edits, should I need to redo them with each upgrade?

# Answer
> 4 votes
I believe the issue is only presented on major updates. EE2 changed the database structure of EE, including changing database table names, adding new tables and then repopulating them with data.

Generally, updates may add or delete fields (data columns), but don't do much to existing fields. We had modified a few fields size to MEDIUMTEXT and one or two to LONGTEXT for different clients and had the same issue with the EE2 upgrade, but no prior issues before that.

I think generally speaking, almost anything that is an update may contain minor database changes, but won't revert basic fields. Upgrades though can be a different beast. Ellis Lab was pretty good throughout all of 1.x to 1.7.3. I recall making the database modifications in the early days of EE1 and not a single problem until the upgrade to EE2.

Hindsight being 20/20, I of course realized that the database structure would be changed in EE2, I had just forgotten that I had modified the database myself before. But that's why backups are **very** important.

Truth is, in a major update such as EE2, I wouldn't have wanted to adjust all the INSERTS and ALTERS at the code level anyway, for fear that I would overlook something. So our process for clients was to backup, restore current database to our development server, then upgrade. Our original plans included running Navicat to compare the databases, but with the names of tables changing etc. that didn't really work. We ended up printing out table structure from old and new then modifying the new. This then required an INSERT of the fields data again, but worked.

To the best of my knowledge, I've never heard of any add-ons that would help for this situation. Any solution would need to be able to scan the update/upgrade files for specified database changes, but since EE is "shutdown" during the upgrade, I'm not certain if an add-on would work.

The Release Notes/Change Log for updates contains quite a bit of information that can be helpful in planning for the upgrade as well.

I think for most updates, *it's not a worry*. For major updates, I'd be concerned. But a quick look at the update file, from the `system/installer/updates/` folder would tell you if the database is being altered.

# Answer
> 1 votes
First things first:

* EE --\> Admin --\> Channels --\> Channel fields
* Choose the Channel field group you'd like to change.
* Select the field you'd like to change.
* Change the field type to Text input
* Adjust the maxlength to the value you'd like.

If that's not what you're looking for (you've tried it but still need more characters/ space) than it's time to dive into the database.

I would suggest using PHPMyAdmin. You're looking for `exp_channel_data`. Change the datatype of the custom field to whatever you like. Check http://dev.mysql.com/doc/refman/5.1/en/blob.html for a full reference on datatypes. If you know the id of the custom field it's really simple to find. Just look for `field_id_7` if your custum field id is 7.

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


title: Safecracker Registration Form

text:
# Question
Title: Safecracker Registration Form
I have gone to the steps in this page to setup safecracker registration module.

This is my form for registration.

```
{exp:safecracker
    channel="members"
    class="form-horizontal"
    dynamic_title="[email]"
    error_handling="inline"
    include_jquery="no"
    register_member="yes"
    return="index.php/sign-up/"
    safecracker_head="no"
}

    {if global_errors:count > 0}
    <div class="errors group tencol">
        <h3>General Errors</h3>

        <ul class="bullets">
        {global_errors}
            <li>{error}</li>
        {/global_errors}
        </ul>
    </div>
    {/if}

    {if field_errors:count > 0}
    <div class="errors group tencol">
        <h3>Form Errors</h3>

        <ul class="bullets">
        {field_errors}
            <li>{error}</li>
        {/field_errors}
        </ul>
    </div>
    {/if}

    <fieldset>
        <legend>Sign Up</legend>

        {stash:embed name="forms:fields:.email"}
        {stash:embed name="forms:fields:.password"}
        {stash:embed name="forms:fields:.password-confirm"}

        <div class="control-group">
            <div class="controls">
                <button type="submit" class="btn btn-primary">Register</button>
            </div>
        </div>

    </fieldset>

{/exp:safecracker}

```

When I try to submit with valid fields, I get redirected to index.php/sign-up with nothing displayed at all.

Keep in mind that this form is in index.php/sign-up which means it should redirect to itself.

I don't receive any emails at all which means that registration probably failed.

Am I doing anything wrong here?

# Answer
> 1 votes
Just wanted to make an official answer to this post. This error was due an architectural change in EE 2.5.5. Their (EllisLab) assumption was that other developers weren't using these classes. So to cope with them breaking the API in a maintenance release, I had to fork the code to support EE 2.5.5+ and anything prior.

If you email support\[at\]objectivehtml.com I will send you the latest copy to test before I release to the public.

EDIT:

**I have a fix for these issue now in my latest developer build. Just email me for the latest build.**

# Answer
> 1 votes
Try using `return="sign-up/index"`\- the `index.php` is not required, as EE already knows whether you're using index.php or not.

---
Tags: forms, safecracker-registration
---


# Question
Title: ObjectiveHTML's Authenticate - login and forgot password problems
I'm trying to use https://objectivehtml.com/authenticate and have come across some problems:

**Logon Form:**

1. How can I trigger a global error so I can verify `{global_errors}` work? See: https://objectivehtml.com/authenticate/documentation/tag/global-form-variables
2. How do I access a specific field error? `{field_errors}` does display the first error encountered in the form, but I can't seem to access a specific field error. I've tried `{error:email}` doesn't work for me.

**Forgot Password:**

1. How do I specify the form's class and return URL? See: https://objectivehtml.com/authenticate/documentation/tag/forgot-password

**Both Forms:**

1. How do I persist the form inputs when there is an error and the page is displayed again? I want the email and password to be persisted on form errors.

# Answer
> 2 votes
### Login Form

1. Global Errors are triggered after the form has been validation. So if all your required fields have values, and adhere to all the custom validation rules, it will pass the validation. So if your username and password is incorrect, that is a global variable and not assigned to any particular fields. Rather, it applies to all the fields. The core library behind all this is called Base\_form.php and it is used for a lot of different things. So Global Errors in Authenticate are different than another add-on.
2. This was a bug that fixed in the latest version (1.2.7). You could have used the `{field_error:your_field_name}` but that was not working correctly either. So I fixed all this and made a `{error:your_field}` variable in the process to make things easier.

### Forgot Password

The `class` attribute is global. There are bunch of undocumented parameters actually. I will try to document these next chance I get.

```
{exp:authenticate:forgot_password return="/some/url/path" class="your-class"}

```

### Both Forms

You can use the `post:` prefix, like so:

```
 <input type="text" name="email" value="{if post:email}{post:email}{/if}" id="email">

```

*The public repo for Authenticate has been updated. If you are having problems with Safecracker Registration and want the latest version, contact support\[at\]objectivehtml.com*

---
Tags: add-on, authenticate
---


# Question
Title: How to disable the multi category edit form
I do not wish my users to be able to edit category entries. I have hidden the category fields via the publish layout however they can still access the categories via the multi entry category editor by choosing either Add or Remove categories.

The users do not have any permissions to add/edit categories themselves but I wish to stop them assigning their own categories to their news articles.

Is there any way of disabling this functionality either natively or via a 3rd party extension. I use Better Workflow but this bypasses all of the draft/publish checks.

# Answer
After much exploration it doesn't look like this is possible via any existing add-on or natively. I resorted to editing the core file specifically in /system/expressionengine/controllers/cp/content\_edit.php adding a check for the member group as to whether to show the multi category editor on a per member group basis.
> 2 votes

# Answer
Not sure why you even have categories available if people aren't able to assign entries to them, but if you don't want people doing anything categories related, why not create a publish layout which has the categories tab removed completely?
> 1 votes

# Answer
You will find under each member groups permissions the ability to lock out each group from being able to edit/add categories: http://ellislab.com/expressionengine/user-guide/cp/members/member\_groups\_edit.html
> -1 votes

---
Tags: categories
---


# Question
Title: Conditional with category custom field, transcribe & low variables not working as expected
I'm building out a multi-language site using Transcribe which is coming along nicely. I'm having one issue with my navigation snippet (using low variables early parsing turned on).

I've got the following conditional working elsewhere in the site (in an embedded template)

```
{if '{transcribe:language_abbreviation}' =="en"}{category_name}{/if}{if '{transcribe:language_abbreviation}' =="fr"}{category_name_fr}{/if}

```

However when I use the same conditional inside the lv\_nav snippet it fails to render anything. Relevant code below:

```
{exp:channel:categories channel="people" style="linear"}
    <li><a href="{path='about/people'}">{if '{transcribe:language_abbreviation}' =="en"}{category_name}{/if}{if '{transcribe:language_abbreviation}' =="fr"}{category_name_fr}{/if}</a></li>
{/exp:channel:categories}

```

If instead of using the conditional I just use `{category_name}` everything works fine except that on the French pages I've got English displaying and not French.

Any ideas why this is happening? I've also tried replacing `{transcribe:language_abbreviation}` with `{exp:transcribe:language_abbreviation}` and there was no change.

# Answer
I'm not sure what type of variable `{transcribe:language_abbreviation}` is, but I presume it's an early parsed var, which could cause parsing issues. If both the LV and Transcribe var are parsed early, there's no way to control which one is parsed first in the same stage. There are 2 workarounds I can think of, assuming the Transcribe var is parsed early (which it is, according to the tag reference):

### Preload Replace

Use Preload Replace vars to define the language suffix for the categories, similar to the approach I explained in this blog post:

```
{if transcribe:language_abbreviation != 'en'}
    {preload_replace:pre_lang_suffix="_{transcribe:language_abbreviation}"}
{/if}
{if transcribe:language_abbreviation == 'en'}
    {preload_replace:pre_lang_suffix=""}
{/if}

```

Note that if the Transcribe vars are indeed early parsed vars, the simple conditional syntax should work. Using simple conditionals here is necessary; don't use the `{if:else}` statement.

Then use this inside your LV instead of the conditionals:

```
{exp:channel:categories channel="people" style="linear"}
    <li><a href="{path='about/people'}">{category_name{pre_lang_suffix}}</a></li>
{/exp:channel:categories}

```

You can then keep using the variable syntax for the LV: `{lv_nav}`

### LV Tag Syntax + Preparse

Another workaround would be to use LV's tag syntax and the `preparse:` parameter to pass on the Transcribe var. Something like this:

```
{exp:low_variables:single
    var="lv_nav"
    preparse:lang_abbr="{transcribe:language_abbreviation}"
}

```

And use the variable `{lang_abbr}` inside the LV instead of the full Transcribe variable:

```
{if lang_abbr == 'en'}
    {category_name}
{if:elseif lang_abbr == 'fr'}
    {category_name_fr}
{/if}

```

You should also be able to use the full Transcribe variable name with the preparse parameter:

```
{exp:low_variables:single
    var="lv_nav"
    preparse:transcribe:language_abbreviation="{transcribe:language_abbreviation}"
}

```

That way, you can leave the LV content as is.
> 7 votes

---
Tags: conditionals, template-scripting, multilingual
---


title: Accessibility of EE’s control panel

text:
# Question
Title: Accessibility of EE’s control panel
Do you have any experience with partial sighted or blind people using the EE control panel?

I'm very interested to know if there are any issues which might affect visually-impaired people when using ExpressionEngine. Thank you!

# Answer
We had a partially blind user for a client that had control panel access, primarily under ExpressionEngine 1, but a little with EE 2. We heard no complaints.

Now understand, I can't tell you how well, the Control Panel worked for him. I can just state, of the products we needed to make adjustments to for him, ExpressionEngine wasn't one of them. I just looked up publishing stats for him, and he published 243 items into the system which consisted mostly of either long newsletters or short headline news briefs.

Now there were products, outside of ExpressionEngine that we had to adapt for him. FileMaker Pro (FMP) being one of them. The desktop experience with FMP was not friendly for people with limited vision, but any database or data table could be made available on the web, and that was fully accessible for the visually impaired. We made the news and donor database web accessible for him.

Our experience with him and ExpressionEngine was pretty much, we provided our Quick Introduction Guide to the client's system as a PDF, then scheduled a telephone walk through, which is standard. He asked about a PC compatibility text editor, since the client was 98% Mac OS-based, but he wanted to continue using his pre-configured machine which was a Window's based laptop. Then, we never heard from him again, unless it was things like, 'I just published the January Newsletter and the photo from this event isn't displaying correctly.'

I wish I could say more, but since he never seemed to have any problems, we never had time to interact with him around what's using EE like for the visual impaired. But at 243 posts, he used the system pretty frequently while he was on staff.
> 1 votes

---
Tags: control-panel
---


title: How to populate Relationships

text:
# Question
Title: How to populate Relationships
I'd like to manually populate the relationships table with some data.

I can see the structure of the exp\_relationships table, which relates parent\_entries to children.

However, for a custom field set that has multiple relationships, I cannot see how EE ties the relationships to each custom relationship field.

It looks like there was a handy wiki for this exact task linked from here which EL have removed in the recent reshuffle: http://ellislab.com/forums/viewthread/165752/

Other than populating the exp\_relationships table, how can I relate those relationships to specific custom fields?

EDIT: Oh man - I cannot believe I've been so stupid - of course the relationship ID is tied to the relevant CF column in exp\_channel\_data!

# Answer
I know you sorted this out, but for others who may wind up here looking for details:

Say you have an entry with an `entry_id` of `10`. That entry's channel has a Relationship field with a `field_id` of `20`.

While editing that entry, you choose a child entry from your Relationship field, which has an `entry_id` of `50`.

You'll end up with these values in your database:

**exp\_relationships**
`rel_id`: 1 (incremental number generated each time a new relationship is created)
`rel_parent_id`: 10 (the entry you were editing)
`rel_child_id`: 50 (the entry you chose in the Relationship field)

**exp\_channel\_data**
`entry_id`: 10 (the entry you were editing)
`field_id_20`: 1 (the `rel_id` that was created above)
> 5 votes

# Answer
Oh man - I cannot believe I've been so stupid - of course the relationship ID is tied to the relevant CF column in exp\_channel\_data!
> 1 votes

---
Tags: custom-fields, mysql, relationships
---


# Question
Title: Character encoding issues when upgrading EE 1.7.3 to EE 2.5.5
I have an EE 1.7.3 with charset iso-8859-1. If i do the update all the umlauts in the browser show up as ?.

So I converted the data from the database (the whole database) 1.7.3 before the update to utf8. Now EE 2.5.5 cuts every string after an umlaut after the update.

I find no way to change the contents of 1.7.3 showing up correctly without typing all the content new.

Anybody had this problem before? Thanks!

# Answer
> 3 votes
I don't have an exact answer, but I had a problem similar to this. I was using Navicat and MAMP and I had character set issues in my local set up. I wrote a blog post about it for my own reference because it tripped me up several times. Not sure if this helps your issue though.

---
Tags: ee2, ee1, update, character-encoding
---


# Question
Title: How can I load different CSS files, depending on the channel?
I have four different channels and three different channel-specific CSS files (two get the same CSS). What's the best way to go about loading these CSS files depending on the channel?

NOTE: I'm using Structure, so my URI won't necessarily contain the channel information.

# Answer
I think the easiest way would be to make sure that your call to the css file is within your channel entries loop and that you name your css files the same as your channel short names.

```
{exp:channel:entries limit="1"}
<head>
 <link href="path/to/css/folder/{channel}_styles.css" rel="stylesheet" />
</head>
<body>
{title}
{other_channel_fields}
</body>
{/exp:channel:entries}

```

In this example your css file name would be "blog\_styles.css" and your channel would be "blog" for the sylesheet that is shared across multiple channels I would create a stylesheet for each channel shortname then I would `@import` another css file so you are not duplicating the styles across 2 templates.

If you are not serving a single entry make sure that you wrap your css file declaration in `{if count == 1}` like

```
{exp:channel:entries}
<head>
{if count == 1}
 <link href="path/to/css/folder/{channel}_styles.css" rel="stylesheet" />
{/if}
</head
{/exp:channel:entries}

```

I should also mention that you could also use the channel name in a conditional to load specific files.

```
{exp:channel:entries}
<head>
 {if channel == "blog"}
  <link href="path/to/blogs_css_file.css" rel="stylesheet" />
 {/if}
 {if channel == "about"}
  <link href="path/to/about_css_file.css" rel="stylesheet" />
 {/if}
</head>
{/exp:channel:entries}

```
> 9 votes

# Answer
It depends how your templates are put together, but in my case, I have a single embedded template which contains the overall layout so I would pass an embed variable e.g.

```
{embed="layout" css_file="your_file"}

```

and then in the layout template:

```
{if embed:css_file}<link href="{embed:css_file}">{/if}

```
> 3 votes

# Answer
Structure has a bunch of really useful global variables, which would make this even easier than using Stash or anything else really. Something like this:

```
<link href="/assets/css/{structure:page:channel}.css" rel="stylesheet" />

```

or if the channel name is not a 1:1 relationship...

```
{if structure:page:channel == "blue"}<link href="/assets/css/the-blue.css" rel="stylesheet" />{/if}

```
> 2 votes

# Answer
You might need to use some stash magic to pull out the channel url\_title and make sure you can put that in the CSS file name or use switchee to check cases and assign a specific CSS file is that condition is made.

**Note:** I don't think you've given us enough information to really give you a more complete answer. Can you give us a little more about your channel naming convention and the Structure URIs you have planned?
> 1 votes

# Answer
This is a situation where I would use Stash.

Following the Template Partials using Stash method, your wrapper template would be embedded in the template for a given page.

Inside the `{exp:channel:entries}` tag pair, you would set a Stash variable with the channel short name. The template would look something like this:

```
{embed="inc/.wrapper"}
{exp:channel:entries ... limit="1"}
    {exp:stash:set_value name="channel" value="{channel_short_name}"}
    ...
{/exp:channel:entries}

```

Then, the wrapper template could simply use the channel Stash variable to set the name of the CSS file:

```
<html>
    <head>
        <link href="path/to/{exp:stash:get name="channel"}.css" rel="stylesheet" />
...

```

This works very similarly to the `{embed=}` method above, except it works a bit more efficiently using Stash.
> 0 votes

---
Tags: channel, structure, css
---


title: EE GeoFinder plus EE Categories

text:
# Question
Title: EE GeoFinder plus EE Categories
So I'm trying to assign a class via {category\_url\_title} inside of a {exp:geofinder:location\_results} tag. The problem is now I have 2 loops. I tried several things like using {categories} tag pair by itself in the geofinder tag as well as a tagpair inside of a channel:entries tag. However, I still get similar, incorrect results. Chris Barrett/Mighty Big Robot doesn't seem to be offering much support on their site lately so I thought I would try here.

```
{exp:geofinder:location_results
channel="business"
status="not closed"
geoquery="{embed:address}"
radius="{embed:radius}"
latitude="{business_lat}"
longitude="{business_lng}"
distance_mode="miles"
limit="10"
}

    {exp:channel:categories
    entry_id="{entry_id}"
    show_empty="no"
    channel="business"
    status="not closed"
    limit="1"

    }

        <a href="/businesses/{url_title}" class="{category_url_title}">{title}</a>

    {/exp:channel:categories}

{/exp:geofinder:location_results}

```

Result:

NIXONMEDIA

NIXONMEDIA

TJ ROCKWELLS

TJ ROCKWELLS

LUCKY DUCKS

LUCKY DUCKS

Thoughts?

# Answer
> 3 votes
The Channel Categories tag is *not* for listing the categories associated with an entry. It is for listing all of your categories.

You'd need to do this instead:

```
{exp:channel:entries entry_id="{entry_id}" dynamic="no" channel="business" status="not closed" limit="1" disable="member_data|pagination|custom_fields"}
    {categories backspace="2"}<a href="{path="businesses/index"}" class="{category_url_title}">{category_name}</a>, {/categories}
{/exp:channel:entries}

```

This *should* work when directly nested like this, but if not you may have to place all that in an embedded template, and pass the `entry_id` as an embed parameter.

---
Tags: ee2, categories
---


# Question
Title: Safecracker Registration: Prevent auto-log in of member on register
When a member registers on my site, I want them to first verify their email address before they can log in the site. Right now, when a member registers, they are automatically logged in. Is there a way to prevent this? I don't see any option for this in Members Preferences.

FYI: I'm using Safecracker Registration and Membrr, too. Not sure if this matters.

**UPDATE 1:**

Clarification: the members are being logged in PRIOR to them verifying their email. The system is already set up in such a way that the user needs to verify their email address first. The problem is that their instantly logged in when they sign up (without having to click the activation link in their email).

# Answer
If you check out the Require Member Account Activation options in Membership Preferences section of the User Guide, you'll see the self-activation via email option which will do exactly what you're asking.

**UPDATE**

Based on additional feedback, the Safecracker Registration add-on being used was automatically logging the members in, even though their accounts weren't yet activated. Setting the `loggin_member="no"` parameter on the registration form resolved the issue.
> 2 votes

---
Tags: members, safecracker-registration
---