# Question
Title: how to show parent and children categories
I am trying to display the parent category as a heading and then display the children with links to a template that will display the entries form the child category. This is where I have started and I cannot get the children to display based on the dynamic segment 5 even using low's seg to cat.

```
    {exp:channel:categories channel="work" show_empty="yes" style="linear" parent_only="no" show="{last_segment_category_id}"}

PARENT CATEGORY as a heading.

<a href="{path='portfolio/page'}">Child Category <img src="{category_image}" border="0"/></a>
    <br style="clear:both;" />

             <a href="{path='portfolio/page'}">Child {category_name}</a>
<br style="clear:both;" />    <br style="clear:both;" /><br style="clear:both;" /><br style="clear:both;" />
        {/exp:channel:categories}

```

# Answer
The native categories tag pair's "show" parameter doesn't look recursively into the specified category - it's still a one-to-one filter, which would require you to pipe the child category IDs into it, even with the parents\_only param set to no (that only works if you are dynamically displaying the full array of categories within a category group, for example). You should be able to do what you're looking to do though by using GWCode Categories in concert with Seg2Cat, since GWCode Categories will allow you to specify a start point in your category tree and look recursively inward, using Seg2Cat to target the segment identifying your start point and convert it to an ID, as you've aimed to do with the native tag pair.
> 2 votes

---
Tags: categories
---


# Question
Title: Tagger Related Entries URLs With Structure
I have two structure listings channels called blog and articles. The content can relate between the two channels.

How can I get the correct page url inside the related content tag? Structure's {page\_url} doesn't work.

This is the current code:

```
{exp:tagger:entries tag="{segment_2}" custom_fields="article_content" limit="10" paginate="bottom"}
<h3><a href="{site_url}articles/{tagger:entry_url_title}">{tagger:entry_title}</a></h3>
{/exp:tagger:entries}

```

Basically I want the articles part of the url to dynamically change to either articles or blog based on Structure's url hierarchy.

# Answer
> 1 votes
Try updating to EE 2.6.1, there was an EE bug with page\_url: http://ellislab.com/expressionengine/user-guide/about/changelog.html#version-2-6-1

---
Tags: structure
---


title: Exclude content from loop

text:
# Question
Title: Exclude content from loop
I feel like I have seen a solution to my issue in the EE docs before, but now I can't find what I'm looking for. I would like to exclude some information from repeating inside of a channel entries loop, i.e. the header of the section. the reason for this is because i would like to display a different header-type depending on the amount of information that's returned (therefore, I can't just put the header outside of the loop).

In this example, I'd like **Upcoming Events** to appear only once, but i'd like the **ul** div to repeat:

```
{exp:channel:entries  site="default_site" channel="events" sort="asc" limit="8"}
    {if total_results == "7"}
        <h2>UPCOMING EVENTS</h2>
    {if:else}
        <h4>UPCOMING EVENTS</h4>
    {/if}
    <ul class="list">
        <li>{event_short_name}</li>
    </ul>
{/exp:channel:entries}

```

# Answer
If you have 7 results, with your code above, then total\_results will be 7 every time it goes around the loop, which is why you see UPCOMING EVENTS more than once.

Instead, try using

```
{if count==1}
    <h2>UPCOMING EVENTS</h2>
{/if}

```

To output something just at the start of the loop. You could put your conditional inside that one if you want to display a different heading depending on how many results there are.

```
{if count==1}
    {if total_results == "7"}
        <h2>UPCOMING EVENTS</h2>
    {if:else}
        <h4>UPCOMING EVENTS</h4>
    {/if}
{/if}

```
> 2 votes

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


# Question
Title: Stashing a tag to use with Solspace tag entries
I have a template that sets some stash values from a campign entry, such as campaigntag. This custom field is just a text input. What i'm then trying to do on the page is show a bunch of entries from another channel using the campaigntag as follows;

```
{exp:channel:entries
    channel="campaign"
    status="open"
    limit="1"
}
{exp:stash:set_value name="campaigntag" value="{campaign_tag}"}
{/exp:channel:entries}

{exp:tag:entries
    channel="event"
    status="open"
    orderby="title"
    sort="asc"
    paginate="bottom"
    limit="9"
    tag="{exp:stash:campaigntag}"
}
{title}
{/exp:tag:entries}

```

For some reason, I can't get any entries to display when I use a stash variable in the tag="". I can get results if I hard code the tag in here.

Wondered if someone might be able to help figure out what's going on.

Thanks.

# Answer
I tend to promote my Stash tags up to first-class citizens in terms of parse order - Something like this will put the Stash tags on an even footing, saving you from having to figure out complicated black magic parse-order convolutions like `parse="inward"`:

```
{exp:stash:set_list name="campaign-vars" parse_tags="yes"}
    {exp:channel:entries
        channel="campaign"
        status="open"
        limit="1"
    }
       {stash:campaigntag}{campaign_tag}{/stash:campaigntag}
       ...
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="campaign-vars"}
    {exp:tag:entries
        channel="event"
        status="open"
        orderby="title"
        sort="asc"
        paginate="bottom"
        limit="9"
        tag="{campaigntag}"
    }
       {title}
    {/exp:tag:entries}
{/exp:stash:get_list}

```
> 0 votes

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


title: Hide section if no Playa parent

text:
# Question
Title: Hide section if no Playa parent
I have a Playa relationship between my "News" and "Projects" channels. In a News entry, you can select a related Project, so "News" is the parent and "Projects" is the child.

I have the following code on my Project template, and it works correctly to show related News items. However, I would like to hide the entire section when there are no related News items. I thought perhaps wrapping the section with `{if no_parents}{if:else}...{/if}` would work, but I believe this type of statement must reside within the `{exp:playa:parents ... }` tag pair.

```
{!-- TO DO: put in logic to hide block if no related news --}
<!-- Sidebar Related News -->
<h4>Related News</h4>
<ul>
    {exp:playa:parents channel="News"}
    <li><a href="{page_url}">{title}</a></li>
    {/exp:playa:parents}
</ul>
<!-- Sidebar Related News::END -->

```

Is there something simple here I'm overlooking?

I am using ExpressionEngine version 2.5.3 and Playa version 4.4.2.

Thanks!

# Answer
You can do this:

```
{exp:playa:parents channel="News"}

  {if count == 1}
    <h4>Related News</h4>
    <ul>
  {/if}

      <li><a href="{page_url}">{title}</a></li>

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

{/exp:playa:parents}

```
> 6 votes

---
Tags: playa
---


# Question
Title: GW Code Categories: Variables Not Correct Inside {depthX_end} Tags
I want to output a list of Category A's child categories, then at the end of that list, display a link to Category A itself (`.review`):

```
<h1>Category A</h1>

<ul class="readings">
    <li><a href="topics/readings/cat-child-1">Category Child 1</a></li>
    <li><a href="topics/readings/cat-child-2">Category Child 2</a></li>
    <li><a href="topics/readings/cat-child-3">Category Child 3</a></li>
    <li class="review"><a href="topics/review/category-a">Category A Review</a></li>
</ul>

```

Basically just an upside-down category list. So I did this with GW Code Categories:

```
{exp:gwcode_categories
    cat_url_title='{segment_2}'
    style='linear'
    show_empty='no'
}
    {if depth2_start}
        <h1>{cat_name}</h1>

        <ul class="readings">
    {/if}

    {if depth == 3}
        <li><a href="{path='topics/readings/{cat_url_title}'}">{cat_name}</a></li>
    {/if}

    {if depth2_end}
        <li class="review"><a href="{path='topics/review/{cat_url_title}'}">{cat_name} Review</a></li>
        </ul>
    {/if}
{/exp:gwcode_categories}

```

This *almost* works perfectly, except for the `.review` list item at the end. Instead of displaying the URL and name of Category A (`depth2`), it displays the URL and name of the last *child* category (`depth3`).

What am I missing here?

# Answer
> 1 votes
Just to give you some idea of how this (and other add-ons work), it will loop through each matching category within the gwcode\_categories tag pair.

In your example it's looping through 4 times, once for Category A, then for Category Child 1 through to 3.

The logic of your template code is assuming there's a 5th loop which is Category A again closing. This isn't the case, all it is Category Child 3 but with the appropriate variables set to inform the template that not only does this end depth 3, but also depth 2. All the variables will still remain as Category Child 3 - which is why you can't output "{cat\_name} Review".

Luckily, GWCode has almost every variable you'll ever need and you want to utilise the parent variables. Change your last piece of code to:

```
{if depth2_end}
    <li class="review"><a href="{path='topics/review/{parent_url_title}'}">{parent_name} Review</a></li>
    </ul>
{/if}

```

---
Tags: gwcode-categories
---


title: Wygwam for EE v2.5.2

text:
# Question
Title: Wygwam for EE v2.5.2
I have tried to install the Wygwam 2.7.1 add-on module to my existing EE. When I go to edit or publish content through a channel that hasthe Wygwam as a field... it just looks like a regular textbox and not the usual awesome Wygwam tools I'm used to seeing... any ideas? If I try to remove the field type so I can re-install, it will delete ALL of my data...

# Answer
First thing’s first; check to make sure you have the `themes/third_party/wygwam` folder in its place. I can’t tell you how many times I’ve accidentally uploaded the `system` folder instead. After that, I would suggest you use your developer tools in your browser to see if JavaScript is failing to load, and if so, where it’s being requested from.
> 1 votes

---
Tags: add-on, wygwam, pixelandtonic, wysiwyg
---


# Question
Title: How to get a notification about what changed in an entry
When an entry on my site is changed, an email is fired off using MX Notify Control (http://devot-ee.com/add-ons/mx-notify-control)

This is great, but I have no idea what changed. Sometimes it was just one checkbox or it might have been the whole page was rewritten.

I would like to get a better feel of what is different. It would be great to have a Diff type view for text, but even if I knew what fields had changed it would be a great.

# Answer
There used to be an addon (for EE 1.x?) that was called Redline that would show the diff between entry versions.

Great to hear this is coming sometime in Better Workflow though!
> 4 votes

# Answer
In the Better Workflow support forum, it seems that this functionality is on their roadmap. Support Thread
> 2 votes

# Answer
I have built a small plug-in that lets you extract last version (well in fact supporting a whole set of queries) for comparison with current entry. Issue is really with custom field types that store their data in other tables... no version info...

If folks think it would be useful to have that for 2.x I would be happy to git-hub it....
> 1 votes

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


title: Ignore 'The' when sorting by title

text:
# Question
Title: Ignore 'The' when sorting by title
When sorting by title in channel results, is there a way to ignore the 'The'?

# Answer
> 6 votes
Low Alphabet will let you generate alphabetically ordered channel entries with the option to define ignore words like 'the' and 'a'.

# Answer
> 0 votes
For the sake of completeness, I'm posting this.

You *could* modify the core. Low Alphabet is a better solution, though.

In /system/expressionengine/modules/channel/mod.channel.php, search for:

```
case 'title' :
  $end .= "t.title";
break;

```

and change it to:

```
case 'title' :
  $end .= "TRIM(leading 'an ' FROM TRIM(leading 'a ' FROM  TRIM(leading 'the ' FROM LOWER(t.title))))";
break;

```

That'll ignore 'an', 'a' and 'the' from the start of titles in channel entries loops.

# Answer
> 0 votes
I've always instructed clients to remove 'the\_' or 'a\_' from the beginning of the URL title once they punch in the Title; I then sort the display of channel entries by URL title. They haven't seemed to mind it this way. It's good to know there's an addon available that eliminates that small bit of tedium, though.

---
Tags: ee2, channel-entries, channel
---


title: stylesheet tag and imports

text:
# Question
Title: stylesheet tag and imports
So I have an include template named '.head' in which I am calling my CSS like so:

```
<link rel="stylesheet" type="text/css" media="all" href="{stylesheet=assets/styles-css}" />

```

I was referencing the rest of the styles via imports at the top of that file like this:

```
@import url(//full-path-to-the-next-stylesheet-0.css);
@import url(//full-path-to-the-next-stylesheet-1.css);
@import url(//full-path-to-the-next-stylesheet-2.css);
@import url(//full-path-to-the-next-stylesheet-3.css);
@import url(//full-path-to-the-next-stylesheet-4.css);
@import url(//full-path-to-the-next-stylesheet-5.css);
@import url(//full-path-to-the-next-stylesheet-6.css);

```

This was fine when this was a static site. However, in EE I was getting mixed results by it 'sometimes' loading the styles and other times not. (Mostly not)

I thought maybe it would be better to just bring them all into EE and let it manage all stylesheets. Now I have this:

```
/*---------------------------------
IMPORTS
-----------------------------------*/
@import url("{stylesheet='assets/css-0'}");
@import url("{stylesheet='assets/css-1'}");
@import url("{stylesheet='assets/css-2'}");
@import url("{stylesheet='assets/css-3'}");
@import url("{stylesheet='assets/css-4'}");
@import url("{stylesheet='assets/css-5'}");
@import url("{stylesheet='assets/css-6'}");

```

The problem with that is that I end up having to change the first to `{path}` rather than `{stylesheet}` to use the `{stylesheet}` tag for the @imports.

This also takes FOREVER to load.

Long question now shortened...

What is the best way of handling this? I would like to use the native stylesheet tag for caching reasons.

Thanks in advance.

EE v2.5.5 - Build Date: 20121220

# Answer
> 1 votes
For speed and clarity, I would keep your css files outside of EE and also not use @import. Look into Automin (which I have used) or Minimee (haven't used, but great reviews), which should really speed up and simplify displaying your stylesheets.

For example, with Automin, you would use something like the following in your head (so to speak...):

```
{exp:automin:css
    attribute:type="text/css"
    attribute:title="default"
    attribute:rel="stylesheet"
    attribute:media="screen, projection"
}
    <link href="/css/core.css" type="text/css" title="default" rel="stylesheet" media="screen, projection">
    <link href="/css/design.css" type="text/css" title="default" rel="stylesheet" media="screen, projection">
{/exp:automin:css}

```

---
Tags: ee2, css, import, stylesheets
---


# Question
Title: safecracker hidden field status not working after upgrade (2.6)
```
<div class="lead-select">
    <label for="task_lead" class="select" style="margin-top: 12px;">Select Employee</label><br/>
    {field:task_lead}
    <input type="hidden" name="status" value="open">
</div>
<input type="submit" value="Submit">

```

The above code is what i have currently in my template. now the hidden field for changing the status to "open" will not submit. Is there something different in safecracker with the new version.

Just upgraded from 2.6

# Answer
> 1 votes
This is a bug and has been resolved here: https://support.ellislab.com/bugs/detail/19335

---
Tags: safecracker, upgrade
---


title: File Browser Navigation Menu broken

text:
# Question
Title: File Browser Navigation Menu broken
EE v2.5.0

Matrix 2.2.2.1

When I select ‘Add Image’ in a Matrix field, in the File Browser popup the navigation links are not correctly created and return a ‘404’, and the ‘Show files as’ select has no effect.

I'm not sure that this is a matrix problem as File Manager is a core component.

Any ideas?

# Answer
> 1 votes
Here we go: Firebug shows this-

```
"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/styles/matrix.css?2.5.4"

matrix.css?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/scripts/matrix.js?2.5.4"

matrix.js?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/scripts/matrix_conf.js?2.5.4"

matrix...s?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/styles/matrix.css?2.5.4"

matrix.css?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/scripts/matrix_text.js?2.5.4"

matrix...s?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/scripts/matrix.js?2.5.4"

matrix.js?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/scripts/matrix_text.js?2.5.4"

matrix...s?2.5.4

"NetworkError: 404 Not Found - http://w w w.DOMAIN.com/themes/third_party/matrix/scripts/matrix_conf.js?2.5.4"

matrix...s?2.5.4

ReferenceError: MatrixConf is not defined
[Break On This Error]

<script type="text/javascript">MatrixConf.EE2 = true;

index....up_id=4 (line 1100)

ReferenceError: MatrixConf is not defined
[Break On This Error]

<script type="text/javascript">MatrixConf.EE2 = true;

```

I would put images but for some reason stackexchange is asking me to have reputation 10. Total Absurd!

**Which means you have uploaded only 1st part to system and didnt upload second part to themes. It happen to me! Just upload correctly!**

---
Tags: matrix
---


# Question
Title: Stash and Cartthrob product options = Not added to cart
I've hit a wall with this one. I using Stash and template partials to set my page. Currently I am NOT caching anything.

I have products that have product options associated with them and I have tried several approaches to try at get this to work. The bottom line is, that if I have the Carthtrob {exp:cartthrob:item\_options entry\_id="{entry\_id}"} tag on the page, the product fails to add to the cart.

I have tried to use this as a standalone and use Stash to pass an entry ID, I've also tried to set it as a stash item {stash:product\_opt}code-here{/stash:product\_opt}.

Stash is parsing the tags and outputting them. I am presuming it is a delightful parse order issue! Another thing I have tried is to embed it and also use it as a snippet. No cigar sadly.

Has anyone come across this?

`{exp:stash:set_list name="{segment_1}-Product" parse_tags="yes" scope="site" save="no" replace="no" refresh="1440"}
{exp:channel:entries channel="products" status="open" url_title="{last_segment}"}`

````
{stash:title}{title}{/stash:title}

{stash:e_id}{entry_id}{/stash:e_id}

{stash:product_options}
{exp:cartthrob:item_options entry_id="{entry_id}" parse="inward"}
{if dynamic}
<dt>{option_label}</dt>
    <dd class="productOption">{input}</dd>
{if:else}

{if configuration} config{/if}
{if options_exist}
    {if configuration_label}{if:else} <dt>{option_label}</dt>{/if}
    <dd class="productOption">
        {select}
        <option {selected} value="{option_value}">
            {option_name}{if option_price_numeric > 0} +{option_price}{/if}
        </option>
        {/select}
    </dd>
    {/if}
{/if}
{/exp:cartthrob:item_options}
{/stash:product_options}

````

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

Many thanks

# Answer
> 1 votes
I've completed something similar but we captured all entries to a to a series of big stash lists then used `get_list name="{segment_1}-Product" match="#{last_segment}#" against="urltitle"}` to pull in the relevant item or series of items.

This is the base theory we used, **you'll have to experiment** to get it to work in your scenario...

```
//Just capture the elements you require, leave styling to later…
//Set depth to 2, we're parsing exp:channel + also getting nested info from item:options
{exp:stash:set_list name="{segment_1}-Product" parse_tags="yes" scope="site" parse_depth="2"save="no" replace="no" refresh="1440"} {exp:channel:entries channel="products" status="open" url_title="{last_segment}"}
    {stash:title}{title}{/stash:title}
    {stash:urltitle}{url_title}{/stash:urltitle}
    {stash:e_id}{entry_id}{/stash:e_id}
    //Capture the options as a nested list
    {exp:stash:set_list:nested name="product_options{entry_id}" parse_tags="yes" scope="site"}
        {exp:cartthrob:item_options entry_id="{entry_id}" parse="inward"}
            {stash:optionlabel}{option_label}{/stash:optionlabel}
            {stash:optionname}{option_name}{/stash:optionname}
            {stash:optionvalue}{option_value}{/stash:optionvalue}
            {stash:optionprice}{option_price}{/stash:optionprice}
        {/exp:cartthrob:item_options}
    {/exp:stash:set_list:nested}
{/exp:channel:entries}
{/exp:stash:set_list}

//Grab the list and format it however you choose…
{exp:stash:get_list name="{segment_1}-Product" scope="site"}
    <h1>{title}</h1>
    <p>{e_id}</p>
    {exp:stash:get_list:nested name="product_options{entry_id}" scope="site"}
    Label: {option_label}
    Name: {optionname}  Value: {optionvalue} Price: {optionprice}<br>
    {/exp:stash:get_list:nested}
{/exp:stash:get_list}

```

---
Tags: cartthrob, stash
---


# Question
Title: Can't login to control panel on EE 1.6.8 site
Very old client we did a pro-bono site for tracked me down and is having problems logging into the control panel of their EE 1.6.8 site. When the login is filled out and submitted it just takes you back to the login screen. I've seen this before and usually just clearing the cache works, but it's not working in multiple browsers even after clearing the cache. Any ideas?

# Answer
Go to your `config.php` file. If you're using cookies, sessions, or both, switch to a different option. For example, if you were using sessions, switch it to cookies only, then try to login.

I'd also check with the ISP, to see if they updated the servers version of PHP. If the client isn't prepared to upgrade to EE2, then at least they should upgrade to EE 1.7.3. I know between 1.6.8 and 1.7.3 compatibility for MySQL 5.5 was introduced, so it's also possible that some PHP compatibility issues were also addressed.

The thing is, with software like pMachine or EE 1.x, while they are pretty solid pieces of software, that don't need to be upgraded (generally speaking), they also run on servers, that will be continually upgraded (if the ISP is responsible), which means they will eventually stop running. So upgrading to the most current version **you can** is good.

It doesn't have to be EE 2.6.1, but EE 1.6.8 should probably become EE 1.7.3, with a warning that they'll probably need to migrate to EE2.x sometime within the next year or two.
> 1 votes

---
Tags: control-panel, ee1, login
---


# Question
Title: How to add a different style to the first 2 entries in a channel call
I want to add a different class and fields to the 1st and 2nd entries produced from the channel entries call.

I then want the rest of the entries on the page to be the same style, that style should then continue in the pagination, the 1st and 2nd entries should not be styled differently on the pagination pages.

I have tried using {if count == '1'} and {if count == '2'}, and {if absolute\_count == '1'} and {if absolute\_count == '2'}, but the pagination also styled the first and second entry.

My scenario is the first entry will be large than the rest and contain different information, so different fields need to be outputted with this. Also the second entry will be slightly different too.

Any help on how i could get this working would be great.

# Answer
> 0 votes
absolute\_count is the right variable to use, as it should give you the count of the entry relative to the total number of entries available within the entries loop, ignoring pagination (whereas count resets for each pagination). So I'm surprised that the second example you provided didn't work.

The way I ordinarily handle such a condition is with the switchee add-on - it early parses the outer conditional (using switch case) and therein avoids parsing the inside of the condition/case that isn't satisfied.

So in this way, the setup would look like this:

```
 {exp:channel:entries channel="whatever" orderby="date" sort="desc" dynamic="no" disable="whatever|not|needed"}
     {exp:switchee parse="inward" var="{absolute_count}"}
       {case value="1|2"}
         first and second entries
       {/case}
       {case default="yes"}
         all other entries
       {/case}
     {/exp:switchee}
 {/exp:channel:entries}

```

Given that the larger ones would contain different info, it may be a little more than just applying a different class to absolute 1 and 2 and instead your different content markup would be contained between the two cases - the first matching 1 and 2 in your absolute count and the second matching all others that do not satisfy the first case.

Hope this helps.

---
Tags: channel-entries, ifelse
---


# Question
Title: Calendar Module Tag {date} variable not correct
I have setup a calendar using the native calendar module tag. The date variable {date format="%F %Y"} renders as APRIL 2013. Shouldn't it be rendering as May 2013? The url points to /2013/05 as the last two segments. Any logic behind this that I missed?

Cheers

edited here is the template code:

```
{exp:channel:calendar channel="daily_posts"}

        <table class="calendarBG" border="0" cellpadding="6" cellspacing="1" summary="My Calendar">
            <tr class="calendarHeader">
                <th>
                    <div class="calendarMonthLinks"><a href="{previous_path='month/index'}"><<</a>
                    </div>
                </th>
                <th colspan="5">
                    <h2>{date format="%F %Y"}</h2>
                 </th>
                <th>
                    <div class="calendarMonthLinks">
                        <a class="calendarMonthLinks" href="{next_path='month/index'}">>></a>
                    </div>
                </th>
            </tr>
            <tr>
            {calendar_heading}
            <th class="calendarDayHeading">{lang:weekday_long}</th>
            {/calendar_heading}
            </tr>
            {calendar_rows}
                {row_start}<tr>{/row_start}
                {if entries}
                    <td class='{switch}' align='center'>
                        {entries}
                            <a href="/story/{entry_id}">
                                <span class="date">{entry_date format="%j %M %d"}</span>
                                <span class="day">{day_number}</span>
                                <img src="/assets/img/painting-nails.jpg" alt="">
                            </a>
                        {/entries}
                    </td>
                {/if}
                {if not_entries}
                    <td class='{switch}' align='center'>{day_number}</td>
                {/if}
                {if blank}
                    <td class='calendarBlank'>{day_number}</td>
                {/if}
                {row_end}</tr>{/row_end}
            {/calendar_rows}
         </table>
    {/exp:channel:calendar}

```

# Answer
> 1 votes
When testing the site on a dev server the month displayed correctly. So I assume the issue was related to me local setup.

---
Tags: calendar
---


# Question
Title: Editor doesnt show up as it should in SC
Because of the missing "usage" docs in DevDemons site, i dunno what i need to do to get the Editor shown in SC form.

I thought this would do the trick but it was a no-go:

```
<p>
                        <label ><h3>Body</h3>< /label ><br />
                        <textarea name="edtr_body" rows="10" cols="50" style="width:90%; background-color:#b3c1cd;"></textarea>
                    </p>

```

Someone for sure can tell how to add this fieldtype to SC? Thanks.

PS: i am using html5 template.

# Answer
> 1 votes
Well ok. It was as simple as to change the \< textarea NAME -\> ID. and it shows up. Thank you!

---
Tags: safecracker, editor
---


# Question
Title: How to find if an entry has parents (Playa) in a particular channel?
Within my channel entries loop, I'm trying to determine if an entry has FAqs; which in this situation are the parent as you choose an entry in the FAQ.

This is what I have: `{if '{exp:playa:total_parents channel="faqs" entry_id="{entry_id}"}' > 0}`

Which works-ish. It returns true for entries with no parent FAQs too. What am I doing wrong?

edit:

Parse order is set to input due to having some necessary PHP.

```
{exp:channel:entries channel="products" entry_id="<?php echo $entry_id; ?>" limit="1" dynamic="no" disable="categories|member_data|pagination"}
    {if {exp:playa:total_parents channel="faqs"} > 0}
        blah blah
    {/if}
{/exp:channel:entries}

```

Blah blah in this particular case returns whether or not there actually are FAQs.

# Answer
If your total\_parents loop is inside your entries loop, you shouldn't need the entry id param since it defaults to that. So you should be able to do this:

```
{exp:channel:entries channel="my_channel" limit="1" dynamic="no" disable="whatever|not|needed" orderby="date" sort="desc"}
    {if '{exp:playa:total_parents channel="faqs" dynamic="no" disable="whatever|not|needed" orderby="date" sort="desc"}' > '0'}
        whatever you want if there are parent entries
    {/if}
{/exp:channel:entries}

```

This works only if the playa field is in the FAQ field group and that field is assigned to the channel used by your loop - is that where you have it?
> 1 votes

---
Tags: add-on, playa
---


title: Assets not shrinking too-large files

text:
# Question
Title: Assets not shrinking too-large files
Assets isn't resizing my too-large files as it should per the Upload Destination's maximum dimensions (reference here). I have this for an upload destination:

```
Upload Destination: General Images
Maximum Image Width (in pixels): 1600
Maximum Image Height (in pixels): 1600

```

Yet I am able to upload an image with the dimensions 3264 x 2448 and it does not resize it. This used to work just fine, and I've left it alone for a while, so it was a surprise that it's now not working.

(Incidentally, the reason I noticed it is because it caused a CE Image error. But that's a topic for another post.)

Anyone have any ideas?

**Update:** I am using ExpressionEngine 2.5.3, Assets 2.1, and CE Image 2.4.3. Local image storage (not S3). Also, my intention with the image resizing on upload was only to shrink files that are way too large to a manageable size (1600 px max in either dimension). Then the actual page-by-page image sizing would be handled by CE Image.

**Update 2:** I made a standalone phpinfo file and checked it. GD Support is "enabled", and GD Version is "bundled (2.0.34 compatible)".

# Answer
Apparently this was a bug in Assets which has been fixed as of Assets 2.1.2 (see changelog here).
> 0 votes

---
Tags: assets, image, ce-image, uploads
---


title: Automated regular member notifications

text:
# Question
Title: Automated regular member notifications
My client wants members on their site to regularly update their profiles (to prevent them going stale), and I've been thinking about the best way to handle notifications for this. One idea was a simple 'subscription' model, where after a certain time has elapsed from the last update (say 3 months), if a profile has remains unedited, ee sends out an email to the member encouraging them to log in and update it. The site is free, so there's no need for payment gateways... so Cartthrob's subscription handling would be overkill. I also looked at Memberr, but again it's too complex for this simple task. I'm just really wondering how best to automatically check member accounts regularly and send notifications to account holders.

One idea might be to have a hidden template that I request nightly with a cron that queries account dates and sends out automated notifications that way? My only issue with that is that it's not really handled within the CP. I don't have any experience of developing modules, only plugins.

I'm planning to use Zoo visitor to handle member data rather than the native member module (don't know if this makes any difference!)

If anyone has any experience of doing something like this I'd love to hear how you handled it!

# Answer
> 2 votes
Sure. The tough part is determining when they have in fact updated their profile. Since you're using Zoo Visitor, you could use the "last updated" date of their member channel entry, but what if it was an admin who updated it - does that make a difference?

Regardless, here's the broad strokes (no code) for an add-on that would *notify* users every X interval, asking them to update their profiles (not necessarily based on when the last update was actually made). It should give you the the gist of how it would work.

* Create a custom module and extension (start at pkg.io, and read the module docs and extension docs)
* Create a new database table (say, `exp_members_last_updated`), which has two columns, `member_id` and `last_updated` (this will store a UNIX timestamp)
* Use the `member_create_end` and `member_delete` extension hooks to insert/remove each member into/from your table as they are created/deleted
* Write a function/method in your module file which queries your table, grabbing all `member_id`s whose `last_updated` is at least X seconds ago
* For each of those, grab their email address from `exp_members`, and send them an email (using EE's Email class)
* After sending the email, update their record in your custom table with the current time (`$this->EE->localize->now`)
* That module needs to have an "action", which is linked to the above method within your module class - then you can run the script as a cron job with `http://yoursite.com/?ACT=XX`

# Answer
> 2 votes
I would use Postmaster for this. You are going to have to write some code either way, so you might as well harness a proper API that was build exactly for this same thing. I would use the Notifications API. You could even follow similar logic to Derek, as I have done the same exact thing with CartThrob Abandoned Cart Notifications. So instead of CT Abandoned Shopping Carts, you would just use similar logic to create an "Outdated Member Profiles" Notification.

Best part about this, is you don't even have to write the code to send the email. Postmaster does all that for you. You just need to write the logic to figure out which users need a notifications.

https://objectivehtml.com/postmaster

# Answer
> 0 votes
Though you should probably build this as an EE add-on you don't technically *need* to.

You could write a simple PHP script that queries EE's database and grabs the email address of any account that hasn't been updated. Then send an email using PHP's own email functions. It doesn't have to be anything to do with EE.

The trick is going to be how to determine when a profile was last updated as I'm not sure this info is stored anywhere.

---
Tags: notification
---


title: Uploading Large Files

text:
# Question
Title: Uploading Large Files
Currently working on a site that will be making audio files available to their membership. My Resource channel has a Channel Files field ("Audio") to upload such files. Originally I was going to upload these files to a folder above root for additional security. When that didn't work, I changed it to a regular folder within the site. That still doesn't work.

When I try to upload a large MP3 file (~ 20-25MB), it goes all the way through the process, then I get an error that says

`Upload request failed, no HTTP 200 Return Code! OPEN ERROR`

When I open the error, I simply get a message that says

```
Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

```

I tried skipping Channel Files and tried to upload the same file through File Manager, and also got the "Internal Server Error" message.

This is on a dedicated server, so I have full access to everything. My php.ini settings show

```
asp_tags = Off
include_path = ".:"
ignore_repeated_source = Off
variables_order = "GPCS"
track_errors = Off
output_buffering = 4096
auto_globals_jit = On
doc_root =
log_errors = On
safe_mode_allowed_env_vars = PHP_
safe_mode_protected_env_vars = LD_LIBRARY_PATH
auto_append_file =
disable_classes =
display_startup_errors = Off
user_dir =
enable_dl = Off
register_argc_argv = Off
display_errors = Off
open_basedir = none
allow_call_time_pass_reference = Off
safe_mode_exec_dir =
default_socket_timeout = 60
html_errors = Off
register_globals = Off
unserialize_callback_func =
y2k_compliance = On
magic_quotes_runtime = Off
expose_php = Off
log_errors_max_len = 1024
post_max_size = 150M
report_memleaks = On
engine = On
memory_limit = 128M
short_open_tag = On
max_execution_time = 800
safe_mode_include_dir =
serialize_precision = 100
precision = 14
upload_max_filesize = 150M
register_long_arrays = Off
safe_mode = off
zlib.output_compression = Off
ignore_repeated_errors = Off
request_order = "GP"
default_mimetype = "text/html"
allow_url_include = Off
disable_functions =
file_uploads = On
magic_quotes_sybase = Off
max_input_time = 800
magic_quotes_gpc = Off
error_reporting = E_ALL & ~E_DEPRECATED
safe_mode_gid = Off
auto_prepend_file =
implicit_flush = Off
allow_url_fopen = On

```

I tested it with uploading a 5MB MP3 file and some smaller .txt and .wav files.

Anything obvious that I'm missing or could try?

Thanks!

# Answer
> 1 votes
OK, thanks to a persistent support team at my host (Codero), they were able to track down the issue. They said since I was running PHP through FastCGI, it was an Apache error that was causing the problem. They made changes to the domainvirtualhost.php file and I am now able to upload 35MB + files.

---
Tags: file-uploads, channel-files
---


title: Add "shortcode" drop down to WYGWAM

text:
# Question
Title: Add "shortcode" drop down to WYGWAM
Looking to build a Wordpress inspired "shortcode" for my EE editors to insert stylized content since they can't design their way out of paper bag. I'd like to put these shortcodes into a dropdown on my WYGWAM editors. Basically just a drop-down list that would paste in a series of Global EE variables into the editor instance.

Example:

```
[DROP DOWN]
-----------
1 Column (value would paste in something like: {column1} Put your info here {/column1}

2 Column

3 Column

4 Column

```

I know I likely need to dive into the CKEditor config.js and link to a new plugin of some sort. Did some searching and found something someone is working on for CKEditor 4, but not sure what that is going to do with WYGWAM and I believe they are still using CK3.

Any help or insight would be greatly appreciated.

Thanks, Geoff

# Answer
> 1 votes
Have you looked at ShortCode? I haven't used it yet myself, but the developer is rock solid and provides excellent support for his other addons.

---
Tags: pixelandtonic, wygwam, drop-down
---


title: Replacing existing file with assets

text:
# Question
Title: Replacing existing file with assets
according to the Pixel & Tonic site Assets is capable of doing an replacement of existing files based on filename. It should allow to upload a new version with the same name (providing me with a choice of replacement) and without breaking existing entries' file links.

However that does not seem to work on my install (EE 2.5.5 and Assets 2.1.2 - coming from 2.0.5 and hoping that upgrading would solve my problem), Assets just creates a new file with a and '-1' suffix in the filename

Any thoughts? rg, Tim

# Answer
Just as a follow up for people dealing with the same issue. Pixel & Tonic have confirmed this issue and it will be resolved in the next release 2.1.3

This update will normally will be released in the week of the 13th of May

rg,

Tim
> 0 votes

---
Tags: assets
---


# Question
Title: Expresso Store: Limit shipping to UK only, but accept payments from everywhere
For the time being, I'd like to set my store to allow shipping only to UK addresses, but I'd like to accept payments from everywhere (so people can send gifts to those in the UK).

I have only two shipping methods: Free shipping (which will later become a flat fee) and Collect In-Store. Both of these are set/apply to UK only, but my overall Countries/Regions has all countries enabled. This isn't achieving what I want, as every country is selectable on Checkout2 under Shipping Details.

How do I exclude all other countries from shipping but not billing?

# Answer
Just hard code the shipping address in your template:

```
<!-- shipping address, city, etc here -->
<p>
  Shipping Country: United Kingdom<br>
  <small>Sorry, we are only able to offer shipping to the UK at this time.</small>
  <input type="hidden" name="shipping_country" value="gb" />
</p>

```
> 0 votes

# Answer
If shipping and collection is only to the UK then just hide the country select box from the Shipping Address section and ensure that the Regions listed are those within the UK.

You can either hide the field with a little CSS in `display: 'none'` or simply hide the input field with by adding `input type="hidden"`.

Whilst posting this I see that Adrian has mentioned that latter. :)

In Store \> Settings \> Countries/Regions make sure all the UK regions are listed and correct. These are derived from EE itself and they were out of date prior to the latest release (2.6). I submitted a request a while back to have them updated and have been told they've made it into the latest release but haven't checked them yet.
> 0 votes

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


# Question
Title: Site Error: Unable to Load Site Preferences in MSM site
I recently installed a version of EE on my local machine(Mamp Pro), v2.5.5 - Build Date: 20121220. I set this site up as per usual and started building my initial site templates etc ready for the master site which would encompass all the other child sites with MSM.

I then installed MSM by buying the software license and then enabling it in the main general settings of the cp in my site. I then created a new sub domain with MAMP PRO and then added a folder in it with index.php and admin.php, I then changed these settings in each:

index.php

```
$system_path = '../build/system/';
$assign_to_config['site_name']  = 'mysitename';
$assign_to_config['cp_url'] = 'http://missns:8888/admin.php';
$assign_to_config['site_url'] = 'http://missns:8888';

```

admin.php

```
$system_path = '../build/system/';
$assign_to_config['site_name'] = 'mysitename';
$assign_to_config['cp_url']    = 'http://missns:8888/admin.php';

```

When I try to access

```
http://missns:8888/admin.php or http://missns:8888

```

I get this error:

```
Site Error: Unable to Load Site Preferences; No Preferences Found for: mysite

```

Then in my main cp site theme where my main site is installed I go to the top right of the site and click my master site name and click 'edit sites', I then just get a server error page that takes me out of my site, it basically blows up.

# Answer
Have you set things up following the instructions in EE docs?

Ensure that you have the relevant permissions on to allow access to your installations system folder:

> The new folder must allow files within it to access your installation’s system folder. Check with your host to ensure you don’t have “open\_basedir” or other restrictions in place which could prevent this.

Also, maybe try providing the virtual host name if you're setting this up locally. So instead of:

```
$system_path = '../build/system/';

```

Try:

```
$system_path = 'domain1.com/system/';

```

Where domain1.com is the name of your local virtualhost.

Also, make sure you make the changes to both sub domains as indicated in the docs.
> 1 votes

---
Tags: multi-site-manager, php, php-errors, localhost
---


# Question
Title: Add row not working for Matrix field in Safecracker form
I'm building a safecracker frontend form that allow members to update certain objects. This form uses a matrix field for managing opening hours of shops

The matrix field displays fine and existing data can be update without any problem. However the '+' sign does not seem to work to add new rows.

It believe it is a javascript problem as the console show

```
Uncaught TypeError: Object [object Object] has no method 'markItUp'

```

What can be wrong?

rg,

Tim

# Answer
> 2 votes
You're probably including jquery twice on the same page. Use safecracker's `include_jquery="no"` parameter. Also, be sure to include jQuery before any safecracker code. If you want to place all scripts at the bottom of the body, you can use Stash to grab the {safecracker\_head} variable and place it wherever you like.

https://github.com/croxton/Stash/

---
Tags: matrix, safecracker
---


# Question
Title: Removing rows in matrix when having required fields with Safecracker forms
I have multiple matrix fields in the multiple channels. In most channels the fields (columns) are not required. In these cases removing rows means making sure all fields for the row are emptied.

I do have matrix field however that have required fields (columns). I can't seem to find any way to remove a row completely. I would have expected a '-' button, similar to the '+' button, but there is none.

I can hardly believe this functionality is missing, so I must be missing something

Tim

# Answer
> 0 votes
Hover over the number at the start of the matrix row and click on the downward arrow that appears. You'll then get the option to delete row. It's subtle, but it's there. :)

# Answer
> 0 votes
The normal functionality available in the CP (as Jean St-Amand pointed out above) is actually available in the same way on the SafeCracker forms. In my case I had loaded my own jQuery which is not compatible with the jQuery needs of Matrix/Safecracker. If I use the one included with SafeCracker all is well!

T

---
Tags: matrix
---


title: Conditional variable error

text:
# Question
Title: Conditional variable error
I previously asked a question about this, but the question itself has kind of changed, and I don't know if anyone's still following it to begin with.

This is the error I'm seeing:

> \[06-May-2013 10:50:12\] PHP User Warning: Invalid EE Conditional Variable: {if "N"original"$1.50" != ""} in C:\gitRepo\qo5phi\system\expressionengine\libraries\Functions.php on line 2843

I found that the error was being thrown by a custom exception built into expression engine that will do partial matches on variable names if it doesn't find the original one.

From libraries/Functions.php:

```
// There is a partial variable match being done
// because they are doing something like segment_11
// when there is no such variable but there is a segment_1
// echo  $x[$j]."\n<br />\n";
trigger_error('Invalid EE Conditional Variable: '.$matches[0][$i], E_USER_WARNING);

```

So in certain iterations of the loop, it's not finding `deal_original_price`, so it's trying to do a partial match and is finding `deal`, which evaluates to N in these cases. (As is indicated by the error message.)

I don't know why it's even trying to evaluate `deal_original_price` in these cases, though, because the entire conditional call is inside another conditional that only runs if `deal` is Y.

```
{if deal == "Y" AND coupon == "N"}
    <tr data-deal_id="{deal_id}">
        <td class="productPrice" style="vertical-align: top;">${deal_total}<br />
             <!-- this next line is the one throwing the error -->
            {if deal_original_price && deal_original_price != "" && deal_original_price <> deal_total}
                <span class="originalDealPrice">${deal_original_price}</span><br /><span id="modal_change">Why is there a price difference?</span>
            {if:else}
                <span id="modal_same">Pricing Terms & Conditions</span>
            {/if}
        </td>
    </tr>
{/if}

```

Any ideas?

# Answer
What finally worked for me was this:

Instead of using a long conditional containing variables that have similar names to others, I did my conditional processing in my controller and passed back a variable that already knows the answer.

From this:

```
{if deal_original_price && deal_original_price != "" && deal_original_price <> deal_total}

```

To this:

```
  {if costChange == 1}

```

I also renamed all of my variables to be completely original - i.e. not share ANY part of the variable name with any other variable. I'm sure it's a hack that will have EE gurus yelling, but sometimes you just need to do what works.
> 0 votes

# Answer
> I don't know why it's even trying to evaluate deal\_original\_price in these cases, though, because the entire conditional call is inside another conditional that only runs if deal is Y.

Because EE will parse the template first before acting upon any conditionals, so it will parse the inner conditional variables, even if they are never implemented due to the outer conditionals.

Although I'm surprised you're getting the error you are, I expect it's the way you're using complex conditionals without correctly referencing the variables, therefore EE is having trouble.

Try doing the following:

```
{if "{deal}" == "Y" AND "{coupon}" == "N"}
    <tr data-deal_id="{deal_id}">
        <td class="productPrice" style="vertical-align: top;">${deal_total}<br />
             <!-- this next line is the one throwing the error -->
            {if "{deal_original_price}" && "{deal_original_price}" != "" && "{deal_original_price}" != "{deal_total}"}
                <span class="originalDealPrice">${deal_original_price}</span><br /><span id="modal_change">Why is there a price difference?</span>
            {if:else}
                <span id="modal_same">Pricing Terms & Conditions</span>
            {/if}
        </td>
    </tr>
{/if}

```

What I've done is correctly frame your variables using "{blah}" inside the conditional. What can often happen is that a variable is null or empty, so it's important to frame in quotes, but then you need to identify as an EE variable, hence the curly brackets. Consider this:

```
{if  &&  != "" &&  != 1.50}

```

Which could be how EE is seeing your conditional if `deal_original_price` is empty and not correctly framed. Hence you get nasty PHP errors in Functions.php class.

As far as I'm aware `<>` is not a valid conditional in EE - I haven't checked though! I've changed in the example above.

```
if "{deal_original_price}" && "{deal_original_price}" != ""

```

These do the same thing and so only one is needed.
> 0 votes

---
Tags: conditionals, variable
---


# Question
Title: Zoo Visitor and/or EE login forms fail to login using email
If memory serves correctly users where able to login using either email or username in a standard login form until a few days ago. The site uses zoo\_visitor latest version and has been updated to EE 2.6.1 to handle the new zoo visitor forgotten password form.

Login using username/password on both Zoo and EE login forms is fine. Try using email and error:

> The existing username and/or password you submitted are not valid

Any ideas? Is this because of the updates? My next port o' call is stepping through the php, thought id ask here first.

Thank you.

# Answer
> 0 votes
This is a setting in the Zoo Visitor settings page.

```
Set username as email (login is email) [Yes/No]

```

So you can choose which one you want to use as the login when using Zoo Visitor forms.

If you wanted to use both (either/or) then use the standard EE login form in combination with NSM Email Login.

---
Tags: email, forms, login, zoo-visitor
---


# Question
Title: ExpressionEngine API - Adding a category
I am wondering if it's possible to dynamically create a category using the Expression Engine API?

To explain my issue a little, I'm reading a 3rd party SOAP API which returns me a list of categories which could change so I can't really pre-create my categories in EE. Within each of those categories are some articles.

Now I need to insert these articles into Expression Engine through the API which is fine but wanted to "tag" these articles based on their original categories.

Failing that the only way I can think to keep track of the article's original category is to make sure a channel exists for each category I find in the API, then insert into that channel.

# Answer
> 2 votes
Look into something like Datagrab or Importer combined with, say, a nightly/hourly CRON job. It will automatically read the 3rd party service's XML and import stuff according to an import profile you create in the add-on which maps XML nodes to EE fields or categories.

---
Tags: php
---


# Question
Title: String failing evaluation as PHP causing blank/white page
We have a page on our new EE site which is failing to load (blank/white page) because of a PHP error which I'm having some difficulty troubleshooting.

The page is at http://www.healthyschoolscampaign.org/programs/health-in-mind/, and the error encountered is:

A PHP Error was encountered Severity: Warning Message: Please contact support about failure Filename: libraries/Functions.php Line Number: 683

Those familiar will know that line 683 is the function which evaluates a string as PHP. Unfortunately, due to the vagueness of the error message, I'm not sure how to tell what data is being passed as the string. I do know that other pages use the same Structure Template as this page and do not throw the same error.

We have other seemingly random blog pages which fail to load for the exact same reason, but it is not consistent across all blog entries. Any help would be appreciated, as I'm pretty much a PHP n00b.

Thanks! Ben

# Answer
> 1 votes
Make sure the Structure URL is correct and unique. Or try creating the entry again.

# Answer
> 0 votes
You might want to check that the url title and the structure url are exactly the same.

Although it's not a perfect fix, if you turn off PHP Warnings does the page load normally?

---
Tags: php-errors, phpstringfun
---


# Question
Title: Expresso Store: Can a promo code discount be applied BEFORE taxes are applied?
can a promo code percentage discount be applied BEFORE taxes are applied in Expresso Store?

# Answer
> 1 votes
The promo code always applies to the pre-tax price, however Store will always assume that there is some tax which needs to be discounted as well (otherwise there would be too much tax for your order).

The only time this is a problem is if you have some tax-free products in your order, because the promo code will discount too much tax, since it has no way of knowing which products were actually discounted.

That said, a percentage off the order discount shouldn't matter whether it is applied to the pre or post tax prices, right?

---
Tags: expresso-store, discounts
---


title: Orderby sale price w/ Exp:resso Store

text:
# Question
Title: Orderby sale price w/ Exp:resso Store
Using exp:store:search I'm trying to get a list of results and order them in price order, and by this I mean the price an item sells for rather then the just the regular price as 9 out of 10 items are on a permanent sale price and to the customer it will just seem a bit confusing and sloppy.

The documentation says:

> If the orderby parameter is set to “price”, Store will order your products based on their regular price. Note that this won’t take into account any currently applicable sale price.

It doesn't say how you can do it or even whether it's at all feasible. I'd have though it would be a pretty common requirement for people. How can I sort by the sale price? Cheers!

# Answer
It's not easy to order by the sale price. That is because Store gathers a list of products and orders them (using SQL) before it decides whether a sale price is applicable. To order products by sale price would mean calculating which products are on sale and their currently applicable price in a SQL query, before ordering them.

Question: why are 9/10 items on a permanent sale price? That's not exactly what the sale price field was designed for.

If you need some sort of "Suggested Retail Price" which you will display crossed out next to the real price to make customers feel like they are getting a fantastic bargain, it would be better to add another custom field to your channel to use for that and use the Store price field for the actual price you are selling at.
> 1 votes

---
Tags: expresso-store
---


title: Conditionals in matrix field

text:
# Question
Title: Conditionals in matrix field
I have a matrix field called {gallery} it has a column with 2 checkboxes - public and private

I would like to show only the items marked private but would also like an optional message if there are no private items. This code does not work:

```
{gallery} {if publicprivate =="private"} {if no_results}
       No rows available
   {/if}
 <li><img src="{imageupload}"/></li> {/if}
{/gallery}

```

# Answer
This answer does not quite solve my initial problem but it does allow me to show if a private gallery contains any photos:

I added 2 columns - public and private each with a P&T checkbox. In 'private' I set this to

```
1 : private

```

I created each gallery separately using

```
{gallery search:public="public"}<li><img src="{imageupload}"></li>{/gallery}

```

Then, in the private gallery I added the following text to my title:

```
Private Gallery: ({gallery:sum col="private"}) images.

```

By having the private checkbox equalling a number I am able to output the number of images that the private gallery is showing by counting the 'private' column checks. This lets users know whether there are any images in this hidden gallery before they send a request to view the gallery.
> 0 votes

# Answer
Matrix supports a search param, so I'm pretty sure this should do it:

```
{gallery search:publicprivate="=private"}
    {if no_results}no private items available{/if}
    <li><img src="{imageupload}" /></li>
{/gallery}

```

EDIT - alternatively you could try something more like this:

```
{if gallery:total_rows search:publicprivate="=private" > 0}
no private items available
{/if}
 {gallery search:publicprivate="=private"}
    <li><img src="{imageupload}" /></li>
{/gallery}

```
> 1 votes

# Answer
You could try this too:

```
{gallery}
    {if public}Public content here{/if}
    {if private}Private content here{/if}
{/gallery}

```
> 0 votes

---
Tags: matrix, conditionals
---


title: Error when using freemember module

text:
# Question
Title: Error when using freemember module
I am using freemember(https://github.com/expressodev/freemember) for login in and registration. I just installed it and I'm logged in as admin. When i try to logout i get this error:

```
A PHP Error was encountered

Severity: Warning

Message: require(/home/a7116614/public_html/ee/system/expressionengine/modules/member/mod.member.php) [function.require]: failed to open stream: No such file or directory

Filename: libraries/freemember_lib.php

Line Number: 554

Fatal error: require() [function.require]: Failed opening required '/home/a7116614/public_html/ee/system/expressionengine/modules/member/mod.member.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/a7116614/public_html/ee/system/expressionengine/third_party/freemember/libraries/freemember_lib.php on line 554

```

I used my ftp client to check and navigate to **public\_html/ee/system/expressionengine/modules/member/mod.member.php**, but **member/mod.member.php** does not exist. Please help me, I am stuck here.

Thanks!

# Answer
> 1 votes
Looks like you're using the Core Version of EECMS. The core version doesn't have the member module.

---
Tags: module, login, freemember, logout
---


title: Search results wont paginate

text:
# Question
Title: Search results wont paginate
Im trying to add pagination to my Search results page. Each time i do a search for a product that has a lot of results they are all appearing on the one page. Can anyone help me?

```
<div class="container btm_pg_padding">
    <div class="twelve columns margin-top">
        <header>
            <p>{exp:search:total_results} Result(s) for "{exp:search:keywords}"</p>
        </header>
        {exp:search:search_results results="10" paginate="bottom"}

            <h2><a href="{page_url}">{title} - <span class="channel_name">({channel})</span></a></h2>

            {sn:global_pagination}
        {/exp:search:search_results}
        {sn:global_sidebar}

```

# Answer
The results parameter needs to go on your search form, not the results.
> 1 votes

---
Tags: search
---


title: Add to homepage and reorder

text:
# Question
Title: Add to homepage and reorder
I am trying to find the most common way to add entries to the home page and then reorder them.

In the past I have set a custom status and used Low Reorder to sort the entries.

Are there other methods people prefer?

I have tested https://bitbucket.org/ajweaver/ajw\_selecteditems/src but it hasn't been updated in a while and also throwing an error in EE 2.6 so i'm hesistant to use it.

Appreciate any thoughts.

N

# Answer
Various approaches for such things. Here are my favorites:

Create a homepage channel with one entry and as many custom fields as you need. You could use a Playa or a relationship field to select and order the entries you want on the homepage. Approach detailed by Leevi Graham on GitHub

Using Low Variables, make a bunch of variables to control your homepage. Create a Playa, Relationship variable for the entries you want to order on your homepage. Alternatively, you can also use the select entries variable type bundled with Low Variables.

Hope that helps.
> 3 votes

# Answer
I suggest you to use the new relationship field.

Since now it's possible to select several entries and reorder them, you can have a relationship field for your home page. You can use the Pages Module to make a homepage setting its URL to '/', or you can create a Channel for homepages. Both ways, you can have relationship fields to select and reorder the chosen entries.
> 2 votes

---
Tags: channel-entries, low-reorder
---


# Question
Title: Change order of channel entries output with multiple channels
I have a channel entries call which is pulling in 2 channels (channel\_1 and channel\_2), what i want to be able to do is always make the first / latest post show from channel\_1, even if channel\_2 has an entry which is more recent.

The entries are order by date and the rest need to keep that flow. I want to keep this all in one channel call as i am using ajax pagination.

Any ideas of how i could just change the order of the first entry from a specific channel would be great.

# Answer
> 1 votes
You just might have to use an embed (or Stash if you're using that).

```
{ee-tag channel="channel_1" limit="1" ... }
   {!-- display first / latest entry of channel_1 --}
   {embed="embed/all-other-entries" no-show="{entry_id}"}
{/ee-tag}

```

Then the "all-other-entries" embed template would have:

```
{ee-tag channel="channel_l|channel_2" entry_id="not {embed:no-show}" ... }
   {!-- all entries except the latest from channel_1 --}
{/ee-tag}

```

# Answer
> 0 votes
You could use the native "Make Entry Sticky" option on the publish view in EE for the one entry you need to sit at the top.

# Answer
> 0 votes
This might be of use, you can pipe multiple orderby like:

```
orderby="channel|date"

```

As per documentation.

# Answer
> 0 votes
You could try something like this within your Channel Entries tags:

```
{!-- channel_1 entries get output first --}
{if channel_id == '1'}

    {title}
    {!-- Other field values here from channel_1 --}

{/if}

{!-- Other channel entries output afterwards --}
{if channel_id != '1'}

    {title}
    {!-- Other field values here from channel_1 --}

{/if}

```

Just to sure to change the channel\_id to whatever your channel ID's are.

# Answer
> 0 votes
As of version 2.5.4 you can order by status - so in your status group you could have a "featured" status. It would have the same effect as sticky, basically, but be visible in the edit list view (which is important in my view). If only channel 1 used that status group (or even if both did but you only ever used "featured" on channel 1) it would have the effect you are going for. You would simply use orderby="status|date" and sort="asc|desc" to give preference to status over date sorting. This approach works best, however, if you only have two statuses - open and your additional custom status of "featured". If you have a bunch of others, it complicates things because the entries loop will still run through ordering by status before it orders by date.

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


# Question
Title: Is there a way to use global templates in expression engine?
By default, each template in expression engine is an entire template. Is there a way to set a global template, and have each template be inserted as the content section of that template?

ie. `.template.php`:

```
<html>
  <head>
  </head>
  <body>
    {embed:currentpagecontent}
    <footer>
    </footer>
  </body>
</html>

```

The only way I can think of doing it is to have common elements and embed them on ***every*** template - like so:

```
{embed:'.header.php'}
{embed:'.navbar.php'}

<h1>ipsum lorem</h1>

{embed:'.footer.php'}

```

it just seems messy having the same prefix and suffix on ***every*** template

(nb. this question sounds annoyingly confusing due the dual meaning of the word 'template' in expression engine!)

# Answer
> 2 votes
This is a common question and there is a technique you can use with the add-on "Stash." It's already been described and documented multiple times.

Check out the selected answer for this other, similar question: How to use a common template for all pages?

# Answer
> 0 votes
You absolutely *could* have a single template. Just make 1 template, set it as the 'homepage' of your site then within that apply whatever logic you wish to pull in different embeds or snippets. Though I think it would become a bit messy fairly quickly for anything but the most basic site. It's much simpler to use different template groups.

What is the other meaning of "template" in EE? There's only 1 meaning of template as far as I'm aware.

---
Tags: templates, template-partials
---


# Question
Title: {exp:assets:files} does not output anything
Since I updated my EE installation from 2.5.5 to 2.6.0 the {exp:assets:files}-tag pair does not output anything anymore. I have also updated Assets to 2.1.1. Also {exp:assets:total\_files} returns zero. The {exp:assets:folders}-tag pair works fine. I have also reindexed all files.

My template code looks like this:

```
<ul class="unstyled">
    {exp:assets:folders parent_folder="{filedir_5}"}
        <li><i class="icon-folder-open"></i> {folder_name}</a>
            {if total_subfolders}
                <ul class="unstyled" style="margin-left: 25px;">
                    {subfolders}
                </ul>
            {/if}
            <ul class="unstyled" style="margin-left: 25px;">
                {exp:assets:files folder_id="{folder_id}"}
                    <li><i class="icon-file"></i> <a href="/{exp:link_vault:download_link file_path='../../../../{server_path}' url_only='true' action_only='true' }">{if title != ""}{title}{if:else}{filename}{/if} ({size})</a></li>
                {/exp:assets:files}
            </ul>
        </li>
    {/exp:assets:folders}
</ul>

```

I am showing a whole file hierarchy of a file directory above the web root (therefore link-vault-addon usage). The folder are outputted correctly but no files are shown. I have also tried your example usage from the docs:

```
{exp:assets:folders recursive="yes"}
<h3>{folder_name}</h3>
<ul>
    {exp:assets:files folder_id="{folder_id}"}
        <li><a href="{url:huge}" target="_blank">{if title != ""}{title}{if:else}{filename}{/if}</a></li>
    {/exp:assets:files}
</ul>
{/exp:assets:folders}

```

But this also only outputs all folders but no files.

Any help is appreciated. Thanks!

# Answer
sorry for the long wait - we've isolated the bug and fixed it - the fix will be included in the next release.

For a hot-fix, open the third\_party/assets/libraries/assets\_lib file, locate the get\_files\_in\_folder method and add this at the very beginning of this method:

```
if (is_array($file_ids))
{
  $file_ids = array_filter($file_ids);
}

```

That should fix your thing!
> 0 votes

---
Tags: pixelandtonic, assets
---


# Question
Title: Assets 2.1.2 not showing files on front-end
I'm doing some local dev with Assets 2.1.2 and trying to get it to output a folders and file structure.

However, I can get the folders to display but no files. Even the tags that are meant to output the count of files/folders don't show there are files there.

The files display perfectly well within Assets in the Control Panel

This is the code I'm using to test.

```
<ul>
{exp:assets:folders}
    <li>{folder_name}</a>
        <p>Total subfolders: {total_subfolders}</p>
        {if total_subfolders}
            <ul>
                {subfolders}
            </ul>
        {/if}
        <ul>
            {exp:assets:files}
                    <li>
                        <p>Total files: {total_files}<br>
                        <a href="{url}">{if title != ""}{title}{if:else}{filename}{/if} ({size})</a></li>
                        {if no_results}<p>No files</p>{/if}
            {/exp:assets:files}
        </ul>
    </li>
{/exp:assets:folders}
</ul>

```

The resulting output looks like this

```
Content images
Total subfolders: 0

Member files
Total subfolders: 0

News images
Total subfolders: 0

Provider Logos
Total subfolders: 0

Projects
Total subfolders: 11

    Committee
    Total subfolders: 10

        Meetings
        Total subfolders: 4

            2012-12-05 Berlin
            Total subfolders: 1

                Presentations
                Total subfolders: 0

            2013-01-28 Paris
            Total subfolders: 0

            2013-04-21 London
            Total subfolders: 0

       Project Groups
       Total subfolders: 4

           PG1
           Total subfolders: 0

           PG2
           Total subfolders: 0

           PG3
           Total subfolders: 0

           PG4
           Total subfolders: 0

Slider images
Total subfolders: 0

```

There are a number of files in the 2012-12-05 Berlin directory (as well as the top level directories) that just don't show up.

Furthermore adding the folder\_id, parent\_folder or folder parameters doesn't have any effect on what is output. The list always starts from the top most directory.

I've tried setting it to output from {filedir\_6} (which is the Projects directory) but the output is just as above.

So... but in Assets 2.1.2 or am I missing something?

# Answer
sorry for the long wait - we've isolated the bug and fixed it - the fix will be included in the next release.

For a hot-fix, open the third\_party/assets/libraries/assets\_lib file, locate the get\_files\_in\_folder method and add this at the very beginning of this method:

```
if (is_array($file_ids))
{
  $file_ids = array_filter($file_ids);
}

```

That should fix your thing!
> 0 votes

---
Tags: pixelandtonic, assets, bug
---


# Question
Title: Expression engine core version limitations
I'm new to EE and I'm trying to do some securitiy testing on EE. Is it possible to make user login/registration and fileupload with exression engine core version? I tried using third party module freemember module but no luck because EE core version doesn't have members module :(

Any ideas?

# Answer
> 0 votes
I think you've answered the question yourself. The member module is the only way to allow users to login to an ExpressionEngine site that I'm aware of. There are many third-party add-ons that extend the member modules functionality, like Freemember, but none that replace it.

I would say you should buy a license for testing, but unfortunately, a full license of ExpressionEngine is non-returnable.

---
Tags: file-uploads, login, security, registration
---


title: Allow members to register new members

text:
# Question
Title: Allow members to register new members
How can a allow Members to register new members via the control panel? I've set up the Members prefs to allow access to the Register Member entry screen. But the system does not seem to accept a new registration - just returns to the same entry screen.

Thanks

Andrew

# Answer
There are some related options on CP \> Members \> Member Groups \> Edit Member Group:

* Can access MEMBERS section;
* Can administrate members accounts;
* Can change the group that a member is assigned to (Unlocked groups only);
* Can delete members;
* Can ban users;

Besides, you need to have at least one unlocked Member Group. Only **Super Admins** can register new members to **Locked Member Groups**. The following image shows that all Member Groups are Locked:
> 1 votes

---
Tags: members, registration
---


# Question
Title: Conditional not working in Low Variables/Matrix field
I have a simple Matrix field inside Low Variables. All I want to do is display a message when there are no results, but the conditional isn't working.

Am I doing something wrong?

```
{exp:low_variables:pair var="friends"}

    {if no_results}
         <p>Coming Soon</p>
    {/if}

<div class="span4">
    <ul class="span4 unstyled text-center">
       <li>{name}</li>
       <li>{special}</li>
       <li><a href="{link}">Website</a></li>
   </ul>
</div>

{/exp:low_variables:pair}

```

# Answer
Matrix doesn't have a `no_results` variable. You'll have to just see if the LV field is empty instead. Try this.

```
{if '{exp:low_variables:pair var="friends"}{name}{exp:low_variables:pair}' == ''}
  <p>Coming soon.</p>
{/if}
{exp:low_variables:pair var="friends"}
  {name}
  {special}
{/exp:low_variables:pair}

```
> 1 votes

---
Tags: matrix, low-variables
---


title: Show entry versions on front-end

text:
# Question
Title: Show entry versions on front-end
If I have entry versioning turned on is there any way that I can show details of previous entry versions on the front end?

# Answer
I don't believe there is any way using native EE tags, but using the query module I'm sure this could be done or by creating a plugin perhaps.
> 1 votes

# Answer
Please see here http://www.sidd3.com/get-entry-revisions-in-expressionengine/

It would be helpful for you.
> 0 votes

---
Tags: entries
---


# Question
Title: Handling banned IPs when you deploy using version control
I'm ending up with banned IPs being added to my bootstrapped config file by ExpressionEngine on the live server but this means my local config.php is at odd with the live version.

How should I handle such a scenario? Commit the changes from the live server back into the repo on a regular basis? Or is there some way to push banned IPs into a database table instead (would seem to make more sense!)?

Any pointers greatly appreciated.

# Answer
> 2 votes
If you don't use the CP to edit your config file, you can move some of the settings to another file and to use include() or require() to push it to the main config.php. The NSM Config Bootstrap, for example, uses this approach.

---
Tags: spam, banned, ip
---


title: Add link to related entry (ee2.5.5)

text:
# Question
Title: Add link to related entry (ee2.5.5)
I have a channel, loan-officers. Each entry in this channel has a related\_entry field for each loan officer to choose which branch they are associated with. (the related\_entry field is called officer\_branch, and is a Relationship fieldtype.) Each loan officer can be associated with only one branch. The loan-officer template displays the information from the loan-officer channel, a single entry at a time.

On each loan-officer template, I want to display a link to the loan officer's associated branch. The information about the individual branches displays through the template "branch/index". I want the link text to be the branch name, which is the {title} tag of the related entry. The URL should be the 'branch' template group, plus the {url\_title} of the related entry.

I have no idea what code to use for this. We have EE 2.5.5 installed, and so the documentation I can find via Google...doesn't work for our installation. (Running EE 2.5.5 on AWS.)

(This is possibly fairly obvious, but I haven't worked with EE's native related\_entries tag too much. I don't even know if this is related\_entries, or reverse\_related\_entries. Sorry!!)

# Answer
> 1 votes
Inside your channel entries tag pair add this.

```
{related_entries channel="officer_branch"}
  <a href="/branch/{url_title}">{title}</a>
{/related_entries}

```

# Answer
> 0 votes
If I understood you right and you are using **url\_title** instead of entry\_id as segment, this code should do the job on EECMS 2.5.5:

```
{exp:channel:entries channel="loan-officers"}
    {related_entries id="officer_branch" limit="1"}
      <a href="{url_title_path='branch'}">{title}</a>
    {/related_entries}
{/exp:channel:entries}

```

The reverse\_related\_entries would be used on the page of the branch, to list the associated loan officers.

You can download the documentation to your version on the User Guide of ExpressionEngine.

By the way, it's always better to use the most recent version.

---
Tags: ee2, related-entries
---


# Question
Title: If conditional using category selections
Is there a way of saying

If a category contains two selections, display this CSS If a category contains one selection display this CSS instead.

I can't seem to find the right formula of {if} conditional with a category selection.

Any help much appreciated.

# Answer
> 2 votes
add a count to the output maybe? Something like this might help: https://github.com/erikreagan/er.entry\_category\_count.ee\_addon

This way you could append a class like 'count\_1' etc to each category which is output.

Actually this might be more suitable as it's EE2.x compatible: http://devot-ee.com/add-ons/bw-category-count

# Answer
> 1 votes
Would you be be able to use an :nth-child pseudo class in your css?

http://css-tricks.com/how-nth-child-works/

If you are using jquery it should work in ie

# Answer
> 1 votes
Given the sponsorship example, you could fairly easily figure out how many "active" sponsors you have just using the `{exp:channel:entries}` tag if all sponsors are in their own `sponsors` channel for example.

You could then use the `{absolute_results}` variable to get a number of the amount of sponsors.

Here is an example:

```
{exp:channel:entries
  channel="sponsors"
  disable="category_fields|member_data|pagination|trackbacks"
  dynamic="off"
}

  {if "{absolute_results}" == "1"}
    {!-- Do something when 1 entry is shown from the "sponsors" channel. --}
  {/if}

{/exp:channel:entries}

```

Alternatively, if you must use categories, you can try the following which uses the Category Count plugin.

```
{exp:channel:entries
  channel="sponsors"
  disable="category_fields|member_data|pagination|trackbacks"
  dynamic="off"
}

  {if "{categories}{exp:catcount cat_id='{category_id}'}{/categories}" == "1"}
    {!-- Do something when 1 entry is in the category. --}
  {/if}

{/exp:channel:entries}

```

You may also want to use Switchee to only parse the actual code of your template that will be used.

Given Switchee your code might look like this:

```
{exp:channel:entries
  channel="sponsors"
  disable="category_fields|member_data|pagination|trackbacks"
  dynamic="off"
}

  {exp:switchee variable="{absolute_results}" parse="inward"}
    {case value="1"}
      {!-- Only gets evaluated by the template parser and rendered if the case is matched. --}
    {/case}
  {/exp:switchee}

{/exp:channel:entries}

```

# Answer
> 1 votes
have you looked at http://gwcode.com/add-ons/gwcode-categories/documentation \- it has a parameter that grabs the categories an entry has - you should be able to manipulate category presentation using the plugins variables

# Answer
> 1 votes
I would try to use {total\_results} to add a css class to your markup then write your styles around that.

Something like:

```
<div class="count{total_results}">
    Stuff here
</div>

```

and in your CSS

```
.count1 { make the thing really big }
.count2 { make the thing a bit smaller }
.count3 { make the thing a bit smaller again }
.count4 { make the thing teeny tiny }

```

That's not a full answer but it may give you food for thought.

# Answer
> 0 votes
Given how you've described the end result of what you're looking for, here's how I might choose to handle it:

First, I'd have a channel of sponsors. Custom fields like logo, description, URL - whatever you need for each one.

Second, I'd have a channel for weekly sponsors (or simply a custom field in your weekly setup) that is nothing more than a weekly identification of which sponsors apply for THIS weekly edition using Playa.

The total results of the Playa field would be your total count of sponsors in a given week. That would determine the requirements of the grid for displaying the sponsors - presumably you would have a maximum as determine by what fits naturally across the top where you have them positioned currently - let's use four as an example.

```
{exp:channel:entries channel="weekly_sponsors" limit="1" disable="categories|member_data|pagination"}

    <p>This week, made possible by:</p>

    {exp:playa:children channel="sponsors"}
        {if count == "1"}<ul class="weekly_sponsors {total_results}">{/if}
           <li><img src="{logo}" alt="{title}"/></li>
        {if count == total_results}{/if}
    {/exp:playa:children}

{/exp:channel:entries}

```

As I mentioned, this could simply be a playa field in your weekly entry setup.

Because you would have a logical maximum number of sponsors to fit across - in this example four, you would just need the width of each LI to adjust, depending on the total\_results class applied to the list. So without any margin or padding applied, it might be something like this:

```
.weekly_sponsors.5-sponsors li {
    width: 20%;
}

.weekly_sponsors.4-sponsors li {
    width: 25%;
}

.weekly_sponsors.3-sponsors li {
    width: 33%;
}

.weekly_sponsors.2-sponsors li {
    width: 50%;
}

.weekly_sponsors.1-sponsors li {
    width: 100%;
}

```

I'm not suggesting your widths would actually always divide evenly - this is just an example. But that's likely how I would handle it to future proof it as much as possible. This would also give you the ability to break the list and create a new row if needed following the same pattern.

Hope that helps.

# Answer
> 0 votes
I can imagine a way to this on EECMS, using two {categories} tag pairs, but, since its is a design issue that can be solved just on CSS, lets do it. Besides, the solution using CSS is much easier.

If you can drop support to IE6 and IE7, you can use display:table-cell.

```
.sponsor.group {display: table;}
.sponsor.group > a {display: table-cell;}
.category_image {display: block; margin: 0 auto; padding: 10px; width: 85%;}

```

Some older versions of webkit may need a child element of div.sponsor.group to play the role of table-row.

---

In case somebody really needs to use a class name to represent how many categories a entry has, this is the easier solution:

```
<div class="sponsor group {categories show_group="2"}s{/categories}">
{categories show_group="2"}
    <a href="..."><img class="category_image" src="{category_image}" /></a>
{/categories}
</div>

```

On css:

```
.s {}
.ss {}
.sss {}
.ssss {}

```

---
Tags: ifelse, categories
---


# Question
Title: Control how many articles a user can see if they're not logged in?
Here's the basic scenario I'm looking at: Someone comes to the website (which features various journal and news articles), and can look at a certain number of articles "for free" for a particular length of time (say 30 days). However, once they hit that number of articles within the length of time, the site displays a registration form instead of any articles.

Obviously, if someone is a registered member of the site and logged in to their account, they have unrestricted access and can read as many articles as they want.

It's a readership/subscription model similar to the one employed by http://dish.andrewsullivan.com/, FWIW.

I can envision how this all works -- it's a pretty straightforward membership/registration set-up -- **except** for the part about tracking/counting the number of articles that someone who isn't logged in has read, and then doing something once they hit a pre-defined limit.

Any ideas?

# Answer
The article view can be tracked with the IP address of the not logged in user. With the every view of the article, you can record the IP address, view count for article and article id (entry id).

So each time, the non-logged in user is going to view an article, a simple query can be run to check if that IP address exceeded the limit if yes just use the {redirect="registration\_page"}.
> 1 votes

# Answer
I would not do this by IP address. Write a custom extension to create a cookie for logged out user once visiting the website.

That cookie could have an expiration date of 0. If the expiration is set to zero the cookie will only last as long as the browser is open. This can be set in longer intervals i.e. 2 hours.

Every article viewed would update the cookie.

Wrap content with a custom method that first checks if the user is logged out, then check for cookie value of how many times an article has been viewed. If user is logged in, disregard anything related to a cookie.

There is no way to full proof client side access if the user is not logged in. What user, unless a knowledgeable one that knows how cookies work would make the decision to use a different browser when most users operate with one? Probably a small percentage.
> 0 votes

---
Tags: members, registration
---


title: Segment 3 not showing?

text:
# Question
Title: Segment 3 not showing?
I have asked this question in the official EE forum but didn't get any replies so thought about asking the same question here, hope someone can help?!

**What I am trying to do:**

I have the SolSpace user module installed and pulling the username of my members as segment 1 (e.g. www.domain.com/peter) now I have a channel where my users can enter a blog entry but I want each user to have their own blog address (e.g. www.domain.com/peter/blog) so got all that working fine.

**The problem:**

When I go to www.domain.com/peter/blog I see Peter’s entries and that’s good and all but when I click on the title to read more I get the permalinks page for that blog entry, what I would like to get is www.domain.com/peter/blog/hello-world served on the screen and no matter what I try it’s getting that the 3rd segment to show that entry…

**This is my code:**

```
{if segment_2 =="blog"}
 {exp:channel:entries channel="blog" username="{segment_1}" limit="10" dynamic="no"}
  {title}
 {/exp:channel:entries}
{if:else}
 {exp:channel:entries channel="blog" username="{segment_1}" limit="1" dynamic="yes"}
  {title}
 {/exp:channel:entries}
{/if}

```

**Also tried**

```
    {if segment_2 =="blog"}
     {exp:channel:entries channel="blog" username="{segment_1}" limit="10" dynamic="no"}
      {title}
     {/exp:channel:entries}
    {/if}
    {if segment_2 =="blog" AND segment_3 ==""}
     {exp:channel:entries channel="blog" username="{segment_1}" limit="1" dynamic="yes"}
      {title}
     {/exp:channel:entries}
    {/if}

```

I have tried so many different combos to get the 3rd segment to show but nothing shows or I get a blank page.

I can link the page to www.domain.com/blog/hello-world and that works but I wanted to get www.domain.com/peter/blog/hello-world.

I have am running EE 2.5.5

I hope I made sense, if not please let me know and I will try again, I know the code is wrong but if someone can put me on the right track…

Thanks in advance. Tony

# Answer
> 1 votes
I found the issues on your code samples.

You want to use "/peter/blog/hello-world" for the unique entry page, right?

On the first one, the second possibility of your conditional just runs if the segment\_2 isn't "blog", but the segment\_2 will always be "blog".

On the second one, the second conditional just runs if there's no segment\_3, but you need the segment\_3 to find the the entry.

So lets fix it!

First of all, how are you coding the permalinks? Are you using "{url\_title\_path='blog/{segment\_2}'}"? Personally, I prefer to use relative links, so I used them on my code samples.

And I strong suggest you to avoid advanced conditionals. From the docs:

> Simple conditionals are parsed before module tags, but advanced conditionals are parsed after module tags. If a simple conditional evaluates false, ExpressionEngine simply ignores a module tag within that conditional, neither rendering it nor displaying it. But if an advanced conditional evaluates false, ExpressionEngine can only hide the output of the already fully rendered module tag. That amounts to a big difference in performance.

---

Your first option is:

```
{if segment_2 == "blog"}
    {if segment_3 == ""}
        {exp:channel:entries channel="blog" username="{segment_1}" limit="10" dynamic="no"}
          <a href="/blog/{segment_2}/{url_title}">{title}</a>
        {/exp:channel:entries}
    {/if}
    {if segment_3}
        {exp:channel:entries channel="blog" limit="1" dynamic="yes"}
            {title}
        {/exp:channel:entries}
    {/if}
{/if}

```

Since two entries can't use the same url\_title on the same site, there's no need for the username parameter on the unique entry page.

Unfortunately, this is gonna **break your pagination** in case of, for example, "/peter/blog/P10".

Lets improve it.

---

You can use the segment\_3 as a marker for your posts: "/peter/blog/posts/hello-world". In this case:

```
{if segment_2 == "blog"}
    {if segment_3 != "posts"}
        {exp:channel:entries channel="blog" username="{segment_1}" limit="10" dynamic="no"}
          <a href="/blog/{segment_2}/post/{url_title}">{title}</a>
        {/exp:channel:entries}
    {/if}
    {if segment_3 == "posts"}
        {if segment_4}
            {exp:channel:entries channel="blog" limit="1" dynamic="yes" url_title="{segment_4}"}
                {title}
            {/exp:channel:entries}
        {/if}
        {if segment_4 == ""}
            {redirect="404"} or what else you want to do in case of "/peter/blog/posts/".
        {/if}
    {/if}
{/if}

```

EECMS just looks for entry\_id or entry\_title on {segment\_2} and {segment\_3}. Because of this, we need to use the url\_title parameter.

This works fine, but maybe you can't use the word "posts" on segment\_3.

---

The solution for this is to use RegEX to check the pagination. The addon switchee allows the use of RegEx on conditional tests.

```
{if segment_2 == "blog"}
    {exp:switchee variable="{segment_3}" parse="inward"}
        {case value="#P\d+$#|''"}
            {exp:channel:entries channel="blog" username="{segment_1}" limit="10" dynamic="no"}
              <a href="/blog/{segment_2}/{url_title}">{title}</a>
            {/exp:channel:entries}
        {/case}
        {case default="Yes"}
            {exp:channel:entries channel="blog" limit="1" dynamic="yes"}
                {title}
            {/exp:channel:entries}
        {/case}
    {/exp:switchee}
{/if}

```

The first case checks for "P" followed by more than one digit or "", while the second deals with all other cases.

I hope it helps.

Bye!

# Answer
> 0 votes
Depending on how you are arriving to the blog template group, you may not necessarily need the conditional around segment\_2 unless there's other items that may be displayed. In any event, maybe give this a try:

{if segment\_2 == "blog" AND segment\_3 == ""} entries loop for user's full list of entries {if:elseif segment\_2 == "blog" AND segment\_3 != ""} entries loop for user's single entry {/if}

The issue I saw above is that segment\_2 condition was met by both conditions. This way, it's force to a yes or no with each.

I would also recommend wrapping this with Croxton's ifelse add-on so the outer conditional is parsed earlier and therefore the insides only get parsed if the outside condition is met.

Also, you may need/want to add a parameter to your entries loop to narrow it to the specific entry, like url\_title="{last\_segment}" or url\_title="{segment\_3}"

---
Tags: solspace-user
---


title: Email Contact Form redirection in IE8

text:
# Question
Title: Email Contact Form redirection in IE8
After recently testing a form using 'Email Contact Form' on IE8 I found that the redirect page does not work at all. It just sits there on the standard EE 'Thank You!' panel and does nothing. It seems to load my 'Thank You' page cause the link on the EE 'Thank You' page (see attached) panel does not work but my cursor detects content from my 'Thank You' page even though it is not visible. Has anyone else had any problems with this kind of thing at all and with IE8.

# Answer
With a little jQuery AJAX knowledge, you can avoid the "Thank You" page & redirection entirely by using this tutorial and accompanying jQuery script. This approach has worked well for me.
> 1 votes

---
Tags: forms
---


# Question
Title: Recovering from a site hack, preventing another one
I am trying to help someone recover from a hack and prevent a further incident. They are running version 1.7.3. The result of the hack was modified index.php files in the root and system folders with javascript added to the files.

The hosting company assures us that it is not possible for other users to exploit php and web server privileges to modify the site files, so, taking that with a grain of salt -I'm looking at other possible vulnerabilities. So far all I can think of is:

1. A vulnerability in a plug in
2. A vulnerability in the php used in some templates

So far I'm not finding any issues in trying to investigate in the plugins, but not a whole lot of information either.

What specific steps can I take to locate the vulnerabilities and prevent another attack?

# Answer
There are several solutions to securing your EE installation:

1. Rename your index.php file to something else - even if it isn't "visible" in the site URLs, if it still uses its same name, that makes it vulnerable to potential attacks because it's visible.
2. Rename the /system/ file to something else
3. Better yet, move the /system/ directory above the web root
4. If you can, figure out a way to use EE so that the site has the same functionality, but uses plugins or existing EE functionality/tags rather than PHP in the templates. That PHP may be totally secure, and I don't think that's what allowed this intrusion this time...but EE is very powerful, there's no reason to use its inbuilt functionality as much as possible. (That's a bit more secure than putting PHP in the templates, but not always.)
5. Have your client regularly change all passwords, and close any accounts that don't absolutely positively 100% need access - either into EE itself, or to the server/hosting account. (When you've got a small company trying to Do It Themself, they sometimes may overlook that.)

It would probably be smart to advise these folks to spend the time and money to upgrade to the latest version of EE - and it will be a rocky upgrade process for a version as far back as yours, so make backups - but even then, you'll want to take the steps to secure your installation of EE. The exact steps to renaming these various files and moving these directories are in the EE documentation.
> 1 votes

---
Tags: php, ee1, security
---


# Question
Title: Having trouble with a conditional with Child Categories Navigation
I am using Laisvunas' Child Categories plugin on my site and am having some issues with conditionals on setting the selected navigation element for styling purposes.

For example on this page: http://rouviere.com/our-work/ the code for the sidebar navigation is as follows:

```
<ul id="basic">

    {exp:child_categories parent="102|105" child_categories_sort_by="custom" child_categories_sort_direction="asc" show_empty="no" entries_sort_by="date" entries_sort_direction="asc"}

    {child_category_start}
        <li><a {if segment_3=="{child_category_url_title}"} class="selected"{/if}
            {if "{child_category_url_title}" != "photography"}href="{site_url}our-work/category/{child_category_url_title}/{child_category_id}" {/if}
            {if "{child_category_url_title}" == "photography"}href="{site_url}photo/"{/if}>{child_category_name}</a></li>
    {child_category_end}
{/exp:child_categories}
</ul>

```

The navigation works fine, however, I would like to indicate which segment is active. I tried adding the following code (also seen above) to indicate which segment is active:

```
<a {if segment_3=="{child_category_url_title}"} class="selected"{/if}

```

Nothing happens. I have tested it by manually entering a child category url title, so I know it works. Any clues on how to get this working properly?

Thanks.

# Answer
> 3 votes
I spent some time trying to understand what happens on your code, until I notice the variable "{child\_category\_end}". This variable shows that the addon Laisvunas' Child Categories doesn't use the template class of EECMS, otherwise the variables would be something like "{child\_category}(...){/child\_category}".

I can't say for sure without to read the code of the addon, but it looks like to have its own parser and maybe this parser deals with conditionals. If I'm right, the issues you're having aren't problems on EECMS that we can help you with. The solution can be just the space before the "==":

```
{if segment_3 == "{child_category_url_title}" } class="selected"{/if}

```

or:

```
{if segment_3 == {child_category_url_title} } class="selected"{/if}

```

or:

```
{if "{segment_3}" == "{child_category_url_title}" } class="selected"{/if}

```

I can't say for sure and I guess just the developer of the addon can help you.

I don't know the reason you choose this addon, but you can do almost the same using {exp:channel:categories}, selecting one category\_group and removing the parent categories you don't want to show.

I hope it helps.

# Answer
> 0 votes
have you tried this using category\_url\_title instead?

```
{if segment_3=="{category_url_title}"} class="selected"{/if}

```

# Answer
> 0 votes
Try without the quotes:

```
{if segment_3 == {child_category_url_title} } class="selected"{/if}

```

---
Tags: module, css, child-categories
---