# Question
Title: How to select a template for an entry via publish form
I am experimenting with the template partials approach and try to figure out how to let the client choose a template for the entry he is publishing/editing. Adrienne Travis mentions Blueprints in conjunction with Structure. But thats another $100 for just getting to choose a template from the CP.

So I was wondering if there are any other ways to go. I have been playing a bit with Low Variables and Template & Snippet Select but no matter how I turn there is alwasy some parseorder thing to have me grounded.

So... any ideas?

/David

Oh, and this is what my wrapper-template looks like and I am hoping to replace the first line with contents from the layoutfield on the publishform.

```
{embed="_wrappers/homepage"}

{exp:channel:entries channel="ch-archive" limit="1"}
{exp:stash:set name="title"}<h1>{title}</h1>
{/exp:stash:set}
{exp:stash:set name="content"}
<p>{body}</p>
{/exp:stash:set}
{/exp:channel:entries}

```

# Answer
A simple solution for this would be to simply add a select dropdown to the publish page with each of your wrapper templates listed. So for example, if your select dropdown field is called {wrapper\_template}, your template code would look like this:

```
{exp:channel:entries channel="ch-archive" limit="1"}
  {embed="{wrapper_template}"}

  {exp:stash:set name="title"}
    <h1>{title}</h1>
  {/exp:stash:set}
  {exp:stash:set name="content"}
    <p>{body}</p>
  {/exp:stash:set}
{/exp:channel:entries}

```

This should work since the embed is parsed at the very end of the parse order. But this method should only be attempted with a single channel entry like you have it set here (limit="1"). Otherwise you could end up embedding multiple wrapper templates.
> 1 votes

# Answer
One possible option might be to add a variable on the wrapper embed, which passes a value for the template being accessed. Within your wrapper, switchee could be used to adjust markup. Using your sample above:

```
{embed="_wrappers/homepage" template="templateA"}

```

Within your wrapper, it could then be utilized such as this:

```
{exp:switchee variable="{embed:template}" parse="inward"}
   {case value="Value1"}
      Content to show
   {/case}
   {case value="Value2" default="yes"}
      Default format
   {/case}
{/exp:switchee}

```

If you're using the pages module (or perhaps structure), the template selection could also be more user-friendly in the control panel using an add-on such as Better Pages or 'Plates.
> 1 votes

# Answer
I'm a Structure man myself. But have you looked at Better Pages?

http://devot-ee.com/add-ons/better-pages
> 0 votes

# Answer
I have used Plates before for this reason, and it works well. You can choose which of the templates they can choose from, and include thumbnails if you desire. You just need to have the Pages module installed, and you need to be sure you have the Templates field BEFORE the Plates field (by customizing the Publish Layout). I put it at the top of the main Publish page, then hide it. http://devot-ee.com/add-ons/plates
> 0 votes

# Answer
You could use a plugin, but it's pretty easy to do with `{if}` statements as well. Here's one of the ways we set this up for a client. There are other's but it was fairly simple.

**Problem**: Client needed the ability to create various *lists* that were basically collections of articles from their site or sometimes from other resources. But the lists were occasionally, single-column format, top 10 (in reverse order 10 -\>1) top 10 (1-\> 10), top 5, bullet list, image as bullet list, etc.

**Solution**:

* **Create a template for each format option.** Displayed is a partial list of the various template options.

* **Added a New Field.** In the field\_group related to the publish form, we added a new field, with the select template format option.
* **Create a 'filter' template.** The filter template will determine from the post, which display template to use. The code we use looks like

{exp:channel:entries channel="my\_channel" limit="1" status="not Closed" require\_entry="yes"}

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

{if series_format=="two_column"}
    {embed="series/_two_column"}

{if:elseif series_format=="numbered"}
    {embed="series/_numbered"}

{if:elseif series_format=="top_five"}
    {embed="series/_top_five"}

{if:elseif series_format=="top_ten"}
    {embed="series/_top_ten"}

{if:else}
    {embed="series/_single"}

{/if}

```

{/exp:channel:entries}

The 'filter' template has no styles or other details, but they could. In this case, we left all the formatting on the 'option' templates. We also embedded some secondary stylesheets, to handle reverse count list displays, and the selection of 'image' options, if the selected the bullet as image template.

But otherwise, new template designs can be added at any time. Once the new template is created, we basically update the drop down menu field, which contains the template options, and the 'filter' template that contains the `{if}{if:else}` statements.

No plugins required.
> 0 votes

---
Tags: template-partials
---


# Question
Title: How do I prevent expired linked events from being displayed?
I have the following code on a listings page that is meant to display linked events that occur in the future.

```
{reverse_related_entries weblog="events" sort_by="date" show_expired="no"}
    {if count==1}
    <div id="upcomingevents">
        <dl class="meta">
            <dt>Upcoming Events</dt>
    {/if}

        <dd><a href="/events/{entry_date format="%Y/%m/%d"}">{title}</a></dd>
{if count==total_results}</dl></div>{/if}
{/reverse_related_entries}

```

The problem is that ALL linked events are being displayed, even those that have expired (as in the expired date is in the past)

My version is 1.7.1

# Answer
> 4 votes
The {reverse\_related\_entries} does support only 6 parameters of weblog, status, sort, orderby, offset, limit.

So "show\_expired" parameter will not work here.

---

In that case I always prefer to use Playa but never tried with EE v1.6+.

I think, you are populating a single weblog entry and would like to show all the parents weblogs with {reverse\_related\_entries} tag.

Below is the example code with query module:

```
{exp:query sql="SELECT exp_weblog_titles.entry_id AS EntryID, exp_weblog_titles.title AS EntryTitle, exp_weblog_titles.url_title AS URLTitle FROM exp_weblog_titles
LEFT JOIN exp_relationships ON exp_relationships.rel_parent_id=exp_weblog_titles.entry_id
WHERE exp_relationships.rel_child_id='{entry_id}'
AND exp_weblog_titles.status='open'
AND exp_weblog_titles.entry_date >= UNIX_TIMESTAMP(NOW())
ORDER BY exp_weblog_titles.entry_date DESC"}

{EntryID} || {EntryTitle} || {URLTitle}

{/exp:query}

```

Note in above code, {entry\_id} in WHERE condition which the entry\_id of child weblog and this code will replace the {reverse\_related\_entries} tag so {entry\_id} of child weblog will be checked.

I didn't test this code but hoping it would work fine. Also, if you would like to fetch other fields, you need put with the SELECT statement.

---
Tags: conditionals, ee1, tags, parameters
---


# Question
Title: Map centering issue in SafeCracker form with Google Maps for EE
I'm using Google Maps for EE in a SafeCracker form, and the map field is within some jQuery tabs. I previously had an issue with the map not displaying correctly if it wasn't on the first tab that loaded when the page loads (as per this question), but this has been solved by calling the tabs with the following code in my external functions.js file:

```
$('.tabbed-form .tabs').kosTabs({
  after: function() {
    if(typeof Gmap !== 'undefined') {
      var instance = Gmap.instances[0];
      if(typeof instance !== 'undefined') {
        google.maps.event.trigger(instance.map, 'resize');
        instance.map.setCenter(instance.center);
      }
    }
  }
});

```

The above solution works fine for creating new entries as the map centres on the latitude, longitude and zoom that I specified in the custom field settings.

But when editing an existing entry that has already had a marker plotted on the map though, I'm finding that the map isn't loading with the marker in view on the map (like it would do in normal circumstances) - instead, it's loading at the map centre (the one entered in the custom field settings), but at a zoomed-in level.

Can anyone show me how to adapt the above JS to make existing entries load with the marker in view please? Thanks.

# Answer
Before issuing the resize call, simply record the current map centre so you can reset it. Like this:

```
$('.tabbed-form .tabs').kosTabs({
  after: function() {
    if(typeof Gmap !== 'undefined') {
      var instance = Gmap.instances[0];
      if(typeof instance !== 'undefined') {
        var center = instance.map.getCenter();
        google.maps.event.trigger(instance.map, 'resize');
        instance.map.setCenter(center);
      }
    }
  }
});

```
> 2 votes

---
Tags: google-maps, google-maps-for-ee
---


# Question
Title: Creating a "standard" page template at root
I'm wanting to allow my client to be able to create unlimited pages at the root of their site, for example, these will be used for confirmation pages etc:

http://www.url.com/test-page http://www.url.com/test-page2

I've created the following template using Switchee, however when I goto the url for the page I simply get a 404 page. I've created a "standard\_items" channel and they have the url of test-page:

```
{exp:switchee variable="{segment_1}" parse="inward"}

  {case value=""}

{embed="site/header" page_name="home"}

<!-- Homepage -->

{exp:channel:entries channel="home" limit="1"}
<h1>{title}</h1>
{/exp:channel:entries}

  {/case}

  {case default="yes"}

{embed="site/header" page_name="detail"} <!-- Standard page -->

  {exp:channel:entries channel="standard_item"}

    <h1>{title}</h1>
    {introduction}
    {image}
      <div class="image">
        <img src="{url:portrait}" alt="{title}" width="196" height="224" />
      </div>
    {/image}
    {body}

  {/exp:channel:entries}

  {/case}
{/exp:switchee}

{embed="site/footer"}

```

Any idea why?

# Answer
> 5 votes
This is likely because you've enabled strict URLs in your Template Preferences, which means that the first segment of your URL *must* be a valid template group. Disabling strict URLs will allow you to proceed.

I would suggest, however, that rather than the approach you're taking, make your `standard_item` channel the default channel for the Pages module (and choose a default template for new entries in that channel), and instruct your clients to use not the URL Title field, but the Pages URI field.

This way your home page template is bypassed altogether (loading the selected page template directly), and you can ditch the Switchee approach. Much cleaner and more future-proof.

---
Tags: ee2
---


# Question
Title: Are there any Affiliate add-ons that have 2-tier programs?
I'm looking for an affiliate add-on that has support for 2 tier payouts.

Whereby affiliates make a percentage of each sale made by the other affiliates that they have referred.

# Answer
> 1 votes
There are just a few affiliate add-ons for ExpressionEngine. I don't think any of them supports what you're asking, but maybe it's better to talk to respective developers.

You can consider building something on top of existing add-on, or integrate some non-EE solution (both would require custom coding).

---
Tags: add-on, affiliate
---


# Question
Title: Why am I getting this error and what do I need to do: "Error You have tried to access a weblog that does not exist."?
I have created a 'staging' version of my site on a new server.

When I am in the admin area I can see the list of weblog entries just fine, but when I click on one of them to edit it, I receive this error:

```
"Error
You have tried to access a weblog that does not exist."

```

Is this a config or permissions problem? What should I do to fix the issue?

# Answer
It maybe worth checking to see if you’ve got the same number of exp\_weblog\_titles and exp\_weblog\_data rows.

You can do this by going to Admin \> Utilities \> SQL Manager \> Database Query Form

```
select count(*) as cnt from exp_weblog_titles
select count(*) as cnt from exp_weblog_data

```

Enter these one at a time inside your form. Make sure the numbers match.
> 2 votes

---
Tags: error, admin
---


# Question
Title: Formating entry date like Twitter or Facebook
Is there a way to format the date output so it reads like it does on Twitter or Facebook.

For example if a post was posted 2 days ago the output would be '2 days ago', the same goes for weeks, so if the entry was posted 2 weeks ago it says '2 weeks ago'.

I only need it to go up to 2 weeks, after that it will switch back to a normal date format.

Thanks

# Answer
There are at least three plugins that can format dates like "x time-units ago."

Since you only need display a relative date for the first two weeks from the entry date, you'll need to wrap your date in a conditional based on `{current_time}` and use a bit of math. Or as you pointed out in your comment, the Time Ago plugin has a `revert_to_date_format` parameter for this purpose.
> 5 votes

# Answer
There are several such add-ons listed on devot:ee. Here's a search for "relative date."
> 1 votes

---
Tags: channel-entries, date, time, entry-date
---


title: Expression Engine and Solr Search

text:
# Question
Title: Expression Engine and Solr Search
I am new to expression engine, but have experience working with other CMSs which have a Solr search integrated or module available (Drupal, Silverlight, TYPO3). I have searched all over but found no equivalent in expression engine.

Before I start developing one I wanted to ask the community if they know of any examples of one, code to get started, or discussion of the issue?

# Answer
> 3 votes
AFAIK, there are no tools that would allow Solr search integration.

You may consider one of these search tools for EE:

1. Search (included in default install)
2. Low Search
3. SuperSearch

There are also tools that integrate Google Search: Low GoogleSearch and Google Custom Search

---
Tags: search
---


title: PayPal Express set up in Store

text:
# Question
Title: PayPal Express set up in Store
I am trying to get my info to set up PayPal express with Store.

When I login to my PayPal account I am not seeing what they are asking:

From Store Docs:

PayPal Express Checkout requires an API Username, Password, and Signature. These are different from your PayPal account details. You can obtain your API details by logging in to your PayPal account, and clicking Profile \> My Selling Tools \> API Access \> Request/View API Credentials \> Request API Signature.

When I click Profile I do not see My selling tools.

I do find on my profiel page: Request API credentials, but when I click that I see: Setting up API permissions and credentials Choose one of the following options to integrate your PayPal payment solution with your online store or shopping cart.

Grant API permission

Then I see: Add New Third Party Permissions Manage permission given to a third-party application to access specific information in your account and take actions on your behalf.

For more information about the permissions you are granting, see Third Party Permissions.

Third Party Permission Username

If I click View API Certificate I get API Username name\_api1.gmail.com

API Password ••••••••••••

Request Date

but no signature??????

Any advice?

# Answer
Here is what my PayPal profile page looks like, not sure why you can't see *My Selling Tools*:

It sounds like you have set up an *API Certificate* rather than a signature (probably for a different shopping cart). You probably need to go into the *View API Certificate*, then click *Remove*.

After that, you should be able to request a new *API Signature* instead. It sounds like you can't have both a signature and certificate set up at once. I don't want to remove my signature to find out for sure though!
> 1 votes

---
Tags: expresso-store, paypal-express-checkout
---


# Question
Title: Matrix, user global variables in basic text input breaking in simple if conditional
We have a Matrix that has a simple text input in the first column, and another text input in the second column. First column is for a link title, second column is for a URL. This is the stripped down code we're using to display this information on the template, showing the title if there is one:

```
{if "{link_field:total_rows}" >= 1}
  <h4>{title} Links</h4>

  <ul>{link_field}
    <li>
      <a href="{link_url}">{if link_title}{link_title}{if:else}{link_url}{/if}</a>
    </li>
  {/link_field}</ul>
{/if}

```

Very simple: if there are any rows, output the h4, open a UL, loop through the rows (outputting a title if there is one, otherwise outputting the URL), close the UL, done.

The issue is that the simple "if" conditional is breaking things, especially if there is any text in the first column that resembles user-related global variables (email, screen\_name, username). Those are actually getting parsed - even though there are no braces.

For example, a link title might read "Send email to user-selected recipient". The 'email' there is getting parsed (and getting double quotes added) so the field reads (using my email address): "Send "ryan@masugadesign.com" to user-selected recipient". That being the case, it's going into the {if link\_title} conditional statement and breaking, so that the template returns a parse error:

```
Parse error: syntax error, unexpected T_STRING in /.../system/expressionengine/libraries/Functions.php(680) : eval()'d code on line 649

```

If we just output {link\_title} outside of a conditional, it outputs the text in the field as I'd expect. Another odd thing we notice is that if we put a plus sign "+" in the first column, the template breaks as well.

Doesn't seem to make a difference how we do that conditional:

```
{if link_title}
{if link_title != ''}
{if "{link_title}"}
{if "{link_title}" != ''}

```

Has anyone run into this? This site is on EE 2.5.2. We just updated and tested with latest version of Matrix (2.5.3), so the add-on version doesn't seem to matter.

# Answer
> 1 votes
There were some weird conditional bugs in 2.5.2 that got fixed - may be worth upgrading:

http://ellislab.com/forums/viewthread/223416/

---
Tags: matrix
---


title: EE 2.5.5 channel issues

text:
# Question
Title: EE 2.5.5 channel issues
My EE install are having issues with channel fields. Normally, when changing field "Type", you get different options.

But in my install, no matter what I set the "Type" field to, I get none options other than the standard "Field settings".

Example: setting "Type" to Assets, should give me lots of Assets options (thumbnail size, folders to upload/select images from etc.). But I get none. Same applies no matter what "Type" I select. I have no clue why.

Anyone know where to start? This is on a clean install with just a few things set up.

Regards Kristoffer

# Answer
> 1 votes
Sounds like your Theme directory may not have been uploaded correctly. Try reuploading it. Also, make sure the jQuery module is installed on the Modules page.

---
Tags: channel, error, fields
---


title: Structure nav item no more selcted

text:
# Question
Title: Structure nav item no more selcted
I'm using EE2.5 with structure. I have a simple nav:

```
{exp:structure:nav current_class="selected" start_from="/" show_depth="2" include_ul="no"}

```

I have a channel: photos

I have a Category Group: photograph and this Category Group has categories

Each entrie from photos get assign to an categorie

I have a unique template "ovezicht" to show the categories from channel "photos" and when I click on a "category\_image" I see all the photos assign to this category.

overvieuw categories

```
{if segment_3 == ""}

{exp:channel:categories channel="photos" style="flat"}

<a href="{path='overzicht'}"><img src="{category_image}"></a>

{/exp:channel:categories}

{/if}

```

(This is the url when watching the categories: .../uitleen/overzicht/)

photos from a selected categorie

```
{if segment_3 != ""}
{exp:channel:entries channel="photos" disable="member_data" limit="1" paginate="bottom"}
<div class="col_left">
<img src="{foto_image}" alt="">
</div>

<div class="col_right">
{naam_fotograaf}<br />
{title} | {jaartal}<br />
{formaat}<br />
{prijs}<br />

</div>

<!--  PAGINATION   -->

 {paginate}

  {pagination_links}

{/paginate}

<!--  E.O. PAGINATION   -->

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

```

(This is the url when watching the photos from a selected categorie: .../overzicht/fotograaf/francois-morfouace)

NOW MY PROBLEM

When I view photos from a selected categorie the menu item has no more the class selected in the nav.

# Answer
> 1 votes
If you're outside of the Structure hierarchy, we have no way to have the here state on the nav item.

# Answer
> 0 votes
If I'm understanding the issue, something like this should work:

```
<a href="{path='overzicht'}" {if segment_3 == "{category_url_title}"}class="selected"{/if}><img src="{category_image}"></a>

```

This will add a class of "selected" to the active category.

---

If you are wanting to make sure the main navigation item is selected, changing your code slightly and adding come custom CSS will do the trick.

First, add `add_unique_ids="yes"` to your structure:nav tag like so:

```
{exp:structure:nav add_unique_ids="yes" current_class="selected" start_from="/" show_depth="2" include_ul="no"}

```

This will add a unique id to the navigation li tag. You'll need to look at the rendered code to determine the ID that is used.

Then, add something like this to your body tag:

```
{if segment_1 == "overzicht"}id="overzicht-body"{/if}

```

Then add CSS to style the nav item... something like:

```
#overzicht-body #NAME_OF_UNIQUE_ID {
    CSS for your "selected" state
}

```

OR

```
#overzicht-body #NAME_OF_UNIQUE_ID a {
    CSS for your "selected" state
}

```

You'll need adjust the CSS to match your rendered html code...

---
Tags: categories, structure
---


title: WYGWAM/CKEditor Skin

text:
# Question
Title: WYGWAM/CKEditor Skin
I’ve got something here that is absolutely not critical, but it's bugging me and I’ve been encouraged to post it here to see if anyone can help out.

I am trying to change the skin of WYGWAM to one I found for CKEditor that I really enjoy (Moono, which I believe is the default now), but when I try to do that, the WYGWAM field will no longer load. I found what I thought was the appropriate place to change the skin in third\_party/wygwam/helper.php. And I uploaded the skin to themes/third\_party/wygwam/lib/ckeditor/skins. But no joy. Any idea what I'm doing wrong?

Here is what I’m changing in helper.php:

```
public static function base_config()
{
    return array_merge(array(
        'skin'               => 'wygwam2',
        'toolbarCanCollapse' => 'n',
        'dialog_backgroundCoverOpacity' => 0,
        'entities_processNumerical' => 'y',
        'forcePasteAsPlainText' => 'y'
    ), self::default_config_settings());
}

```

Obviously, I’m changing 'wygmwa2' to 'moono'.

Here is what the field looks like before trying to change the skin: before

And here is what it looks like when I change the skin in helper.php: after

Additionally, after playing around with helper.php, I realized I could change skins on a per configuration basis in the advanced settings and I tried that, but experienced the same problem.

The field is obviously failing to initialize. Any ideas, anyone have any experience with this?

# Answer
I think this may be somewhat more simple. Can you go to your Wygwam editor configuration, under Advanced Settings, in the drop-down, choose Skin and follow those instructions. Let's see if that helps?

If that doesn't work, please check your dev console for any JS errors and report them here. Thank you!

Edit to add: this is quite an old post, but you might try what's in here if the above doesn't work: https://getsatisfaction.com/pixelandtonic/topics/use\_office2003\_skin\_in\_wygwam
> 3 votes

---
Tags: custom-fields, wygwam, fieldtype, pixelandtonic, wysiwyg
---


# Question
Title: Discussion Module emails only going to last person to comment
I have a strange problem. We are using EE2.5.3 and Discussion Forum3.1.9. I also have Forum Subscribe2.3.2 installed. On our forums, if someone enters a new reply to a topic which has several people subscribed, the module will send an email only to the last person who replied to that thread. I have tested by changing the email protocol and uninstalling Forum Subscribe. I am currently using SMTP as the email protocol.

Any help or other ways to troubleshoot would be appreciated.

Edit: After further trouble shooting, it appears that the issue is with the thread subscription mechanism in EE. If a new thread is started, everyone subscribed to that forum with Forum Subscribe receives an email as they should. However, if all of those people then subscribe to the thread in EE, when anyone responds, the response only goes to the last person that responded (if they have left selected the "Notify me via email..." checkbox). Any ideas?

Thanks, Steve

# Answer
Just to give a full answer of how we fixed this issue:

We found that in system/expressionengine/modules/forum/mod.forum\_core.php at line 6576, there is code to change field "notification\_sent" to "y" once an email is sent. However, once that field is set to "y", no further emails go out. To make this work as we need, we modified the code to leave that field at "n".

Original line 6576: `$this->EE->db->set('notification_sent', 'y');`

Modified line: `$this->EE->db->set('notification_sent', 'n');`

If anyone is subscribed to that thread now, they will continue to receive email updates until they unsubscribe.
> 1 votes

# Answer
Sounds like a bug that needs to be reported to EllisLab. You can **report bugs on the EllisLab website**... need to login first.
> 0 votes

---
Tags: forum
---


# Question
Title: Member registration form without third party plugins/add-ons
I am a newbie to expressionengine. I have EE 2.5.5 purchased version. What i want to know is can i create a member registration form and explicitly ask users to register?

# Answer
The only way to allow members to register without an add-on is to use the Member module's registration functionality. This page is displayed based on your "member" trigger word, uses a completely different set of templates from the rest of your site, and is generally a pain in the ass.

(This is why modules like FreeMember and User are so popular.)
> 5 votes

# Answer
You should see here http://www.sidd3.com/stand-alone-member-registration-form-in-expressionengine/

This weblog having the example code for stand alone member registration form without using any third-party add-on.
> 3 votes

---
Tags: forms, registration
---


# Question
Title: 2 possibly related questions - Can't edit profiles - Can't post comments
So working on a blog, easy enough... The client has the following setup:

* Windows IIS7
* EE v2.5.5 - Build Date: 20121220
* Site located at www.mydomain.com (domain-1)
* Admin on another site like sub-domain at ee.mydomain.com (domain-2)
* The Admin is behind a firewall with no access to the public

Issue 1:

* Can't access member profiles

I have accounts set up on the site and have the following link for the users to edit their info:

```
{if logged_in}
    Welcome <a href="{path='member/profile'}">{logged_in_screen_name}</a><br /><a href="{path='LOGOUT'}">Logout</a>
{/if}

```

When I click on the name, I get the following message:

```
The following errors were encountered

The page you requested was not found

```

However, the link looks legit:

```
http://www.mydomain.com/S=7d3285379e0387a32aad7de52b6aac94cd79b19f/member/profile

```

---

Issue 2:

* I can't comment on the threads

I have the following code set up for commenting: (Note this is after the closing `{/exp:channel:entries}` tag

```
{exp:comment:entries channel="blog_post" url_title="{segment_3}" sort="asc" limit="100"}
    {if count==1} {!-- This way we wont open the div or unordered list unless there are comments to display --}
        <!-- comments list -->
        <div id="comments-wrap">
            <h4 class="heading">{total_results} Comments</h4>
            <ol class="commentlist">
    {/if}
    <li class="comment even thread-even depth-1" id="li-comment-{count}">
        <div id="comment-{count}" class="comment-body cf">
            <img src="{exp:ce_gravatar:single email="{email}"}" alt="{name}" class='avatar avatar-35 photo' height='35' width='35'/>
            <div class="comment-author vcard">{name}</div>
            <div class="comment-meta commentmetadata">
                <span class="comment-date">{comment_date format="%Y %m %d"}</span>
            </div>
            <div class="comment-inner">
                {comment}
            </div>
        </div>
    </li>
    {if count==total_results} {!--close the list after the last comment --}
            </ol>
        </div>
    {/if}
{/exp:comment:entries}
<!-- ENDS comments list -->
<h4>Add Your Comment</h4>
{exp:comment:form channel="blog_post" url_title="{segment_3}" form_id="comment_form"}
    {if logged_out}
        Must be logged in to comment.<br>
    {if:else}
        <p><label for="user_comment_area">Comment:</label></p>
        <p><textarea name="user_comment_area" style="width: 542px;" rows="10">{comment}</textarea></p>
        <p><label><input type="checkbox" name="save_info" value="yes" {save_info} /> Remember my personal information</label></p>
        <p><label><input type="checkbox" name="notify_me" value="yes" {notify_me} /> Notify me of follow-up comments?</label></p>
        {if captcha}
            <p><label for="captcha">Please enter the word you see in the image below:</label></p>
            <p>{captcha}</p>
            <p><input type="text" name="captcha" value="{captcha_word}" maxlength="20" /></p>
        {/if}
        <p><input type="submit" value="" class="blue-submit"></p>
    {/if}
{/exp:comment:form}

```

The logic is fine as in not displaying unless logged in. However, when I am logged in and add a comment, it appears to accept the comment and then refresh showing nothing. Again, this should be correct because I want to moderate comments, but when I go to the comment module there is nothing there. There is also nothing in the DB in the comment table.

*** EDIT ***

So it appears that there is an issue with permissions on the current setup. They have set up two separate app pools with the admin pool having all permissions to the system (domain-2) and the user app pool having permission to only the site (domain-1).

It acts like everything is hunky dory but nothing is being written. They don't want to "expose" access to the system folder and want to keep it on a separate domain. Is it possible to function completely this way or am I hosed here?

*** EDIT IMAGES ***

Here are the settings for the channel and user group. However, this also has the same result for SA accounts.

# Answer
> 0 votes
Thanks Anna\_MediaGirl for helping through this. It seems like the issue is with the removal of index.php in my URLs. When I went back to the general settings and replaced that for the default file, i worked fine. I guess this puts me on another mission to find a better removal of index.php for IIS servers. (Ick)

# Answer
> 1 votes
Sounds like your member group permissions aren't set up correctly.

Make sure **Can submit comments** and **Can view public profiles are** enabled for the member group.

---
Tags: ee2, members, comments, comment-form, profile-edit
---


title: Plugin Development Beginner Question

text:
# Question
Title: Plugin Development Beginner Question
I'm new to add-on development and have built a simple plugin to return an integer of the number of entries a user has posted in a certain channel.

I want to call this plugin a few times in an EE template. With the way it is set up now, does that mean the plugin will query the DB every time I call it?

If so, is there a better way to write this?

Thanks,

```
        <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');

            $plugin_info = array(
                'pi_name'       => 'Camper Count',
                'pi_version'    => '1.0',
                'pi_author'     => '',
                'pi_author_url' => '',
                'pi_description'=> 'Count the number of campers a logged in user has and return an integer.',
                'pi_usage'      => Camper_count::usage()
            );

            class Camper_count {

                /**
                 * Specific Vars for Channel and Status
                 * Since this will only be used to export from one channel
                 *
                 * @var array
                 * @access protected
                 **/
                protected $channel_id = 20; // The ID for the 'Campers' Channel
                protected $channel_entry_status = 'open';

                /**
                 * Return Data
                 **/
                public $return_data;

                /**
                 * Constructor
                 */
                public function __construct()
                {
                    $this->EE =& get_instance();

                    // Make the Query
                    $this->EE->db->from('exp_channel_titles');
                    $this->EE->db->where('channel_id', $this->channel_id);
                    $this->EE->db->where('status', $this->channel_entry_status);
                    $this->EE->db->where('author_id', $this->EE->session->userdata('member_id'));
                    //$this->EE->db->where('exp_channel_titles.entry_date >=', strtotime($config['date_filter_start']));
                    //$this->EE->db->where('exp_channel_titles.entry_date <=', strtotime($config['date_filter_end']));
                    $count = $this->EE->db->count_all_results();

                    /*
                     * Since the user will be registering a new camper, incrememnt the camper count up by 1.
                     * If there are no campers returned, then this is their first camper. Return 1.
                     */
                    if($count > 0)
                    {
                        $this->return_data = $count + 1;
                    }
                    else
                    {
                        $this->return_data = 1;
                    }
                }

                // ----------------------------------------------------------------

                /**
                 * Plugin Usage
                 */
                public static function usage()
                {
                    ob_start();
            ?>

            Returns an integer of the number of campers a logged in user has. {exp:camper_count}
            <?php
                    $buffer = ob_get_contents();
                    ob_end_clean();
                    return $buffer;
                }
            }

            /* End of file pi.camper_count.php */
            /* Location: /system/expressionengine/third_party/camper_count/pi.camper_count.php */

```

# Answer
Use Session Caching.

http://ellislab.com/expressionengine/user-guide/development/usage/session.html#id4

You can initialise it first, but I've found it works fine with out this:

```
//###   Setup the page loading Cache   ###
if(!isset($this->EE->session->cache)) $this->EE->session->cache = array();
if(!isset($this->EE->session->cache[__CLASS__])) $this->EE->session->cache[__CLASS__] = array();

```

Then check if set before the DB call, and set afterwards...

```
if (isset($this->EE->session->cache[__CLASS__]['entry_count'])) {
    $count =  $this->EE->session->cache[__CLASS__]['entry_count'];
} else {
    // Make the Query
    $this->EE->db->from('exp_channel_titles');
    $this->EE->db->where('channel_id', $this->channel_id);
    $this->EE->db->where('status', $this->channel_entry_status);
    $this->EE->db->where('author_id', $this->EE->session->userdata('member_id'));
    $count = $this->EE->db->count_all_results();
    $this->EE->session->cache[__CLASS__]['entry_count'] = $count;
}

```

As you can read from the EE description (link above), this is a page loading cache - so only useful for single display of a single page. Therefore if there are multiple calls on the same page to this add-on/function then it will only call the database once. If there are other users or other pages the visitor uses, it will repeat the DB query for each.

Remember this is shared by all add-ons, so either use a unique identifier for the cache array, or use a multi-dimensional array and have the first element ideally identify your add-on, to avoid any overwriting of the cache area.
> 3 votes

# Answer
Each instance of your plugin is isolated. It has no reference to the previous instance. So, yes, you're hitting the db each time.

You can see that `preload_replace` variables are parsed before plugin tags.

So you need some way to cache the first hit and use that value again, when you use your plugin in a template. I haven't used it (yet), but I'm guessing that's part of Stash's scope.
> 0 votes

---
Tags: add-on-development, plugin
---


# Question
Title: Profile:edit / Safecracker current password not recognized
I am working on a member profile edit using Profile:edit and a safecracker form. There is just one small problem.

When I try to make changes to the profile (not as a super admin) it requires the current password. The documentation provides the following code, which I have tried, but I still get an error.

The code:

```
{exp:profile:edit return="/member-area/company-preview" form_class="profile"}

{if logged_in_group_id != 1}
  <p>(You must submit the current password to update this page)</p>
  <label><span>Your Current Password:</span>
   <input type="password" name="current_password" value="" />
  </label>
{/if}
<fieldset>
<label><span>Username:</span>
    <input type="text" name="username" value="{username}" />
        </label>

        <label><span>Screen Name:</span>
            <input type="text" name="screen_name" value="{screen_name}" />
        </label>

        <label><span>Email:</span>
            <input type="text" name="email" value="{email}" />
        </label>
</fieldset>

<fieldset>
    <p>Change password? Leave blank if you do not wish to change it.</p>
        <label><span>New Password</span>
            <input type="password" name="password" value="" />
        </label>

        <label><span>Confirm New Password</span>
            <input type="password" name="password_confirm" value="" />
        </label>

            {!-- superadmins don't have to submit existing password --}
            {if logged_in_group_id != 1}
                <p>(You must submit the current password to update this page)</p>
                <label><span>Your Current Password:</span>
                    <input type="password" name="current_password" value="" />
                </label>
            {/if}
</fieldset>

<fieldset>
    <label><span>*First Name:</span>
        {field:member_first_name}
    </label>

    <label><span>*Last Name:</span>
        {field:member_last_name}
    </label>

    <label><span>*Full Name:</span>
        {field:full_name}
    </label>

    <label><span>Address:</span>
        {field:member_address}
    </label>

    <label><span>Address:</span>
        {field:member_address2}
    </label>

    <label><span>City:</span>
        {field:member_city}
    </label>

    <label><span>State:</span>
        {field:member_state}
    </label>

    <label><span>Zip:</span>
        {field:member_zip}
    </label>

    <label><span>Main Phone:</span>
        {field:member_phone}
    </label>

    <fieldset>
        <input type="submit" value="Save" />
    </fieldset>
{/exp:profile:edit}

```

The error message:

> In order to make changes you must submit the current password

I would appreciate any assistance resolving this.

Thanks.

# Answer
> 1 votes
I resolved the problem. I updated the module from 1.0.7 to 1.0.9 and the problem went away.

---
Tags: safecracker, profile-edit
---


title: How to: Assets & no results

text:
# Question
Title: How to: Assets & no results
Using assets in a Matrix field, and would like to display 'no results' if a file has not been uploaded for that particular field. Like so...

{exp:channel:entries....etc} {matrix\_field} {field\_1} {field\_2}

```
{if asset_field}
    {asset_field}
        {url}
    {/asset_field}
{if:else}
    No Files
{/if}

```

{/matrix\_field}

I've tried various combinations of using total\_results and changing where the conditional is, complex/simple. Can't seem to find the right combination that works with both cases. Is there a no\_results tag? What's the proper way to do this?

# Answer
> 2 votes
I just did a quick setup to test. My matrix tag pair is test\_matrix. My Assets column is matrix\_assets

```
{exp:channel:entries limit="2"}
<h1>{title}, {entry_id}</h1>
{test_matrix}
{if matrix_assets == ""}nada{/if}
{if matrix_assets != ""}stuff{/if}
{matrix_assets}
{/test_matrix}
{/exp:channel:entries}

```

I did that with two entries, one with that column populated, one without. This was the output of that template:

```
testing matrix assets - has no file, 15

nada
testing matrix assets - results, 14

stuff

```

So you can see the conditionals there are working. Can you give that type of approach a shot?

# Answer
> 1 votes
You can accomplish this one of two ways...

```
{matrix_field}
{if file}{file}{if:else}no results{/if}
{/matrix_field}

```

Or, if you're trying to show the "no results" if no matrix rows exist, you could do this...

```
{matrix_field}
{if total_rows == "0"}no results{/if}
{/matrix_field}

```

or this...

```
{if matrix_field == ""}no results{/if}

```

Let me know if you have questions!

---
Tags: assets
---


# Question
Title: Which method for setting status parameter is more efficient?
I built a site several years ago with 3 statuses so editors could position articles on a category landing page. I coded some of the entry tags like this to ensure that adding additional statuses wouldn't affect the results unless I explicitly revised the parameter settings.

```
status="Open|Mini Feature|Main and Mini Feature|Main Feature"

```

Well, no additional statuses have ever been added and I want to make sure my queries are as efficient as possible. This is a high traffic site.

---

My question is... **which produces a more efficient query?**

```
status="Open|Mini Feature|Main and Mini Feature|Main Feature"

```

OR

```
status="not closed"

```

# Answer
> 2 votes
status="not closed" will be more efficient. When the Channel module is building its SQL query, it checks to see if there's more than one status being asked for. If it's one status, it uses `WHERE status =`. If it's more than one status, then it'll use `WHERE status IN`. = is more efficient than IN.

# Answer
> 0 votes
I'd say because the way MySQL works, the latter is more efficient. You're basically saying, in SQL:

```
SELECT entries FROM channel WHERE status IS NOT closed

```

vs. saying:

```
SELECT entries FROM channel WHERE status IS open OR Mini Feature OR Main AND Mini Feature OR Main Feature

```

as a machine reading these queries, the first is much more concise, and will also be more concise in your template :)

---
Tags: performance, status
---


title: Exp:resso Store: Communication

text:
# Question
Title: Exp:resso Store: Communication
Exp:resso Store: How can I communicate to a list of all members who have purchased a particular product?

If, for example, a product (in our case, a class course) is cancelled or the time changes.

# Answer
> 2 votes
You would need to write a query that queries the `exp_store_order_items` joined with the `exp_store_orders` table to grab the members email that `order_id` matches the `entry_id` in question.

---
Tags: expresso-store
---


# Question
Title: Posting large amount of content serves 403 error
Is there a content limit/length for channels? If so, can the limit be removed?

**Reason I ask:**

When posting a large amount of content (approx 12,700 characters) in a channel (blog) as soon as I submit I get served a 403 Forbidden screen: http://screencast.com/t/9vPuJo4hup6

However, if I post a small amount of content (a couple of paragraphs) and submit there are no problems.

I tested this further by posting the large amount of content paragraph by paragraph and submitting after each one (paragraph). This process was successful up until I reached a certain amount of content and then I was served the 403 again.

It appears that there is some sort of content limit in channels?

Any help would be appreciated.

Thanks, Dan

# Answer
From my experience, getting 404 or 403 errors after submitting a form is because of a `mod_security` setting in Apache on the server. This isn't something EE can influence or circumvent, really.

You can try to add this to your .htaccess file:

```
<IfModule mod_security.c>
  SecFilterEngine Off
</IfModule>

```

However, this could result in an error 500 (Internal Server Error) if you're not allowed to turn the SecFilterEngine off. If that's the case, ask your host if `mod_security` is enabled and if they could disable it. They could also add one or more exceptions to the `mod_security` settings for your site instead of disabling it completely.
> 3 votes

---
Tags: error, long-content
---


# Question
Title: Clicking 'submit' on FreeMember login form just goes to blank page
Well basically like the title says, no errors are generated, I just get a blank page back...

Heres my form:

```
{embed="includes/.sitetop" pagetitle="Gateway Workshops - Massage Courses UK - New member registration" page="register login questionnaire"}
<div class="slidewrap noslide" style="background-color: white;"></div>
<div class="centercolumn">
    <h3>Register New Account</h3>
    {exp:freemember:register require="email|name|phone|password" return="site/thankyou/" error_handling="inline" error_delimiters='<span class="error">|</span>'}
    <p><label for="name">Name:</label> {field:name}<br />{error:name}</p>
    <p><label for="email">Email Address:</label> {field:email}<br />{error:email}</p>
    <p><label for="company">Company Name:</label> {field:company}<br />{error:company}</p>
    <p><label for="job_title">Job Title:</label> {field:job_title}<br />{error:job_title}</p>
    <p><label for="phone">Phone Number:</label> {field:phone}<br />{error:phone}</p>
    <p><label for="address">Address:</label>{field:address}<br />{error:address}</p>
    <p><label for="password">Password:</label> {field:password}<br />{error:password}</p>
    <p><label for="password_confirm">Confirm Password:</label>{field:password_confirm}<br />{error:password_confirm}</p>
{if captcha}
    <p>Please enter the following characters into the box below:<br />
    {captcha}<br />
    {field:captcha}<br />
    {error:captcha}</p>
{/if}

<div class="button"><input type="submit" value="Submit" class="submit"><div class="buttoninner"><div class="buttoninnerinner">Submit Questionnaire</div></div></div></input>

    {/exp:freemember:register}
</div>
{embed="includes/.sitebottom"}

```

Its fairly simple, nothing too fancy there, it all displays fine on: /login/register/ but when you click the submit button it goes to: /index.php/login/register and displays a blank page.

If I go directly to /index.php/login/register and hit submit it does the same thing (aka redirects back to itself) regardless of what else I do in the form.

I've got PHP errors turned on and am getting no errors appearing for the site, just the form seems to consistently return to a blank page.....

Thanks

Steven Lockey

# Answer
This turned out to be a conflict with assets (403 Error with Assets 2.0.5 and Freemember).

http://pastie.org/private/stx2abio8navxese2i4zq has the fix in case anyone else comes across the bug and needs the fix.
> 1 votes

---
Tags: freemember
---


title: Conflict with Channel Images and Wygwam

text:
# Question
Title: Conflict with Channel Images and Wygwam
When I install Channel Images, all of my Wygwam text fields disappear on the publish entry pages. I can still see the channel field title for the Wygwam field, but the wysiwyg is gone. Has anyone else run into this issue? If so, how did you fix it?

*EE version 2.5.5. Wygwam version 2.7. Channel Images version 5.4.2.*

# Answer
I was able to figure out the issue. I used Updater to install Channel Images, and it did not automatically perform the Wygwam integration as outlined in the Channel Images installation steps: http://www.devdemon.com/channel\_images/#product\_install

Once I added the channelimages folder to the ckeditor plugins folder, it is working properly. Fail on my part for not reading the installation instructions and assuming Updater would handle everything for me.
> 2 votes

# Answer
First of all upgrade both add-ons to their latest versions or make sure they are at their most current versions. Of course it would be nice if Exp Eng were at its most current version also. :-)

I don't recall the details of this issue, best to ask the developers, but one solution is to try the settings in Wygwam for "Defer loading". In the settings for Wygwam you can set a preference that displays the Wygwam editor or defers it until you click on the field. In one instance I set this to NOT defer loading. The Edit page loads more slowly, especially if you have multiple Wygwam fields, but this may solve your issue.

Also, are you using any custom CKEditor settings or a custom CSS file for the Wygwam field settings?

* Bob
> 0 votes

---
Tags: wygwam, channel-images
---


title: An add-on to rate Matrix rows

text:
# Question
Title: An add-on to rate Matrix rows
I was thinking of using EE for a restaurant review kind of website. Ideally, I would like to create the restaurants as entries and have the entire menu of each restaurant as a Martix in their entry.

Next, I would like website members/visitors to rate individual dishes of a restaurant through star ratings (and possibly comment). There are quite a few ratings add-ons but they rate entries not rows in Matrix. Keep in mind that this should be done on the front-end and not CP.

Any ideas if there is anything that could help me? Or possibly look at the above from a different prospect to get it to do what I want?

# Answer
The way you describe your project there is a pretty strong case for defining your dishes as Matrix rows instead of entries as you described (ie, restaurants defined as an entry with a Matrix for the menu and each dish being a Matrix row).

That said, as an alternative you *could* define dishes as fully-fledged entries and relate them to restaurants using a Playa field in the restaurant entry. This would allow you to use one of the rating add-ons that works with entries, but your menus would be more fragmented in the system and maybe less convenient/intuitive from a maintenance standpoint.

**But since ratable Matrix rows sounds like the best approach, take a look at VZ Average**. I have not tried it but according to the docs it supports rating Matrix rows.

> VZ Average is a flexible and minimal framework for rating or tallying anything in EE that you can identify with an ID: a channel entry, a comment, a Matrix row, or anything else. A few possible uses for it include: star ratings, thumbs up/down ratings, flagging comments as offensive, voting on entries, etc.

I actually discovered this add-on just now and wish I had known about it earlier since I had a very similar project requirement and ended up building a custom module. Building the module was fun, but if I had known about VZ Average I would have at least tested it out!
> 3 votes

---
Tags: matrix
---


title: Uninstalling Structure: preparations?

text:
# Question
Title: Uninstalling Structure: preparations?
I want to uninstall Structure on a site. The navigation rarely ever changes, so a dynamically generated menu isn't necessary; the people maintaining the site have some knowhow, and content is used in multiple places; and finally, I want to use EE's inbuilt Pages module but I don't know that I can with Structure installed.

Other than hardcoding the navigation, and then making sure to set all "static" pages as Pages, what else do I need to do, to uninstall Structure?

I'm running EE 2.5.3, Structure 3.3.6.

# Answer
You can't use the native Pages module with Structure installed. You'll need to uninstall Structure before installing Pages.

I'd suggest making these change in a dev environment to CYA.

There shouldn't be anything more to do then uninstalling Structure, installing Pages, mapping URLs into Pages, setting up navigation, reworking anything in the templates as needed.
> 1 votes

---
Tags: ee2, structure
---


title: Forcing Categories in Publish Form

text:
# Question
Title: Forcing Categories in Publish Form
Using EE 2.5.5. I have a products channel with three category groups associated. How do I insure at least one category from each group is selected when the user adds or edits a product entry? Is there some form validation mechanism I missed?

Thanks.

# Answer
Check out the very useful Category Field addon.

From the Devot:ee description: "This field type allows you \[to\] organize your category groups as you would any other custom field type anywhere on your publish entries form."

You could create one "Category Field" field for each of your 3 category groups and make these fields required in the channel field settings, which I believe would accomplish your goal.
> 5 votes

# Answer
The **BW Required Category** addon will do the trick to makes categories required for specified channels.
> 3 votes

---
Tags: control-panel, forms
---


title: Superscript issues

text:
# Question
Title: Superscript issues
I'm having trouble getting  to work in the content editing area for EE 2.4.0. Put it in the source, switch back to text, looks fine but after submitting, just shows up as a regular number in both Chrome and FF. I would just use ³ for example, but I've got a 4 author paper I need to reference.

Any ideas?

# Answer
Could it be a styling issue? Try explicitly styling the sup. E.g.

```
sup {
  vertical-align: .6em;
  font-size: 65%;
}

```
> 1 votes

# Answer
Sounds like your CSS reset code is removing the default styling for the sup tag.
> 0 votes

---
Tags: ee2
---


# Question
Title: Inside Playa {if no_coparents}, display channel entries
I have a channel entries tag which displays Videos and then a playa pair tag (coparents) which displays related videos based on a specific field.

Now, I would like to display other videos (let's say the last two entries of the "video" channel) in case no related videos are found. I tried with `{if no_coparents}...{/if}` but no luck so far since I don't manage to display video channel entries inside those tags.

```
{exp:channel:entries channel="video" url_title="{segment_3}" limit="1" status="open" transcribe="disable"}
  <h1>{title}</h1>
  {video_file}
  {video_description}

  <div class="block-related three columns">
    <h2 class="first-title">Related Videos</h2>
    {exp:playa:coparents channel="video" field="video_related_field" dynamic="no" limit="2"}
      <div>
        <h4>{title}</h4>
        <div>
          <a href="#">
            {if video_flickr_thumbnail}
            <img src="{video_flickr_thumbnail}" alt="{title}">
            {if:elseif video_thumbnail}
            <img src="{video_thumbnail}" alt="{title}">
            {/if}
          </a>
        </div>
      </div>
    {/exp:playa:coparents}

{!-- Now here I would like to get something in case there isn't any related video.
It would be great if I could just call {exp:channel:entries channel="video"}
to retrieve the last two videos. I tried with {if no_coparents} ... {/if}
but no luck so far. --}

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

```

# Answer
Macxim - I just tested {if no\_coparents} with great success here:

```
{exp:channel:entries limit="10"}
<h1>{title}</h1>
{exp:playa:coparents}
{if no_coparents}
no coparents
{/if}
parent entry id: {parent:entry_id}<br />
{/exp:playa:coparents}
{/exp:channel:entries}

```

Can I ask you to try this code in a template and see what results you get? Just copy/paste the above into a template. You may need a few recent tests with coparents and without. I made this as minimal as possible to test it.

Please let me know if that helps!
> 1 votes

# Answer
You'll have to embed your alternative Channel Entries loop in this case.

```
{exp:playa:coparents channel="video" field="video_related_field" dynamic="no" limit="2"}
    <!-- snip -->
    {if no_coparents}
        {embed="videos/_related"}
    {/if}
{/exp:playa:coparents}

```
> 0 votes

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


title: cannot edit global template preferences

text:
# Question
Title: cannot edit global template preferences
I have a weird scenario where I am trying to edit my global template preferences. I change a simple dropdown or field, hit submit, and get a successful indicator (the green icon at the top of the screen) but the field has not changed. I output all template debugging and there doesn't seem to be any errors, but all changes are reverted to what they were before. I verified file permissions on database.php and config.php were 666. Any ideas why this might be happening?

# Answer
> 5 votes
I would suggest checking your config.php file and see if any of those global template preferences are explicitly set in your configs. If you are using FocusLab master config, I would check config.master.php and your individual environment configs.

# Answer
> 0 votes
I suggest reuploading your Themes directory. It's possible something is missing or corrupted.

Also, look for JS errors in the console that might be causing an issue.

---
Tags: templates, database, permissions
---


# Question
Title: Infinite scroll reaches the end, although there are more pages to show
I'm following another developer on a site and trying to speed it up. The functionality requires many entries to be displayed within a single document object. Previously, load times were abysmal so I've switched to pagination and I'm trying to implement infinite scroll to allow the rest of the pages to show in the same document object.

It seems as though every thing is working correctly until infinite scroll tries to load the new pages. Once you scroll to the bottom it tries to load something but says it cant.

What am I missing here? Code to set it up is:

```
<div id="timeline">
{exp:channel:entries channel="stories" orderby="story_year" dynamic="no" limit="20" paginate="bottom"}
    <article class="largeArticle gold"> ...
    </article>

    {paginate}
    {if next_page}
        <div class="navigation">
            <a href="{auto_path}" class="next">Show More</a>
        </div>
    {/if}
    {/paginate}
{/exp:channel:entries}
</div>

```

And the javascript is:

```
<script type="text/javascript">
  $(document).ready(function(){
        $("#timeline").infinitescroll({
            navSelevtor : ".navigation",
            nextSelector : "a.next",
            itemSelector : ".post",
            extractLink: true,
        });
  });
</script>

```

You can see this in action at http://thinkx.net/clients/manship/index.php/timeline.

Thanks for your help, I'm really stuck here.

# Answer
The problem is with my code when calling infinitescroll().

The itemSelector needs to be the information that EE loops out. So in this case, it should be:

```
itemSelector : ".largeArticle"

```

Now, all I need to do is get the footer timeline to work with it at the same time.
> 0 votes

---
Tags: javascript, pagination, jquery, optimization
---


title: Can you test for a null password?

text:
# Question
Title: Can you test for a null password?
I have users who authenticate using Twitter and Facebook (using the Social Login add-on). Those users have no password.

Is this something I can test for using ExpressionEngine logic?

The obvious suspects don't seem to work, but it's not terribly surprising:

```
{if password != ""}password == yes{/if}
{if password}password == yes{/if}

```

# Answer
> 2 votes
From their **Docs**:

> The contents of {password\_block} is displayed only when password is empty.

So `{password_block} password == no{/password_block}` should do the trick inside the `exp:social_login:add_userdata` tag.

---
Tags: password, authentication
---


# Question
Title: Allow duplicate emails/no email address on Member Registration
I'm working on a membership site for a Triathlon club (using Zoo Visitor).

My problem lies in that when a family registers to become members they all use the same email address (as their children may not have one yet) and I'm getting hit with EEs "The email you chose is not available".

I thought about adding the extra member details as custom fields but we do need them to register as individuals in the system.

I need to able to either:

* have a duplicate email address
* be able to leave the email address empty on some submissions

I am currently looking to use some javascript to create a "dummy" email address from the timestamp for the other family members but I'm not sure how safe this will be.

Has anyone had this issue before and found a solution? Any ideas would be appreciated.

Cheers

# Answer
Do they absolutely have to be individual members of the site? If not, you could use Profile:Edit to create a "Household" or master account for the family, and then allow multiple profiles to be created for each subsequent family member. That way you could have one overall contact email address, but additional information per person?
> 2 votes

# Answer
If you don't mind hacking the core, you can comment out lines `370-373` to allow no email address & `418-423` to allow duplicate email in the `system/expresssionengine/libraries/Validate.php` file

I would just then make note of those changes in a safe place for future updates
> 2 votes

---
Tags: members
---


title: Updating price from hidden field

text:
# Question
Title: Updating price from hidden field
this may be a bit confusing to explain but I'll do my best.

I have products in Store which have a base price and price modifiers which so far works as expected. However I also need to update the price based on user input via a text input field.

Basically the user enters some text, and Javascript counts the characters, which then needs to adjust the price, the original price times the number of characters.

I can't use the item quantity field because of the other price modifiers, these do not change based on the number of letters but are set for each individual product.

I have also been told to use input:custom\_modifier\_name (https://www.exp-resso.com/docs/store/product\_tag.html#inputcustom\_modifier\_name), and this does seem to work according to the documentation. However it is not obvious to me how this could be used to update the price.

Can anyone help me out? I've went round in a circle a few times.

Thanks, Laura

# Answer
> 0 votes
As Store is currently setup text modifiers (created in the CP or via input:custom\_modifier\_name tag parameters) don't allow for Store to adjust the price of the item. You would want to create a Variation (Single SKU) with the name of text\_count or similar with something along the lines of

```
1 = $1.00
2 = $2.00
3 = $3.00

```

and so on until you have the max number of characters you want to allow a user to create. Then in your template you could use input:custom\_modifier\_name to create a text field for every product that would allow the user to enter whatever text that you want to enter in. Then when you calculate the total of number characters in that field you would want to have a bit of Javascript that selects the hidden field text\_count and adjust the select field to match the number of characters in your text field.

---
Tags: expresso-store
---


# Question
Title: Expresso-Store Email Template - more than 1 BCC address?
Can I add more than one bcc email address to the Expresso-Store Email Template? In case I can, should i use comma between the address'?

# Answer
> 3 votes
Yup the BBC field allows a comma delimited list of email addresses.

---
Tags: expresso-store
---


title: front end login

text:
# Question
Title: front end login
I have a login on my front end, if a member logs in and then clicks on a link to "edit\_this" which is the shortcut to the back end to edit the entry, why do they have to login again on the back end?

# Answer
> 3 votes
Most likely because they are logged in with `www.domain.com` but visiting the cp with `domain.com` or visa versa.

The solution is to adjust the Cookie settings for the EE install. Specifically, set a **Cookie Domain** so the member's logged in session will be used across both URLs.

# Answer
> 1 votes
Anna's solution is good. You could also utilise your htaccess file to always run the site with or without the www

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


# Question
Title: Loading different entry revisions in ExpressionEngine 2 per environment
I'm developing a website using ExpressionEngine 2, which will sit on both a staging and production environment, both with their own database. We will be running a cron job to synchronise the databases and file structure on an daily basis.

The control panel will only be accessible on the staging environment. Here, 3 user groups can follow a workflow I have created using the status groups:

* Step 1 - "Editor" edits the entry and changes the status to edited, submits.
* Step 2 - "Approver" checks the content and changes the status to approved, submits.
* Step 3 - "Publisher" changes the status to published, submits.

The staging environment will show any changes to content at step 1, meaning we can test the front-end of the site as required, when a change has been submitted. Whereas, the production environment is only displaying the changes if the status of all 3 steps have been competed (status=published). This is exactly how we need the environments to work.

The problem arises when we need to edit a page that has previously been published. If an editor is to edit an entry and the other two steps aren't completed in the window before the next synchronise, the content from the page will vanish on production (since status=edited).

We understand that a solution for this could potentially be found by using the 'Entry revisions' (http://ellislab.com/expressionengine/user-guide/cp/content/publish.html#revisions-tab). If we were able to grab the last published revision of an entry if status!=published, we could display this on the production environment until the page next reaches a published state.

Can anyone tell me if this is at all possible?

If not, can anyone suggest any other potential solutions?

Thank you, Chris

# Answer
Chris, this is something of a quandary that has lingered in EE (and any relational db environment) for ages.

Our general workflow is that content is always published in production and only template development is tested in staging.

I had an issue years ago using another CMS where we were trying to setup this kind of synchronisation but we found there wasn't a way to do it without overwriting authors at some point.
> 1 votes

---
Tags: entry, status, staging-server
---


# Question
Title: Exp-resso store Payment order description
While I'm here I'll might ask the next question as well.

When placing and paying an order on the transaction description from the payment provider it only says "Order 12" or another number.

Is it possible to change this. For example by adding the product title or something else custom. One of the custom order fields perhaps?

I'm setting up Store to work with donations and a little shop. It would be nice to add something extra to the description like "Donation ..."

Running EE 2.5.5 and Store 1.6.3

Tnx, Martijn

# Answer
In your templates you can use the `{items}` loop to list out any additional details about a specific order that you want. Something along the lines of:

```
{exp:store:orders}
{items}
 {title} -- {item_subtotal}
{/items}
{exp:store:orders}

```

This will work in the Cart/Checkout/Orders templates and the email templates. You can use any variables mentioned here along with a few extra tags in the order template/email listed here
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Exp-resso store Payment gateway iDEAL not working
I've sent an email to Exp-resso's support but didn't get an answer. I'm trying to setup the iDAEL payment gateway. Got all the certificates in place. On the final step where you choose you payment iDeal and your Payment Issuer. I'm getting an XML error on the Payment Issuer list.

I did al lot of checking and testing with no result. My question was and is: "on what version of iDAEL is the payment gateway based?" The old version 2 or the new version 3 which was released in April 2012. If based on version 2 then my question is when can we expect an update based on version 3.

When looking at merchant\_ideal.php and the change log on iDEAL v3 then it must be based on version 2.

See: http://www.ideal.nl/download/iDEAL\_Merchant\_Integration\_Guide\_Summary\_of\_Changes\_v3.3.1\_ENG.pdf

If it's already based on version 3 then could someone help my fix this problem?

Running EE 2.5.5. Store 1.6.3 on a windows IIS 6 (\<= Yes I know, it sucks but running)

Thanks, Martijn

# Answer
From what I can tell, Store uses iDEAL v2. We simply implemented the version that was specified in documents sent to us when the gateway development was originally sponsored - your email was the first time I heard about an iDEAL v3.

If your bank can support iDEAL v2 then that is the best option for you. Otherwise, it may require us to develop a new gateway if a lot has changed in the API (it sounds like it). You can follow up with us via email if you want to discuss developing a new gateway.
> 1 votes

---
Tags: expresso-store, payment-gateway
---


# Question
Title: Automatically search Amazon and create affiliate link based on entry title?
I know this is gonna sound crazy, but it is a client request.

They are wanting to know if there is an add-on available or that has been developed that will automatically search Amazon with whatever the entry title is; which is a specific product, and have it then create a specific affiliate like link within another custom field.

Client is not wanting to have to input any information themselves to search Amazon or produce this link but have EE and the Amazon API do it automatically.

Example of link is: http://www.amazon.com/dp/ASIN/?tag=YourAssociatesId

I know of this add-on: http://www.hopstudios.com/software/amazon\_web\_services\_aws\_products But this requires the client to input info to search amazon, not do it automatically dependent of what they filled out for the entry title.

Has there been add-on developed for a specific site that possibly is available?

Thanks

# Answer
> 2 votes
As UltraBob has mentioned before the HopStudios plugin will not be able to achieve what you are wanting unless the client is entering very specific titles for their entries and all of the items they are wanting to add are in the same category on Amazon. By default the keyword search use the "books" index for Amazon. You could bypass this at the template level but not based upon the title alone if you need to search multiple indexes.

The keywords search tag can often produce some wild results even with descriptive words. For example when I used it I was creating an online Vinyl record store where it would pull the product data from Amazon instead of the admins having to enter the data into the CP. Using the keywords search for something like "The Beatles" I would get plenty of results that were not the Beatles but someone that had covered a Beatles song. I eventually had to switch over to using the ASIN number to get reliable results.

So unless your client is using the ASIN number as the title of their entries you would need to have a custom field or develop a fieldtype to handle what you want to do.

# Answer
> 0 votes
Would you not just be able to insert the {title} field between the {define\_keywords} tag pair in the template, does parse order get in your way there, or am I missing some other reason why that wouldn't work?

# Answer
> 0 votes
I think theoretically this can work. If you use the exact ASIN for each product as a segment variable and then use that segment variable as the search term within the AWS add-on from HopStudios you could build the page entirely from data from the Amazon api.

The only potential problem would be parse order - you would need to test the setup to see if worked.

Example:

```
{exp:aws_products:search limit="1" region="com" index="All" debug="no" cache="yes" refresh="300000"}
{define_keywords}{segment_3}{/define_keywords}

{if product_name}Product Name: {product_name}<br />{/if}

{/exp:aws_products:search}

```

Note that I've used `index="All"` which neatly gets around just searching the Books section of Amazon. It's not documented on HopStudios site but I just took a wild guess and it worked. : )

Also if you use the ASIN as the search term it will work on all of Amazon's international sites (provided the product is listed). So again theoretically if you were to specify the Amazon locale as a segment variable you could create localised versions of the page.

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


title: content cleaning

text:
# Question
Title: content cleaning
About to kick-off an 1.x to 2.x upgrade.

For the most part the site is in decent shape. Unfortunately though we're dealing with some WYSIWYG fields where content that's been pasted from Word and other horrible places where the HTML is pretty ridiculous.

I've already ran it through a tag stripper for XML import but we still have a host of classes on p tags and inline styles.

I had thought about using XSLT to strip the crap from the XML but not sure where I'd even start here.

Any suggestions or known methods?

# Answer
> 1 votes
So, I'm not sure if this would be sufficient or even what you're looking for (if there's loads of content this will be tedious), but first thing I thought of was just doing it frontend with jQuery:

```
$('#textDiv').find('*').each(function() {
    $(this).removeAttr('class').removeAttr('style');
});

```

And then copy the HTML from Firebug.

Then I got really self-conscious about my suggestion and searched a little, and found this: HTML Purifier that seems to be exactly what you're looking for.

---
Tags: strip-html, html, content
---


title: Ticket sales through expression engine?

text:
# Question
Title: Ticket sales through expression engine?
Does anyone have any experience with selling tickets box office style? I have exp:resso store, but I havent seen addy add ons for ticket sales. In a perfect world, it would be awesome for the customer should be able to buy the ticket and then print a ticket after payment.

Does anyone have any suggestions or advice?

Thanks again

# Answer
I have created several sites that sell tickets to classes and the like, using Exp:resso Store. It should work fine for what you want. You would want to add each event as a "product", and you could use the product modifiers for different ticket levels if necessary (orchestra vs. balcony, etc.). If you set the modifier to use multiple SKUs you can accommodate differing numbers of tickets at each level.

For printing tickets, you would want to set up a member account page (you could use Freemember or Zoo Visitor to make this process much easier) that lists all of a person's orders using the {exp:store:orders member\_id="CURRENT\_USER"} tag pair. You will link from there to a new template that uses something like the following (assuming your link was constructed like: `{path="account/orders/{order_hash}/{entry_id}"}`) to get information about the event they registered for:

```
{exp:store:orders order_hash="{segment_3}"}
  {items}{if entry_id == {segment_4}}
    {!-- Whatever information you want to display on your ticket --}
  {/if}{/items}
{/exp:store:orders}

```

Of course, you could also link to that same template from the order confirmation page.
> 4 votes

---
Tags: expresso-store, ecommerce
---


title: Dealing With Cross-References in EE?

text:
# Question
Title: Dealing With Cross-References in EE?
I'm wondering what the EE design pattern, or best practice, is for cross-references.

I have a products channel that needs to be cross-referenced with a number of available colours, for instance.

Do I create an All Colours channel (contains all possible colours), and a Product Colours cross-reference channel, with relationships to the Products and All Colours channels? And let the user create the cross-reference by selecting the product and colour, then selecting the same product and another colour? Or is there a better way? (Please, please, tell me there's a better way.)

I'm open to writing add-ons. In fact, I'm researching that now. Not crazy about the hooks docs so far.

Thanks for your help.

Update: Thanks for the replies. You asked for more detail; so here it is.

Colours are just one of the cross-references I'm dealing with. The colours just have to point to a colour swatch (image) for display purposes. So a category could be used. Plus, with the category fieldtype add-on, we can make that category a required field.

But as I said, we have other cross-references to deal with. Each product is in a product type category (and yes, they're implemented as categories). Each product type has an image associated with it. So far, just like the colours. But then the user decided that some product types might have two images, and the user needed to select which one would be associated with each product.

This one is making my hair turn grey. If Playa is the answer here, I'm happy to get it. But what are these tags you speak of? I haven't heard of them before. When I did a search, I got Channel Entries Tag, which is just the template tag.

Thanks again.

# Answer
Bluedreamer is right, using tags for your colors might work great. But if extra data needs to be stored along with your colors, then storing them as fully-fledged entries is probably better. *

If you do need colors to be entries, you could just use the following set up:

Create two Channels: "Products" and "Colors"

*Assuming a product has many colors:*
In the Product Channel's custom field group create a custom field for the color relationship using Playa. Then, when editing a product entry you assign any colors (eg, create the relationships) using Playa's drop-panes mode. If you haven't tried it, Playa is very easy to use and has really flexible template tags.

*If the product only ever has one color:*
You could use the native Relationships field instead of Playa, but Playa also has a great single-select mode.

* As Travis pointed out in his comment on Bluedreamer's answer, Categories can hold extra data. So you could definitely consider using them for colors, but the interface and template tags for categories are more limiting than if you use Channel entries and Playa.
> 2 votes

# Answer
I think we'd need a little more information on the content structure and how you want to output the data.

Relationships are possible, but on first glance I'd probably look at using Tags for the colours.

You could use categories for colours, then assign relevent products to each relevent category - that would allow you to browse by colour, or pull in a list of colours into a product.
> 3 votes

---
Tags: ee2, bestpractice
---


title: Javascript email error with prettyphoto

text:
# Question
Title: Javascript email error with prettyphoto
Im using prettyphoto to create a staff popout info page when a staff photo is clicked.

Pretty photo calls another template via ajax, which works ok except for the staff email which outputs an error: 'JavaScript must be enabled to view this email address'. The code in the ajax popup is as follows:

```
<div class="modal">
{exp:channel:entries channel="leadershipteam" disable="categories|trackbacks|pagination" sort="asc" entry_id="{embed:entry_id}" limit="1"}
<img src="{colourphoto}" class="leftimage"><h1>{title}</h1><h2>{staff_title}</h2>
<p>{staffdescription}</p>
<br /><strong>{if staff_email} E: {staff_email}<br><br>{/if}{if staff_phone}P: {staff_phone}<br />{/if}</strong>
{/exp:channel:entries}
{clear}
</div>

```

# Answer
> 1 votes
You can't serve javascript via AJAX -- and the email address is being automatically encoded as Javascript to protect it from spammers.

The way around this is to turn off "Automatically turn URLs and email addresses into links?" in the channel preferences.

TTFN Travis

---
Tags: ajax
---


title: Conditional with Ip Address

text:
# Question
Title: Conditional with Ip Address
This one has me baffled.

I'd like to show some content based on the Global variable IP Address. But none of these work:

```
{if {ip_address} != 127.0.0.2}SHOW THIS{/if}

```

OR

```
{if {ip_address} != '127.0.0.2'}SHOW THIS{/if}

```

OR

```
{if '{ip_address}' != '127.0.0.2'}SHOW THIS{/if}

```

I would expect at least the last conditional to work. Is this a parsing issue?

# Answer
The variable `{ip_address}` is one of the standard global variables that is parsed last, even after advanced conditionals. That means you can't use it in a conditional.

You can use Mo’ Variables (or Low Variables if you’re already using it) to have `{logged_in_ip_address}` available as an early parsed var, so you *can* use it in conditionals.
> 4 votes

# Answer
As EE parses `{ip_address}` after advanced conditionals it easy enough to get that data parsed sooner. I haven't got Low Variables installed on this site otherwise I would use it.

Instead you could add it as a variable to config.php:

```
$config['ipaddress'] = $_SERVER['REMOTE_ADDR'];

```

Or I've actually added to my bootstrap file but it achieves the same thing.
> 2 votes

# Answer
This standard global variable should work with logged in member. See here http://ellislab.com/expressionengine/user-guide/templates/globals/single\_variables.html#ip-address
> 1 votes

---
Tags: global-variables
---


# Question
Title: DevDemon Channel Images Button not showing up in Wygwam
I can't get the channel images button to show up in Wygwam. I'm running EE 2.5.3, Wygwam 2.7, and Channel Images 5.4.2. I have made sure to install the channel images plugin in the themes \> third party \> wygwam \> lib \> ckeditor \> plugins folder. There are no javascript errors being thrown. I've cleared my cache on browser and ee cms, and tried with a new configuration and existing one. The channel images and wygwam fields are in the same field group. I've performed a "Run Module Updates" in the Modules menu in EE.

I've also noticed another error - which may be with my configuration or with your plugin, where if you go to Admin \> Channel Administration \> Channel Fields \> and edit your wygwam field, then click on "Edit Configurations" under editor configurations, it takes you to a page that says "the requested module could not be found". But if you go to edit the configurations from Addons \> Modules \> Wygwam \> Editor Configurations - it shows up properly. No errors are thrown in the console.

# Answer
> 1 votes
Ah - figured it out - the channel images button cannot be added to an editor configuration (it doesn't show up) - but it just shows up automatically in the configuration when you edit an entry.

---
Tags: wygwam, pixelandtonic, channel-images, devdemon
---


title: Affecting the last Category in a list

text:
# Question
Title: Affecting the last Category in a list
I have this code:

> {categories}{category\_name}, {/categories}

Outputting in a Entries Tag Pair.

I would like to remove the comma from the last outputted category only. I am thinking an IF statement but am not really sure what would be appropriate for this.

Any help would be much appreciated.

# Answer
What you want is the backspace parameter.

"Backspacing removes characters (including spaces and line breaks) from the last iteration of the loop."

```
{categories backspace="2"}{category_name}, {/categories}

```
> 4 votes

---
Tags: categories, ifelse
---


# Question
Title: Freemember inline errors are clearing form field values
I'm having an issue with freemember inline error checking. The error checking works fine, but when the page refreshes it loses all the correctly entered data.

So for example if I have a registration page; I fill out my name and other details but miss out a required field like email. When I hit submit the page refreshes and an error message has appeared by the email field, but all the values for name etc are blank and the user has to fill them in again. Obviously I would prefer those details to have been remembered.

Any ideas?

# Answer
It sounds to me like you're hard coding the fields without the values. Have you tried using the example in the FreeMember docs?

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

    <p>
        <label for="email">Email</label><br />
        {field:email}<br />
        {error:email}
    </p>

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

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

    <p>
        {field:accept_terms} <label for="accept_terms">Accept Terms</label><br />
        {error:accept_terms}
    </p>

    <p>
        <input type="submit" value="Submit" />
    </p>

{/exp:freemember:register}

```
> 2 votes

---
Tags: freemember
---


# Question
Title: include author as searchable field in simple search
I'm trying to allow the author of an entry to be searchable using expression engine's simple search form. Is this possible?

# Answer
It should be possible.

Using EE's stock advanced search form you can include a "member name" as a free text search field, see http://ellislab.com/expressionengine/user-guide/modules/search/advanced.html

If you wanted to pull in precise names you could look at using a plugin to pull a list into the search form, eg https://exp-resso.com/freemember \- there may be other plugins you could use at http://devot-ee.com \- failing that a simple SQL query should do the trick.

Failing that Solspace's Super search modile - http://www.solspace.com/docs/super\_search/search/ \- has the ability to include author information in searches.
> 1 votes

---
Tags: search, simple-search, author
---


# Question
Title: Low Variables aren't displaying in the Matrix dropdown
This is the second site I've had this problem on, but when I set a matrix field to low variables, I set the grouping I want, add a low variable to that group, but when I go to the entry, the dropdown in matrix is empty.

Using:

* EE 2.5.5,
* Low Variables 2.3.4
* Matrix 2.5.3

# Answer
Let me quote the docs:

> Please note that only *non-hidden* and variables with *early parsing disabled* show up in the variable list in the Publish Form.

This goes for Matrix fields as well. Make sure the variables you want to select from aren't hidden nor have early parsing enabled.
> 2 votes

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


title: MySQL connection on a non-standard port

text:
# Question
Title: MySQL connection on a non-standard port
We were experimenting with running an EE database stored on AWS and we found that MySQL was running on a non-standard port.

# Answer
First thought was we'd add a config var for the MySQL port as per the CodeIngiter docs

```
$db['default']['port'] = 5432

```

but that didn't work instead we had to change the hostname to

```
$db['expressionengine']['hostname'] = "mysqldbinstance.hostname.com:4703";

```
> 3 votes

---
Tags: config, mysql
---


# Question
Title: Can DataGrab check for duplicate entries using entry_id or url_title?
I went to set up a data import for a CSV to bulk update product prices and discovered that there is no option to check for duplicates on `exp_channel_titles.entry_id` or `exp_channel_titles.url_title`.

This feature only seems to work on custom fields in the channel's field group.

Unfortunately this product list does not have any real-world product code or similar unique identification system so using the `entry_id` or `url_title` would be ideal.

I'm using plain old channels here and not using third-party add-ons for this channel.

Is this something that can be done using DataGrab or will I need to add this functionality?

# Answer
If I remember correctly "title" is something you can key off when doing the import.
> 1 votes

# Answer
sorry for the late reply here! If you look here - http://brandnewbox.co.uk/forums/viewthread/785/ Andrew claims that this is available. I cannot see it in the new version i've downloaded but if you ping @ajweaver he might be able to furnish you with a copy that has this?
> 1 votes

---
Tags: datagrab
---


title: Using OR in an if statement

text:
# Question
Title: Using OR in an if statement
I have this code:

```
{if segment_1 != "slug1" || segment_1 != "slug2"}<h2>Text</h2>{/if}

```

For some reason this does not work with the second instruction after the OR operator. If I remove the OR operator and the following code it is fine ie.

```
{if segment_1 != "slug1"}<h2>Text</h2>{/if}

```

The OR operator seems to be the problem here. Can anyone shed some light on this?

# Answer
> 1 votes
In your case here, because of the double "!=", use "AND" instead of "OR":

```
{if segment_1 != "slug1" AND segment_1 != "slug2"}<h2>Text</h2>{/if}

```

OR use:

```
{if segment_1 == "slug1" OR segment_1 == "slug2"}
{if:else}
    <h2>Text</h2>
{/if}

```

---

DOCS: **Logical Operator**

---
Tags: ifelse
---


# Question
Title: Unable to save your template as a text file
When saving a template I'm greeted with this rather familiar error:

> Unable to save your template as a text file

It's definitely the server path, since the permissions of the templates folder are set to 777.

The server path I'm working with looks rather peculiar though. When printing the $\_SERVER\["SCRIPT\_FILENAME"\], I get this in return:

> D:\WebSites\limited-cobe\www\test.php

*notice the backslashes, instead of forward slashes.*

So, I'm using this for my Basepath to Template File Directory, but apparently I'm still doing something wrong.

> D:/WebSites/limited-cobe/www/system/expressionengine/templates/

Any ideas ?

# Answer
> 9 votes
There are only two reasons templates won't save as flat files:

1. The permissions on the destination directory are not set to 777
2. The path to the directory is not correct.

---

In your case, the path is not correct. Changing the path from:

```
D:/WebSites/limited-cobe/www/system/expressionengine/templates/

```

to:

```
D:/WebSites/limited-cobe/www/system/expressionengine/templates

```

without the trailing slash, will fix the issue.

---

DOCS: **Set Template Preferences**

# Answer
> 2 votes
In the root of your site, i.e the same level as the index.php, create a file called info.php and put in there the following code:

```
<?php

echo $_SERVER['DOCUMENT_ROOT'];

?>

```

Then using your browser, go to yoursite.com/info.php (obviously replace yoursite.com with whatever your url is for accessing your site) and put here whatever it outputs. Then, delete that file!

Or, whatever it outputs, just add the rest of the template folders file path onto the end using the same slash direction that it outputs.

---
Tags: ee2, path
---


title: Problem with store.js

text:
# Question
Title: Problem with store.js
I'm using Expresso Store and having problems with store.js. It loads but returns an error:

> Uncaught TypeError: undefined is not a function

On line 142.

I've built my store locally using Expresso Store and all is working with store.js loading and functioning correctly. I've then made a complete export of all files and DB to a remote staging server as a complete replica and everything is working apart from store.js. It is returning the above error and I can't add any items to my cart.

Any ideas what the problem could be?

# Answer
This looked to be my own fault as I'd written a custom extension to interact with Store. It was this that was causing the problem. store.js is loading fine now.
> 1 votes

# Answer
There are a few things that you can look at.

* Clear your cache in your browser
* Make sure that you are calling jQuery in your header area.
* Make sure all of your theme paths are correct.
* Reupload the store theme folder.
> 1 votes

---
Tags: expresso-store
---


title: Error 330 for a basic Safecracker form

text:
# Question
Title: Error 330 for a basic Safecracker form
I've setup a template at test/index that simply contains the following;

```
{exp:safecracker channel="quote_request"}
   <input name="title" type="text">
   <input name="my_custom_field" type="text">
   <input type="submit" value="Submit">
{/exp:safecracker}

```

However, the page is simply returning a "This webpage is not available" and "Error 330 (net::ERR\_CONTENT\_DECODING\_FAILED): Unknown error."

I do have a channel called quote\_request. I'm using ExpressionEngine 2.5.5 and Safecracker 2.1.

Wondered if anyone else has had this issue before? :/

# Answer
Hmm, seems that the GZip compression causes this issue. All sorted.
> 1 votes

---
Tags: safecracker
---


# Question
Title: How do you modify the basic CSS of the member registration page?
Expressionengine 2 makes it extremely easy to bring a potential new member to a site via the registration form with one simple line of code:

```
<a href="{path='member/register'}">sign-up</a>

```

It works, signs up people, etc. The problem is that there seems to be no template anywhere that populates this page. Also it generates a ton of CSS. how can you modify the HTML and or CSS for this page?

Thanks in advance.

# Answer
> 2 votes
It's one of the member profile/system templates, but it's not under the Template Designer. Look in the /themes/ folder, under profile\_themes/default. That's how you'd find and edit the template files directly on your desktop.

To edit these templates in the EE control panel, choose Design \> Member Profile Templates, then go into Default (if that's the theme you're using.) The "CSS Stylesheet" is the CSS for all Default profile template pages. The "Registration Form" is the HTML for the Default profile registration-form template itself.

(This is the same place where you can edit the system error page, the login form, all kinds of goodies. You can even create your own "theme" that's styled very differently from the default one. You just have to remember that you get at them different ways.)

---
Tags: registration
---


# Question
Title: how to write conditional counts with playa?
Hi I am using playa on a real estate site.

I have properties listed with the realtor that is selling the property and I can get that working fine with playa. My issue is when I have a property that has two realtors selling it. I can listing both of them fine, but I want to have them displayed in an accordion if there are more than one realtor.

This is the code I have thus far :

```
 {exp:playa:children}
 {if count == "1"}
 <ul class="agent">
 <li class="name">{title}</li>
 <li class="phone">{phone}</li>
 <li class="mail">{agent_email}</li>
 </ul>
 {if:else}
 <div class="accordion">
 <h3 class="name">{title}</h3>
 <div>
 <ul class="agent">
 <li class="phone">{phone}</li>
 <li class="mail">{agent_email}</li>
 </ul>
 </div>
 </div>
 {/if}
 {/exp:playa:children}

```

What I am seeing is single realtors being listed fine, but when there are two realtors it lists the first one as a single and puts the second realtor in the accordion.

Any help would be great, I have been trying to figure this out for a while and can't seem to quite get there.

Thanks!

# Answer
> 4 votes
Have you tried using `total_results` instead of `count`?

```
{exp:playa:children}
    {if total_results == "1"}
        <ul class="agent">
            <li class="name">{title}</li>
            <li class="phone">{phone}</li>
            <li class="mail">{agent_email}</li>
        </ul>
    {if:else}
        <div class="accordion">
            <h3 class="name">{title}</h3>
            <div>
                <ul class="agent">
                    <li class="phone">{phone}</li>
                    <li class="mail">{agent_email}</li>
                </ul>
            </div>
        </div>
    {/if}
{/exp:playa:children}

```

---
Tags: playa
---