title: Monthly subscription - Simple Commerce

text:
# Question
Title: Monthly subscription - Simple Commerce
I have created Zoo visitor members to have the ability to upload only one entry via safecracker with status **close** (Which I can do that). They will be allowed to tweak the content whatever they like.

I am hoping to find a way, to create a monthly payment to switch the status to **open** to make it visible to public.

Before I develop anything. I saw the price for Cartthob Subscription which is very steep and cannot afford right now. I would like to know if it possible to work with Simple Commerce, has anyone done this before or offer me a guidance.

Looking above at my request which looks really simple, $299 is too steep for this Cartthob Subscription feature.

ps: I do not have any experience with payment gateways setup.

Many thanks

# Answer
In EE2 Simple Commerce can do monthly payments also but does not have the functionality to open/close channel entries. Also it only works with a PayPal account (and if I remember correctly) the PayPal Standard API which requires an IPN notification to be sent out and received for the system to mark items as paid. That API is notoriously buggy.

As Ian mentioned there is also CartThrob \+ Subscriptions but it will total in at $600 if you do not already have license to either pieces of software. Having said that $600 is still between 10-100 times cheaper then developing something for yourself.

From your original post if you want something integrated into EE that is not going to break the bank your best bet would be Membrr. It can be a slight pain to set up as the actual Payment Gateway system requires IonCube installed on the server.
> 1 votes

# Answer
> Looking above at my request which looks really simple, $299 is too steep for this Cartthob Subscription feature.

You should try developing it yourself then. When you're done (I'll guess in about a year) let us know how much you want to sell it for :)

$299 is a bargain for that piece of software. If you aren't covering that cost with the price of a few subscriptions (or at the very least saving a few billable hours of your time), you're doing it wrong.
> 1 votes

# Answer
No, Simple Commerce can't do subscriptions.

Like Justin says you can use Membrr but it's still going to cost $145. In my experience of using Membrr, the extra you'd pay for Cartthrob is worth it for the hassle you get from using Membrr, although support from Cartthrob is a bit of an issue at the moment.

> Looking above at my request which looks really simple, $299 is too steep for this Cartthob Subscription feature.

It might look simple, but it's not, and $300 is a fair price for the amount of work it would save you if you were to develop it yourself.
> 0 votes

---
Tags: safecracker, ecommerce, zoo-visitor, status, payment-gateway
---


title: Remove template segment from URL

text:
# Question
Title: Remove template segment from URL
Is it possible to remove the template group from the url so instead of http://example.com/blog/article/postone it would be http://example.com/blog/postone. I already stripped the index.php via .htaccess.

My blog/index code:

```
{exp:channel:entries channel="blog" limit="8" orderby="date" sort="desc"}
  <h1>{title}</h1>
  <p>{blog_except}</p>
  <p><a href="{title_permalink='blog/article'}">{title}</a></p>
{/exp:channel:entries}

```

And my blog/article code:

```
{exp:channel:entries channel="blog" limit="1"}
  <h1>{title}</h1>
  <p>{blog_body}</p>
{/exp:channel:entries}

```

Thank you.

# Answer
This is just simple routing so I'd look to use Freeway here. Then you can just map up the desired URL with the actual URL like this:

```
blogs/{{entry}} => blog/article/{{entry}}

```

Then people will be able to visit `blogs/entry-title` and EE will treat it as if they visited `blog/article/entry-title` and use the appropriate template\_group/template.
> 0 votes

# Answer
In the past i used to have an elaborate `{exp:switchee}` tag in de blog/index template, that would check for various possibilities for segment\_2. Process a channel:entries tag accordingly, wether it is a number (archives), or pagination (P12), otherwise treat it like a url\_title. (pseudo code)

```
{exp:switchee variable="{segment_2}" parse="inward"}
{case value="#/d+#"}
  // number means archives
  // process further? e.g. months etc. 2012/04
{/case}
{case value="''|#^P/d+#"}
  //pagination or empty (meaning index)
{/case}
{case default="yes"}
  // not empty, expecting url_title
{/case}
{/exp:switchee}

```

Edit: But actually, i went back to more separate templates for detail views (single entry), archives and listviews. Not have one huge index template anymore.
> 3 votes

---
Tags: url
---


title: Limit total returned entries - problem

text:
# Question
Title: Limit total returned entries - problem
We are having a problem limiting entries correctly. Our original code:

```
 {exp:channel:entries channel="daily-deals" search:monday-deal="not IS_EMPTY" parse="inward" orderby="random"}
    {if monday-deal}
    {exp:playa:children field="deal-owner" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic" parse="inward"}
    {exp:playa:parents channel="daily-deals"}{monday-deal}{/exp:playa:parents} - {title} - {city},{state-short}<br>
    {/exp:playa:children}
    {/if}
    {/exp:channel:entries}

```

The code above correctly returns the correct entry results (21 total entries) BUT we want to limit the number of results shown.

When we add limit="6" to the outer entry call as follows:

```
{exp:channel:entries channel="daily-deals" search:monday-deal="not IS_EMPTY" parse="inward" orderby="random" limit="6"}
{if monday-deal}
{exp:playa:children field="deal-owner" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic" parse="inward"}
{exp:playa:parents channel="daily-deals"}{if monday-deal}{monday-deal}{/if}{/exp:playa:parents} - {title} - {city},{state-short}<br>
{/exp:playa:children}
{/if}
{/exp:channel:entries}

```

THIS code returns random number of results from 2-6. I believe it is because when the outter call starts by limiting to 6 entries - not all of those 6 entries make it past the inner calls - thus a different number of results are displayed.

HOW do we return all 21 results, but only display 6 of the total results?

# Answer
> 1 votes
Not sure if this will work, but you could try wrapping your template code inside the channel entries with this:

```
{if count <=6}

{/if}

```

Theoretically this should only display the first 6 results that match what you get.

# Answer
> 0 votes
I'm not sure if this is directly associated with your problem but just something I notice looking at your code is that you seem to duplicate a lot of the conditional checks. If you're using `search:monday-deal="not IS_EMPTY` then you don't need a conditional check for `{if monday-deal}` as you've already checked is has something in it.

```
{exp:channel:entries channel="daily-deals" search:monday-deal="not IS_EMPTY" orderby="random" limit="6"}

        {exp:playa:children field="deal-owner" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic"}

            {exp:playa:parents channel="daily-deals"}
                {monday-deal}
            {/exp:playa:parents} - {title} - {city},{state-short}<br>

        {/exp:playa:children}

{/exp:channel:entries}

```

I've also stripped out the other conditional around {monday-deal} later on, but I'm not entirely sure, that one may be required. Try it and see.

I've also removed the `parse="inward"` tags as I'm not sure you need those either? What do you get with the above?

---
Tags: playa, low-seg2cat
---


title: Order entries by custom time field

text:
# Question
Title: Order entries by custom time field
I'm trying to build a conference schedule and I would like each time slot entry in my channel to be ordered by the time designated in a custom field. My first approach used a text field {start\_time} to enter the time the event begins. Then I set the entries tag to orderby="start\_time" sort="as". Unfortunately, the output was as follows:

* 11:00am - 11:15am | Break
* 11:15am - 12:30pm | Breakout Session II
* 12:30pm - 12:45pm | Break
* 12:45pm - 2:15pm | Lunch & Keynote
* 2:15pm - 2:30pm | Break
* 2:30pm - 3:45pm | Concurrent Session III
* **7:30am - 12:00pm | Conference Start Time**
* 8:00am - 9:00am | Breakfast Buffet
* 9:00am - 9:45am | Opening Welcome and Remarks
* 9:00am - 9:45am | Break
* 9:45am -11:00am | Breakout Session I

I understand why this is happening and have looked into Low Reorder as a possible solution. But before I purchase I was wondering if there was another solution to this that would not involve entering the times in this format: 07:30am.

Thanks!

# Answer
I would suggest you to use "Time Select" field type (http://devot-ee.com/add-ons/time-select) as it stores the time value as integer to orderby would work correctly with parameter orderby="start\_date".
> 3 votes

# Answer
This plugin may be of help to you as well. http://gotolow.com/addons/low-events

One other possible idea is store it in military time and then date format on display: http://ellislab.com/expressionengine/user-guide/templates/date\_variable\_formatting.html
> 1 votes

# Answer
The orderby parameter does funky things when you want it to order by a date field that isn't native (like entry date). Solspace has a free add-on that should solve your problem - the Date Field Filter add-on re-maps the date-related field, giving you the same kind of ordering behaviour you would get if you were using the entry date as your start time field. What you wind up with is:

```
{exp:channel:entries channel="your_channel" date_field="your_custom_date_field" orderby="your_custom_date_field" sort="asc" limit="##" dynamic="no" disable="whatever_you_disable"}

you date info here

{/exp:channel:entries}

```

There are also date\_field\_start and date\_field\_stop parameters as well. I've used it a few times to better control ordering entries by custom date fields, and it has worked great.

Hope that helps.
> 0 votes

---
Tags: custom-fields, time, orderby
---


title: Receiving Spam Continuously

text:
# Question
Title: Receiving Spam Continuously
I am continuously receiving Spam even though i have installed "low NoSpam" and "Freeform Anti-Spam" any ideas on how to block this out completely or alternative add-on.. thanks!!!!!

# Answer
I would suggest you to use Snaptcha (http://www.putyourlightson.net/snaptcha). I had faced such a problem but Snaptcha worked great for me.
> 3 votes

---
Tags: spam
---


title: Saving rendered page as image

text:
# Question
Title: Saving rendered page as image
I'm trying to find a way to have EE automatically save a webpage as an image.

Basically when an single entry page is rendered I would also like EE to create an image of the finished page and attach it to the entry for access by a link or download. would be great to have domainame.com/images/made/{url\_title}.jpg

thanks mike

# Answer
> 1 votes
You said page to *image*, but... if generating a PDF of the page would work for you then there are some add-ons that will convert ExpressionEngine pages to PDF:

---
Tags: channel-entries, image, uploads
---


title: Assets 2.1 Pixel&Tonic

text:
# Question
Title: Assets 2.1 Pixel&Tonic
****updated*** The issue was not having www in the url. Assets works fine if I use www.mysite.com/system.... but not if I use mysite.com/system... in the url. www is required in the url for Assets to work. Is this a htaccess issue or can u recommend a fix P&T please? Thanks\*****

Just installed Assets 2.1 to test it out on EE2.5.5 - ran the ee server wizard and have what I need installed. If I try and update indexes in Assets the red button just turns opaque and does nothing. I also get no thumbnails and the refresh button just kept spinning endlessly. I reinstalled and uploaded Assets 2.1 twice. Seems to conflict with another module perhaps. Cache is 777, synchronised images in file pref etc... Any ideas? Thanks

update index does nothing (don't know where assets\_test\[2\] is coming from? I have 2 images folders test and home...paths are correct) http://www.tiikoni.com/tis/view/?id=c1608dd folder and thumbs not displayed http://www.tiikoni.com/tis/view/?id=e7c53be

# Answer
I suspect that what was happening, based on your update, is that you were seeing JS cross-site security blocking, due the lack of 'www'. Your domains need to be consistent to avoid that problem - not just with P&T add-ons, at that. You should ensure that your installation always uses either www, or no www. Consistency there should help you avoid running into this.

-Lisa Wess Pixel & Tonic
> 1 votes

---
Tags: assets
---


title: selecting the last 2 rows of a matrix

text:
# Question
Title: selecting the last 2 rows of a matrix
I want to select the last 2 rows in a matrix field: You would expect that this could be easily achieved by using the following code.

```
{matrix}
    {if row_count >=  total_rows - 1}
        test
    {/if}
{/matrix}

```

However, this throws a syntax error:

> **Parse error**: syntax error, unexpected T\_STRING in **expressionengine/libraries/Functions.php(683) : eval()'d code** on line **168**

Using just "total\_rows" works perfectly fine, adding the the "-1" causes the error. ( EE v 2.5.5 )

# Answer
> 2 votes
TAking what Bhashkar Yadav suggested, you might now need to go with two matrix calls to achieve what yoku need.

```
{matrix orderby="row_id" sort="desc" limit="1" offset="1"}

{matrix_column}

{/matrix}

```

and

```
{matrix orderby="row_id" sort="desc" limit="1"}

{matrix_column}

{/matrix}

```

This should call the second last row first and then the last row. It's a little clunky, but I don't believe there is a better way to achieve what you need.

# Answer
> 2 votes
You could install MX Calculator and give something like this a go:

```
{matrix}
    {if row_count >= "{exp:mx_calc expression='{total_rows}-1'}"}
        test
    {/if}
{/matrix}

```

What does that return?

# Answer
> 0 votes
Try this:

```
{matrix orderby="row_id" sort="desc" limit="2"}

{matrix_column}

{/matrix}

```

# Answer
> 0 votes
How about something like this... Haven't tried this so don't know for sure it will work.

Basically, flip the matrix so you reverse the order then get the first 2 items.

```
{matrix_field sort="desc" limit="2"}
    stuff
{/matrix_field}

```

*EDIT I see someone already suggested doing this, maybe combine with what I suggest below?*

Or maybe you could make use the {next\_row} and {previous\_row} matrix tags

```
{matrix_field offset="{total_rows}"}
    {previous_row}Stuff here{/previous_row}
{/matrix_field}

```

Like I said, haven't tested this so it may well not work but hopefully it will give you some ideas.

---
Tags: matrix
---


title: Alternative Search

text:
# Question
Title: Alternative Search
We have two main channels: products and blog. When a user enters a search term, if we find results in the primary channel (as indicated by the search\_type cookie), we display the results and we're done. If we don't find results, then we need to let the user know we haven't found anything in products, but we did get n hits in blog.

I created a complex set of templates and embeds, with hidden search forms, and javascript that fired off the search form via ajax, then a second ajax call to gather the results. It was rickety but it worked. Sometimes. But not in Webkit. :(

So, I'm wondering about other ways of doing alternate searches. Any recommendations? (I should have sent out this question a long time ago.) Thanks for your help.

# Answer
> 2 votes
If you're willing to step away from the native Search module, you could do this with Low Search.

You'd create 2 collections: one for Products, one for Blog. In the search form, you then add a keywords field, and *don't* specify a collection to search through. Instead, you define the collection in the Results tag, so it only returns results for a single collection.

Then, inside the `no_results` conditional, you add an embed to the alternative search results. That embed should only contain another Results tag, but this time with a different `collection` parameter.

### Example code:

**Form tag**

```
{exp:low_search:form result_page="search"}
  <fieldset>
    <label for="keywords">Keywords</label>
    <input type="search" name="keywords" id="keywords" />
    <button type="submit">Search</button>
  </fieldset>
{/exp:low_search:form}

```

**Main search results**

```
{exp:low_search:results query="{segment_2}" collection="products" limit="10"}
  ...code for main search results...
  {if no_results}
    {embed="search/alternative"}
  {/if}
{/exp:low_search:results}

```

**Alternative search results `search/alternative`**

```
{exp:low_search:results query="{segment_2}" collection="blog" limit="10"}
  {if count == 1}
    No products found, but here are some blog posts!
  {/if}
  ...code for main alternative results...
  {if no_results}
    Nothing found whatsoever!
  {/if}
{/exp:low_search:results}

```

---
Tags: search
---


title: How to approach static content

text:
# Question
Title: How to approach static content
I've been struggling with static content and wanted some other opinions on how to best approach it.

Currently, I have a channel called Static Content where I, obviously, post all the "static" content for the site. In the past, I've created a template for each page. I'm trying to make my templates more DRY, so I'd like to avoid that if possible. Most of the sections/pages are similar, but there are slight differences, so I'd like to have a template group for each main section.

My original idea was to create a template group for each section and then use some embeds to determine some of the unique section content. Basically something along these lines:

**"about" template group index:**

```
{header} {!--snippet --}
    {embed="embed/.sidebar" current="about" show_ad="y"}
    {embed="embed/.static-content"}
{footer} {!--snippet--}

```

**.static-content embed:**

```
{exp:channel:entries channel="static_content" url_title="{last_segment}" limit="1" require_entry="yes" dynamic="no" disable="categories|category_fields|member_data|pagination"}
    {if no_results}{redirect="404"}{/if}
    <h1>{title}</h1>

    {exp:allow_eecode}
        {static_copy}
    {/exp:allow_eecode}
{/exp:channel:entries}

```

This works really well except for the obvious. I can technically go to http://mysite.com/products/history and pull up the content that should really only appear at http://mysite.com/about/history. How do people usually avoid this problem? Categories? Add-Ons? Pages module? Different channels for each section (I hope not)?

Any suggestions would be appreciated.

# Answer
It sounds to me like you need the Pages Module. Essentially you'll create a single template, more if you need to, and then each entry you create using a channel assigned to the pages module, in your case "static", can have a unique url. So you'll easily be able to assign domain.com/foo or domain.com/bar

I use pages regularly for this. IMO it's really great for a limited number of unique pages.

The alternative to this is using Structure which is a very popular commercial addon for EE that allows you to do this easily for all pages/entries on your site.
> 5 votes

# Answer
I tend to handle what you're describing with a separate channel for each major section - not that this is absolutely necessary mind you, but I do find it helps with the logic in template. When I combine it with stash add-on, it works wonders. Then, my template group index template has little other than the logic of what to show when that template is hit and passes the result of that logic into a wrapper template. It gives me a very high degree of control, while maintaining a very consistent experience for the site editor with everything being in channel entries accessible through the publish/edit screens. So for example, a "static" about section, as you describe would be handled like this, the way I've handled it:

```
1) Create a channel field group for static pages called "pages" (you could make this channel specific if you wish to allow for more separation of field approach between channels - sometimes I do, sometimes I don't)
2) Add custom fields to the field group, such as cf_pages_body (and any other fields you might need, such as seo fields, alt titles, etc)
3) Create a channel for static pages called "about" and assign it the pages field group and your default status group
4) Create a template group called "about"
5) Create a template group called "layouts"
6) In the layouts template group, create a wrapper template called ".inside" that contains all the wrapping html for the inside page - you can of course break that up further with snippets for a DRY approach to the template code itself
7) In the "about" group index template, you lay out your logic use stash:set to stash the results to parse into your ".inside" wrapper template
8) In the .inside wrapper template, you use stash:get to grab the stashed values associated with the accessed URL

```

So a very simplified version (stash has a lot of additional parameters you could use for performance, parsing priority, etc. that I'm not showing at all here) of the your logic template may be:

```
{embed="layouts/.inside"}
{exp:channel:entries channel="about" orderby="date" sort="desc" dynamic="yes" disable="whatever|you|can|disable" limit="1"}
{if no_results}{redirect="404"}{/if}
{exp:stash:set_list name="page_body"}
    {stash:entry_title}{title}{/stash:entry_title}
    {stash:entry_body}{cf_pages_body}{/stash:entry_body}
{/exp:stash:set_list}
{/exp:channel:entries}

```

In this example, I'm using stash:set\_list tag pair to stash each custom field in a "list" in which each stashed element receives a name that is then called upon in the wrapper template to "get" and parse in place. For a simple example, this will do. It allows you to be a bit more DRY this way since you can avoid putting any formatting markup in there and instead handle that in the wrapper template.

Then in the inside template, you would get that stashed entry content (again, simplified):

```
<html>
<head>
{exp:stash:get_list name="page_body"}
<title>{entry_title} | {site_name}</title>
</head>
<body>
    <h1>{entry_title}</h1>
    {entry_body}
</body>
{/exp:stash:get_list}
</html>

```

When static content pages like this are handled as entries, you may also find value in using an add-on for entry ordering with this approach as well so there is a simple way to choose the order of static page entries. It would make more sense than ordering based on date or a custom ordering field in the field group that you can't see in the edit list view. Low Reorder is a good choice for this.

Important to note - naming conventions become a lot more important the more DRY you try to get - something to consider in order to plan an approach like this.

Hoping I haven't overlooked something in the example - going from memory to keep the concept a bit simpler than my actual implementation, so I'll correct if an issue is caught that I've missed. Hopefully this helps.
> 2 votes

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


# Question
Title: Save templates to file suddenly stopped working?
I have a clients site which has been working fine for a year or so, I have been doing a few updates to it over the last few days, now suddenly 'Saving Templates to File' has broken. If I make any changes to the templates via the control panel or via my html editor and save it wipes the whole of the file. The only way I can make any changes is to do them via the control panel and make sure 'Save Template to File' is unchecked.

I have checked and the templates folder is set to 777, and the location of that folder hasn't changed.

Does anyone have any advice? or a solution? Thanks in advanced.

# Answer
thank you very much for your helpful answers. It turns out it was much more straight forward. I contacted the host and found out that the client's site had gone over it's space limit, so any template I was trying to change or create other than through the control panel wan't being written. Thanks again.
> 0 votes

---
Tags: templates
---


title: SSL on Direct Admin

text:
# Question
Title: SSL on Direct Admin
I have a regular Expression Engine install on an server that uses Direct Admin (DA)

* system -- codeignitter -- expressionengine
* logs
* pivate\_html
* public\_ftp
* public\_html -- .htaccesss -- index.php -- admin.php -- css -- js -- images -- uploads -- themes
* stats
* templates

I've installed a SSL certificate. When I force a template to SSL I get a "The requested URL was not found on this server" message. However when I move the index.php to my private\_html directory it finds the (SSL) template(s).

If all my site has to be secure I could have lived with that solution and would move the index.php to the private\_html folder. The problem however is that I only want part of my site being secure.

How can I arrange this? Or is this a typical DA or hosting provider issue?

# Answer
> 1 votes
Direct Admin isn't really relavent here. I use it but it's works the same as any other control panel or webserver where SSL is concerned.

Firstly I would change the domain in question in DA to have private\_html symlinked to public\_html. The setting is called

"Use a symbolic link from private\_html to public\_html - allows for same data in http and https"

You can find it in the settings for that domain.

This doesn't secure the entire domain, just makes SSL available.

Next you want to force SSL on pages that you want to secure. This can be done with .htaccess for example, although I've never had much luck with that due to the vast amounts of rewrite rules I use for my sites.

I use Force SSL, you will find it on Devot:EE. Works quite well, I just pop a tag in the pages I want SSL

---
Tags: ssl, secure
---


title: Exp:resso Store & PayPal Advanced

text:
# Question
Title: Exp:resso Store & PayPal Advanced
PayPal has several tiers of **on-site** services listed on their business page. One is "Advanced" and the other is Pro. Does Exp:resso Store play nice with Advanced as well as it does Pro?

# Answer
It does indeed. Paypal seems to re-name and re-define it's offerings a lot but at present it boils down to

* Website Payments Standard
* Website Payments Pro
* Paypal Express

Website Payments Standard seems to be deprecated as they introduce the new Express Checkout and as such support for this gateway has been removed from Store by standard.

Website Payments Pro and Paypal Express with both work fine out of the box though with support for both gateways built in.
> 1 votes

---
Tags: expresso-store, paypal
---


# Question
Title: Best Solution for redirects if you have to move templates / URL structure
If you have to change your url-structure (and therefore in ee-templates) from let's say «opinion/detail/url\_title» to «blog/article/url\_title» — What's the best solution (EE-functionality, htaccess-stuff or something else) to redirect a visitor to the new url so users clicking on old links get redirected to the corresponding entry-template with the new tempalte-group/template structure?

for example:

`domain.com/opinion/detail/My-Entry` get's automaticly redirected to `domain.com/blog/article/My-Entry`?

# Answer
If you've actually changed the template\_group/template structure in EE and you just want to catch old requests and ensure they go to the new location then I'd always look to keep it top-level with .htaccess for this.

First of all ensure that the mod\_rewrite module is enabled and the rewrite engine is enabled:

```
Options +FollowSymLinks
RewriteEngine on

```

Then using the RedirectMatch (for pattern matching rather than direct file matching) we create a permanent redirect (301) from the old URL schema to the new one:

```
RedirectMatch 301 /opinion/detail(.*) http://domain.com/blog/article/$1

```

Provided your new template structure in EE reflects the new schema that should work fine.
> 2 votes

# Answer
If you're not opposed to an add-on, I used Detour Pro on a site with many many URL reroutes and loved it. You can use wildcards with it to save time as well.
> 2 votes

---
Tags: redirects
---


# Question
Title: CartThrob Subscriptions Add-on - Is it a good fit?
I am just trying to check that the project I am looking into would be a good fit for CartThrob Pro with Subscriptions, here is a quick run through:

The client will be selling normal (physical) products through the main area of the site for which CartThrob Pro will do nicely, taking payments via SagePay Server.

However, there will also be a club section where customers can purchase packages of products on a recurring basis. For example they might have a package called ‘Starter’ consisting of 3 products (picked by the client not the customer) being sent out every month for £10 p/m. Another might be called ‘Advanced’ where they send out 8 products per month for £20 p/m.

Also the product category (maybe spicy or mild) within a package can be chosen from a list by the customer, so for the ‘Starter’ they can choose up to 3 product categories from a list of maybe 10 different ones.

What can the customer update regarding their subscriptions? For example would they be able to change to a different set of product categories for that subscription to be sent out the next month? Can they easily upgrade to a another subscription plan too?

The client would obviously need to be able to manage the packages of products in the same way as they manage the normal products.

Looking through the docs etc CartThrob Pro plus Subscriptions would fit this nicely.

Can anyone shed some light as to whether this can be achieved?

Thanks in advance!

# Answer
From what you describe I can't think of any reason why Cartthrob and CT Subscriptions wouldn't be a good fit in this scenario. Customers will be able to edit their subscription plans and you'll be able to create dynamic subscriptions if needed.

One thing to note though is that if you're setting up subscriptions then you'll need to go with a token based system. This basically sees you capture a token from the payment gateway which can be sent later on to make the charge even when the custom is not present. For this you'll need to ensure that your payment gateway supports a token system. SagePay does provide one but just double check that you're setup to use this system in your plan with them.
> 0 votes

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


# Question
Title: Is there any way to limit the number of entries a user can make?
I want to limit the number of entries a user can create. I've found a similar question here: Restrict number of entries per user

The reason that answer won't work for us is because our version of EE is 2.1.3 - before safecracker was integrated. We've tried updating it to the latest version, but after three weeks encountering error after error after error we've had to roll back before we miss a deadline which could make or break our business.

Is there anyway to do this without Safecracker?

# Answer
> 1 votes
You're always better off keeping EE up to date and you'll no doubt find that the time it takes to update EE will save you even more time than trying to get current addons and solutions to work with an outdated system (by quite a long time if you're going back to 2.1.3). You can always post any errors or problems here for help.

If you're really not looking to upgrade just yet however then from what you've said and the link you provided I take it that you mean limiting entries from the front-end (i.e. Safecracker). I've got an old version of Safecracker from back in the day before it was bundled with EE (Probably about the time of EE 2.1) which may work for you but obviously this comes without support and as I mentioned you may run into problems running outdated software either now or in the future so keep it in mind. If you do want to give this a try then let me know your email.

# Answer
> 0 votes
I'm not sure there is a way to do that currently if the entries are made via the control panel. If through SAEF or Safecracker, then yes, you can definitely limit the user's entries based on a simple conditional lookup of the number of entries made by the logged in user, with the conditional restricting, for example, the entry form itself to just those that are below your prescribed maximum number of entries. In the control panel - as GDMac indicated, you may need a custom extension to essentially perform that same lookup within the CP itself.

---
Tags: channel-entries
---


title: Odd EE Installation issue

text:
# Question
Title: Odd EE Installation issue
I'm installing ee1.6.8 on WAMP. I've done this many many times, I use it for testing before i attempt the real deal on the live servers. I've done this on all versions between 1.6.8 - 2.5.5 and they always always worked.

However this time, EE's installation refuses to install because it thinks it does not have the privileges to INSERT/DELETE etc... when in fact it absolutely does. I'm using the root/NO account which has ALL PRIVILEGES.

I've tried via localhost and 127.0.0.1 and it just keeps failing. This is on WAMP 2.2

Any ideas?

==== UPDATE ====

I just tried installing 1.6.9, 1.7.2 and 2.5.5 and both worked smoothly. So it appears that for whatever reason 1.6.X does NOT like wamp 2.2

# Answer
> 1 votes
I downloaded mysql addon for wamp with mysql 5.1.41 and told wamp to use it instead. Once that change was made ee168 and ee169 installed flawlessly. I guess it was a mysql compatibility issue.

---
Tags: ee1
---


title: Show categories in random order

text:
# Question
Title: Show categories in random order
I'm using categories as tags for news articles and showing a list of "tags" in the sidebar. I'd like the list of "tags" to be ordered randomly. Does anyone know how to accomplish this?

# Answer
> 3 votes
For showing categories you can use "GWCode Categories" plugin which is having "orderby" parameter with "random" value. Like:

```
{exp:gwcode_categories orderby="random"}
{category_name}
{/exp:gwcode_categories}

```

---
Tags: categories, tags
---


# Question
Title: sql subquery channel entry & matrix rows
I need to export channel entries with matrix data and having problems joining the entry id with my matrix subquery

This is the matrix subquery which adds up my rows:

```
SELECT exp_matrix_data.entry_id, sum(exp_matrix_data.col_id_13) as TotalPartyPoints, sum(exp_matrix_data.col_id_14) as RedeemablePoints
FROM exp_matrix_data WHERE  exp_matrix_data.entry_id = 60

```

These are the other fields:

```
SELECT
        exp_channel_data.entry_id as ID,
        exp_members.username as Email,
        exp_channel_data.field_id_27 as FirstName,
        exp_channel_data.field_id_28 as LastName,
        exp_channel_data.field_id_29 as Gender,
        exp_channel_data.field_id_31 as Address,
        exp_channel_data.field_id_32 as City,
        exp_channel_data.field_id_33 as State,
        exp_channel_data.field_id_34 as ZipCode,
        exp_channel_data.field_id_35 as CellPhone,
        exp_channel_data.field_id_36 as AltPhone,
        exp_channel_data.field_id_37 as SpouseName,
        FROM_UNIXTIME(exp_channel_titles.entry_date, '%m/%d/%Y') as InceptionDate,
        exp_channel_data.field_id_39 as Country,
        exp_channel_data.field_id_40 as GoldClub,
        exp_channel_data.field_id_43 as KAMA,
        exp_channel_titles.entry_id,
        exp_channel_titles.author_id,
        exp_channel_titles.channel_id
        FROM  exp_channel_data, exp_channel_titles, exp_members
        WHERE  exp_channel_data.entry_id = exp_channel_titles.entry_id
        AND exp_channel_titles.channel_id = 6
        AND exp_members.member_id = exp_channel_titles.author_id
        ORDER by LastName asc

```

Both selects return the desired results. How can I join my matrix query here as a subquery?

# Answer
> 1 votes
Try this query:

```
SELECT exp_channel_data.entry_id as ID,
SUM(exp_matrix_data.col_id_13) as TotalPartyPoints,
SUM(exp_matrix_data.col_id_14) as RedeemablePoints,
exp_members.username as Email,
exp_channel_data.field_id_27 as FirstName,
exp_channel_data.field_id_28 as LastName,
exp_channel_data.field_id_29 as Gender,
exp_channel_data.field_id_31 as Address,
exp_channel_data.field_id_32 as City,
exp_channel_data.field_id_33 as State,
exp_channel_data.field_id_34 as ZipCode,
exp_channel_data.field_id_35 as CellPhone,
exp_channel_data.field_id_36 as AltPhone,
exp_channel_data.field_id_37 as SpouseName,
FROM_UNIXTIME(exp_channel_titles.entry_date, '%m/%d/%Y') as InceptionDate,
exp_channel_data.field_id_39 as Country,
exp_channel_data.field_id_40 as GoldClub,
exp_channel_data.field_id_43 as KAMA,
exp_channel_titles.entry_id,
exp_channel_titles.author_id,
exp_channel_titles.channel_id
FROM exp_channel_titles
JOIN exp_channel_data ON exp_channel_data.entry_id=exp_channel_titles
JOIN exp_members ON exp_members.member_id=exp_channel_titles.author_id
JOIN exp_matrix_data ON exp_matrix_data.entry_id=exp_channel_titles.entry_id
WHERE exp_channel_titles.channel_id = 6 GROUP BY exp_matrix_data.entry_id ORDER by exp_channel_data.field_id_28 ASC

```

I hope, it would work for you.

---
Tags: matrix, query
---


# Question
Title: Using Store + Zoo Visitor to create a member and store order details in related entry
We have one checkout at the moment that requires a customer to sign up at the checkout (this creates a member record with ZV) and once signed up/in they can purchase their course which will then create an entry in our 'Students' channel. Simple.

What we need now is for someone to be able to handle 'manual' registrations and therefore need to be able to sign up and purchase in the same step on behalf of the student.

I am able to register a member with Store, however, because the member wasn't created prior to the order the entry is not created in our 'Students' channel. Has anyone had any experience with this? or any ideas that would help point us in the right direction.

Many thanks in advance!

# Answer
I made a flowchart to visualize the implementation

Basically it comes down to these steps:

1. Add product to cart (Store)
2. Cart overview - proceed to checkout (Store)
3. New vs. returning customer / Login - Registration form (Visitor)
4. Final checkout, here you will pass the visitor member data into hidden store checkout fields
5. Done :)
> 4 votes

---
Tags: expresso-store, zoo-visitor
---


# Question
Title: Editing custom fields for multiple entries at once
Is there any way to edit the same custom field for multiple entries at once?

Something like an entry equivalent of the field editor add-on.

I know Zenbu has title/url editing available, just wondered if it was possible with custom fields?

# Answer
> 1 votes
OK, not ideal, but as all my data was coming in from an XML feed, I created another CVS file with a column of unique fields (matching unique fields in my entries) and added the text that I wanted into another column.

I then imported all this via Datagrab add-on.

Worked fine.

# Answer
> 0 votes
I've not seen one for the control panel, but it can certainly be done via Safecracker using a template visible only to logged in members of the appropriate member group. Depending on the nature of the field(s) being edited and how many are being edited at once though, you can quickly run into some performance limitations.

---
Tags: custom-fields
---


# Question
Title: Simple Matrix order question... I think!
I'm sure this is an easy one to answer.

I have a matrix field which I am using together with CE Image to create a gallery. It contains two columns and a variable number of rows depending on how many images it contains.

Like so:

```
{gallery limit="1"}

    {exp:ce_img:pair src="{image_url}" crop="yes|smart_scale" width="420" height="315" allow_scale_larger="yes" filter="sharpen" limit="1" quality='60' add_dims="no"}

    <img src="{made}" alt="{title}"/>

        {/exp:ce_img:pair}

{/_gallery}

```

But I want the image to be the one that is "1" in the Image Order Number (image\_order) column.

# Answer
Well that was simple! just added the `orderby="image_order"` parameter to the matrix tag pair.

I had tried that originally, but it was using the already cached images. Once they were deleted out, it regenerated the right ones.

:)
> 3 votes

---
Tags: matrix, ce-image, image-galleries, orderby
---


# Question
Title: Exp-resso Store not registering Shipping Country
I've just added a new country to my client's webshop (Belgium), and I've added a rule to their Shipping method which checks for this country, and then sets a shipping-rate. Belgium shows up in the dropdown on our checkout-process now, but when I select it, and go to the next step (order confirmation before payment) it'll show our other country (The Netherlands) instead... so apparently selection isn't coming through, even though the dropdown renders fine and the value is set properly... Any thoughts on this?

Thanks!

# Answer
Gah, nevermind, fieldnames weren't set properly. Sorry!
> 1 votes

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


title: Problems Limiting within an Embed

text:
# Question
Title: Problems Limiting within an Embed
We seem to be having some problems limiting within an embed.

2 Channels: Daily-Deals (approx 50 listings), Business-Listing (approx 10,000 listings).

Each daily deal is related to a single business on field: "deal-owner".

Each business is categorized in a "zone" (category URL corresponds to the template group URL). ie: business is categorized to the zone "Rapid City" (category URL is "rapid-city")

The template structure is as follows: www.website.com/rapid-city/restaurants

**Step 1** \- Identify all the daily deals that have content in the field "monday-deal". Pass these business ids to the embed. (*Identifies 26 records*)

```
{exp:channel:entries channel="daily-deals" search:monday-deal="not IS_EMPTY"}
{embed="rapid-city/deal-embed" deals="{deal-owner status="Super Enhanced|Enhanced|Basic"}{entry_id}{/deal-owner}"}
{/exp:channel:entries}

```

**Step 2** \- In this embed, take the passed ids and filter to identify only those businesses that have the matching category as the segment\_1 category id (in this case when viewing the rapid-city/restaurants template, it would only show the deals from the businesses that are categorized as "Rapid City") (*filters down to 21 records*)

**Step 3** \- Then display the deal information (from daily-deal) and the business title, city and state (from business listing).

```
{exp:channel:entries entry_id="{embed:deals}" channel="business-listing" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic"}
{exp:playa:parents channel="daily-deals"}{monday-deal}{/exp:playa:parents} - {title} - {city},{state-short}<br>
{/exp:channel:entries}

```

Using this code, in step 1, it correctly identifies the 26 records that have "monday-deal" content.

In Step 2 it filters the 26 records and returns only the 21 that have a matching category selection (business category URL matches rapid-city from segment\_1)

In step 3, it correctly displays the monday-deal for each of the 21 businesses and the business title, city and state.

**BUT, we want to limit the output display within the template to 6 entries!**

IF we put limit="6" in the outer template (or use other conditional strategies), it only passes 6 ids (of the possible 26) to the embed. Thus when the embed processes the records, it may be removing some of the 5 that should not be there - resulting in the display of a random number of entries from 1-6.

```
{exp:channel:entries channel="daily-deals" search:monday-deal="not IS_EMPTY" limit="6"}
{embed="rapid-city/deal-embed" deals="{deal-owner status="Super Enhanced|Enhanced|Basic"}{entry_id}{/deal-owner}"}
{/exp:channel:entries}

```

IF we put limit="6" within the code of the embed - **it does nothing** (all 21 records are displayed!)

```
{exp:channel:entries entry_id="{embed:deals}" channel="business-listing" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic" limit="6"}
{exp:playa:parents channel="daily-deals"}{monday-deal}{/exp:playa:parents} - {title} - {city},{state-short}<br>
{/exp:channel:entries}

```

HOW can we use this process to identify all the records that meet the criteria - and always display only 6 records of the 21 possible?

# Answer
Using a count conditional should do the trick if I'm understanding the issue.

21 records will still be returned but only 6 will "show". This is not ideal because your tag is doing more work than it needs to do. Also, there might be performance issues if tons of entry\_ids are passed to {embed:deals}.

```
{exp:channel:entries entry_id="{embed:deals}" channel="business-listing" category="{segment_1_category_id}" status="Super Enhanced|Enhanced|Basic" limit="6"}
{if count < 7}
        {exp:playa:parents channel="daily-deals"}{monday-deal}{/exp:playa:parents} - {title} - {city},{state-short}<br>
{/if}
{/exp:channel:entries}

```
> 1 votes

# Answer
The limit in the embed is of no use, since for every entry\_id found in the template it will embed the other template.

to pass all entry id's at once to the embed

```
{embed="test/embed_test" all="{exp:channel:entries channel='test_channel' backspace='1'}{entry_id}|{/exp:channel:entries}"}
// {embed:all} contains 12|22|44

```
> 0 votes

---
Tags: channel-entries, playa, embeds, low-seg2cat
---


title: "row_id" on Playa field not working

text:
# Question
Title: "row_id" on Playa field not working
I'm trying to get the current "row\_id" of a Playa entry, but it doesn't seem to want to output.

I'm prefixing it because there was another plugin that was conflicting with the {count} and {total\_results} variables.

So my code looks like this:

```
{cf_course_content var_prefix="q" limit="1" offset="{course_progress_id}"}
     {q:count}
     {q:total_results}
     {q:row_id}
     {q:cf_question_type}
{/cf_course_content}

```

But when this is rendered, it looks like this:

```
1
15
{row_id}
Drag & Drop

```

Why would it output like that? When all the other prefixed variables are working. I've pulled this outside of any other plugins / modules just incase anything was clashing and it still does this.

I've also been doing a bit of digging, and i'm not sure if "row\_id" is what I need to output anyway.

I'm trying to get the "Row Position" inside the Playa field. But I believe the "row\_id" is a unique reference from the DB? Not Unique to that particular entry.

Is there any way to output this, or get around the "row\_id" problem?

# Answer
> 0 votes
`{row_id}` is a Matrix tag. Playa doesn’t know anything about it. To get the current entry’s position within the Playa field, just use `{count}` (or `{q:count}` since you’ve got that var\_prefix param.

---
Tags: playa, pixelandtonic
---


# Question
Title: $this->db->last_query() not picking up the right query
I've got a Active Record query which i need to grab the sql from, so i'm doing the query and then i'm doing for example

```
$query = $this->EE->db->select('foo')->get('bar');
$bob = $this->EE->db->last_query();

```

Now, on my local machine it picks it up fine. But, on the live site it's picking up a query of the exp\_sites table and basically just returns the contents of the exp\_sites table for this site (it's not msm so there is only one row). That's not the query i want, so how is it getting picked up there?!?!

Anyone know why this might be? Caching? A full moon?

# Answer
Put this above your query.

```
$this->EE->db->save_queries = TRUE;

```

`EE_Config.php` sets the `save_queries` value dynamically based on debug/profiler settings, ignoring settings in `database.php`. This is why it worked fine in your local environment.
> 12 votes

# Answer
This will do it:

```
$this->EE->db->save_queries = TRUE;
$query = $this->EE->db->select('foo')->get('bar');
$bob = end($this->EE->db->queries);
$this->EE->db->save_queries = FALSE;

```
> 4 votes

# Answer
As far as I know, last\_query() just doesn't work in EE... it never has (or at least when I've tried to use it)

easiest way to do it (which is what I do) is

```
$query = $this->EE->db->select('foo')->get('bar');
$bob = $query->result_array();

```

Someone infinitely more intelligent than I will probably be able to tell you why it doesn't work, but suffice to say - I gave up trying to figure it out.
> -1 votes

---
Tags: sql
---


title: Notify Mailing list of new entry?

text:
# Question
Title: Notify Mailing list of new entry?
Is it possible to notify a mailing list when a new entry is submitted?

I know if is fairly easy to notify a member group when a entry is submitted, but I need to notify a mailing list everytime an entry is submitted.

# Answer
> 1 votes
http://devot-ee.com/add-ons/mx-notify-control is the answer.

i found this version: http://www.eec.ms/forums/viewthread/573/

# Answer
> 1 votes
With Postmaster you can send emails for anything, so it's possible.

---
Tags: members, email, notification
---


# Question
Title: Synchronize Templates Show No file exists
(EE 2.5.5) All of a sudden making changes to the template files stopped getting inhaled into the app. The changes are on the server, but they're not showing up on the rendered pages. I'm guessing that EE is no longer using the files, but rather the databased versions of the templates. This is borne out when I go to the Synchronize Templates page in the Control Panel: all the templates have "No file exists".

Is there some configuration setting that got mangled along the way? Any other magickal invocations to aid this along?

Update: "Design \> Templates \> Global Preferences \> Basepath to Template File Directory" is set to our production server, though it should be set to our staging server path. When we try to update it, it says it accepts the change, but going back to the page shows it's still set to prod.

Any help appreciated.

# Answer
> 2 votes
Try by setting this config value within config file (/system/expressionengine/config/config.php)

```
$config['tmpl_file_basepath'] = 'template/basepath';

```

Also check if "Basepath to Template File Directory" is already set within config file.

---
Tags: templates, deployment
---


# Question
Title: PHP error on template export, after upgrading to 2.6
Getting the following when I try to export any template group...

```
A PHP Error was encountered

Severity: Notice

Message: Undefined property: Design::$api

Filename: cp/design.php

Line Number: 3516

Fatal error: Call to a member function instantiate() on a non-object in (mypath)/system/expressionengine/controllers/cp/design.php on line 3516

```

I have disabled *all* third-party add-ons, as well as tried a clean install followed by a database import, and the problem persists. Any thoughts?

# Answer
> 1 votes
This seems to be a known bug related to disabling custom fields in your channel entries tag pair. Give this solution a try and see if it resolves the problem. It should be fixed up in the next release.

# Answer
> 0 votes
A fix has been posted now to the bug 19331. Just a few lines to replace. Just tested it and it's working fine.

---
Tags: templates, php, error, upgrade, export
---


# Question
Title: Inline images automatically link to larger version? Possible?
Does anyone know a plugin/add-on or method to have images inserted inline (not custom field) into content by user automatically link to a larger version?

I have Channel Images installed and was surprised it had no means to do that. In their forum Dev Demon says doing so would be difficult, but it seems fairly simple to have an option to add an href to the image inserted and a dropdown to pick which processed version to link to—as a manual action or automatic (preferred).

We can’t even link manually to the CI images variations as they are stored in folders and the ee file manager can’t see them.

So, anyone done this? Or am I just missing something in general? Seems a pretty common use case to have the user insert an image and easily link to a larger version (plugin or native method).

Thanks for your input.

# Answer
In short, no i have not seen anything that does what you are looking for.

I understand your need - wanting to choose the thumbnail pre-processed file, and auto link it to the large pro-processed file - but i know of not automated addon that does this.

Typically yes, as you say i use a custom field, and then create it within the template. Often i do not use EE's pre-processed images but something like CE\_IMAGE which processes and caches the various size images at template output. Hence very easily to set large and small.

I tend to agree that it would be tricky to modify a WYSIWYG editor field to do this. Not impossible, but would require deep connections to EE. I can only think you go manualy, upload thumb, upload large, and manually link in WYSIWYG editor.

N
> 1 votes

# Answer
I'm not sure I understand your question completely, but are you using a WYSIWYG editor? Wygwam and Channel Images are integrated. So, conceivably, your user could insert the image desired via the Channel Images button, and then manually create a link to that same image. You could then use CE\_Image's bulk tag to wrap around the Wygwam field so that the inline image is sized down to whatever thumb dimensions you prefer.

This seems a bit convoluted though, there may be ways to streamline it by playing around with multiple file upload folders or tying into CE\_Image's hooks?
> 0 votes

---
Tags: channel-images, image-path, inline-editing
---


# Question
Title: Remove Duplicate Values in List from Channel Entries
I am creating a dropdown menu for a mailing list sign up form for an events company. I would like to give people the option to select a city where the company has had an event in the past or where there will be an upcoming event. To do this, I'm calling all of the event entries and displaying their cities in the dropdown. However, sometimes the company has had events multiple times in one city. How can I remove the duplicates? I have found some answers to questions similar to this where the solution uses php, however I'm having trouble getting that to work in my specific instance. Here is my code for the select dropdown menu:

```
<select id="MERGE1" name="MERGE1">
    <!--innitial display field is blank-->
         <option value="" selected></option>
    <!--values show in dropdown--->
         {exp:channel:entries  channel="events" status="next event|open|closed" show_future_entries="yes" show_expired="yes"}
         <option value="{event_city}">{event_city}</option>
         {/exp:channel:entries}
</select>

```

---

\**edit

using an expression engine query solved the innitial problem. however, now i'd like to show cities that appear in 2 different fields and two different channel ID's. Here's what I'm working with so far, which is stripping out the duplicated within the channel ID's but still showing duplicates across multiple channel ID's:

```
<select id="MERGE1" name="MERGE1">
    <option value="" selected></option>
    {exp:query sql="SELECT exp_channel_data.field_id_1 AS event_city, exp_channel_data.field_id_202 AS event_city2 FROM exp_channel_data
          INNER JOIN exp_channel_titles ON exp_channel_data.entry_id=exp_channel_titles.entry_id
          WHERE ( exp_channel_titles.channel_id=1 OR exp_channel_titles.channel_id=29 ) AND (exp_channel_titles.status='next event' OR exp_channel_titles.status='open' OR exp_channel_titles.status='closed') GROUP BY exp_channel_data.field_id_1, exp_channel_data.field_id_202"}
            {if event_city != ''}
               <option value="{event_city}">{event_city}</option>
            {if:else}
               <option value="{event_city2}">{event_city2}</option>
            {/if}
     {/exp:query}
 </select>

```

# Answer
> 2 votes
You can do it with the query module. Try it:

```
<select id="MERGE1" name="MERGE1">
    <option value="" selected></option>
    {exp:query sql="SELECT exp_channel_data.field_id_1 AS event_city, exp_channel_data.field_id_202 AS event_city2 FROM exp_channel_data
        INNER JOIN exp_channel_titles ON exp_channel_data.entry_id=exp_channel_titles.entry_id
        WHERE ( exp_channel_titles.channel_id=1 OR exp_channel_titles.channel_id=29 ) AND (exp_channel_titles.status='next event' OR exp_channel_titles.status='open' OR exp_channel_titles.status='closed') GROUP BY exp_channel_data.field_id_1, exp_channel_data.field_id_202"}
    <option value="{event_city}">{event_city}</option>
    {/exp:query}
</select>

```

In "field\_id\_1", the "1" might be replaced with the field id of Event City and put correct channel\_id within WHERE condition.

I can see, you are passing parameters: show\_future\_entries="yes" and show\_expired="yes" in channel entry tag. It wouldn't be needed in SQL.

# Answer
> 0 votes
You could also use Stash and something like the following. You'd set variables in the first part and then output them when making the select options, using the unique="yes" parameter to filter out duplicates.

```
{exp:stash:set_list name="st_city_list" parse_tags="yes"}

    {exp:channel:entries  channel="events" status="next event|open|closed" show_future_entries="yes" show_expired="yes"}
        {stash:st_event_city}{event_city}{/stash:st_event_city}
    {/exp:channel:entries}

{/exp:stash:set_list}

<select id="MERGE1" name="MERGE1">

    <!--innitial display field is blank-->
         <option value="" selected></option>

    <!--values show in dropdown--->
         {exp:stash:get_list name="st_city_list" unique="yes"}
            <option value="{st_event_city}">{st_event_city}</option>
         {/exp:stash:get_list}

</select>

```

---
Tags: channel-entries, drop-down
---


title: Pixel & Tonic Field Pack v2.0

text:
# Question
Title: Pixel & Tonic Field Pack v2.0
I upgraded one of my EE sites tonight to EE 2.6 and also went to upgrade to the new Field Pack v2.0 but I am receiving a series of errors like so:

A PHP Error was encountered Severity: Notice Message: Use of undefined constant PT\_FIELD\_PACK\_VER - assumed 'PT\_FIELD\_PACK\_VER' Filename: api/Api\_channel\_fields.php Line Number: 117

I receive one for each of the fields. Any thoughts?

Thanks, John

# Answer
I ran into this problem as well - To solve it I:

* Installed each of the new "Field Pack" plugins (which uninstalls the old versions automatically).
* Once they were all uninstalled the problem resolved itself.
* To keep the third party folder nice and tidy I then deleted the old PT\_ files from the plugin directory (but you want the new pt\_field\_pack folder still!).

Hope that helps,

Tom
> 2 votes

# Answer
John,

Did you remove the old field pack and any dive bar files you had in the filesystem? I think those remaining there may be the cause of this error. Of course please make backups first!

Let me know if that fixes this up for you, please. Thank you!

-Lisa, P&T
> 0 votes

---
Tags: pixelandtonic, field-pack
---


# Question
Title: Next/Previous Entry Linking + Structure showing entry from different channel
I have entry linking working in multiple templates on my current EE site. In one of my channels, when I get to the end of the loop, it's displaying a next link to an entry in a different channel. It is the next sequencial entry ID though. There isn't a previous link when i'm at the first entry in the loop. The entry that is displaying in the in correct channel shares the same parent page.

**Here's my structure hierarchy**

```
About Us
 - Leadership
   - has listing entries that have next/previous entry linking. Last entry has entry_id 106

 - Galleries
   - Video Galleries
     - Page 1 Child page with entry_id 107
     - Page 2

```

**Next/Previous entry linking logic**

```
<p class="next_prev_nav">
    {exp:channel:prev_entry channel="leadership"}
            <a href="/about-us/senior-leadership/{url_title}" title="{title}">Previous</a>
    {/exp:channel:prev_entry}

    {exp:channel:next_entry channel="leadership}
            <a href="/about-us/senior-leadership/{url_title}" title="{title}">Next</a>
    {/exp:channel:next_entry}
</p>

```

I tried to just do a quick hack and add entry\_id="not 107" on the next\_entry tag but that broke the next link for all listing pages. Entry ID 107 has it's own channel for videos, so it's not a rogue entry. Any one know how to fix this?

# Answer
> 1 votes
The fix: a quote was missing:

**Bad**

{exp:channel:next\_entry channel="leadership} Next {/exp:channel:next\_entry}

**Good**

{exp:channel:next\_entry channel="leadership"} Next {/exp:channel:next\_entry}

---
Tags: channel-entries, structure, navigation, entryid
---


# Question
Title: NSM Addon Updater not working with P&T modules
Congratulations to P&T on all the changes lately, brilliant work!

I've used noticed after the P&T website was changed and all the modules updates are handled by http://devot-ee.com/ the NSM Addon Updater they used to support is not working, I can only assume they need to change the config file in the module.

Is it still possible to use NSM add-on updater with P&T add-ons?

# Answer
devot:ee doesn’t support NSM Addon Updater. I’ve suggested it to Ryan, and we’ve left the URLs in our latest round of updates, so if they ever add it, we can add some 301 redirects on pixelandtonic.com.

Something tells me it won't ever happen though. Most people have moved on to devot:ee Monitor at this point, for good reason.
> 1 votes

# Answer
It might only be updated through the devot-ee Monitor add-on now.
> 0 votes

---
Tags: pixelandtonic
---


title: Need help with a conditional statement

text:
# Question
Title: Need help with a conditional statement
I am trying to control what is displayed in a table view based on a conditional.

Here is the code I am trying to use:

```
<tr class="odd">
    <td>Small</td>
    <td>1000x600</td>
    <td>$25</td>
</tr>
<tr class="even">
    <td>Medium</td>
    <td>2000 x 1300</td>
    <td>$50</td>
</tr>
{if max_dimensions != '1536 x 2048' OR max_dimensions != '2048 x 1536' }
<tr class="odd">
    <td>Large</td>
    <td>3000 x 2003</td>
    <td>$75</td>
</tr>
{/if}

```

In this case if the max\_dimensions of a photograph is **not** '1536 x 2048' or '2048 x 1536' I want the third row of data to be displayed.

I limited it to just one conditional as follows and it worked. However when I add the OR, it fails.

```
{if max_dimensions != '1536 x 2048' }
<tr class="odd">
    <td>Large</td>
    <td>3000 x 2003</td>
    <td>$75</td>
</tr>
{/if}

```

That basic objective is, if the picture is not big enough, I don't want the third row to be displayed. What is the correct way to word this?

Thanks.

# Answer
You can't really use an OR conditional when both are "not equal to" because both conditions can be satisfied at the same time (as in your example, when the entry in question matches both conditions at the same time). You can easily use OR when you are asked for equal to, but not equal to is a different animal. On the surface it seems like OR is what you're looking for, but really what it seems you're looking for is this:

```
{if max_dimensions != "option A" OR "option B"}
    display third row only if max dimensions are anything other than options A or B
{/if}

```

But that's not how such a conditional is written - but that's the structure of the logic you are going for. But to write that, you use:

```
{if max_dimensions != "option A" AND max_dimensions != "option B"}
    display third row only if max dimensions are anything other than options A or B
{/if}

```

By using AND you are saying you want the third row to display whenever options A and B are not the value. By using OR, you're saying you want the third row if option A is not the value or option B is not the value - two conditions rather than one, which buggers up the logic a bit.

Make sense?
> 1 votes

# Answer
Can you try it:

```
{if "{max_dimensions}" != "1536 x 2048" OR "{max_dimensions}" != "2048 x 1536"}
<tr class="odd">
    <td>Large</td>
    <td>3000 x 2003</td>
    <td>$75</td>
</tr>
{/if}

```

If it didn't work, you can try another quick way:

```
    {if "{max_dimensions}" != "1536 x 2048"}
    <tr class="odd">
        <td>Large</td>
        <td>3000 x 2003</td>
        <td>$75</td>
    </tr>
    {if:elseif "{max_dimensions}" != "2048 x 1536"}
    <tr class="odd">
        <td>Large</td>
        <td>3000 x 2003</td>
        <td>$75</td>
    </tr>
{if:else} {/if}

```
> 0 votes

---
Tags: conditionals
---


# Question
Title: Problem with playa inside url segment conditional
Having an issue placing playa inside a URL segment conditional. Inside the conditional, playa doesn't return entries, though if I substitute the playa call with simple text, the conditional works. And strangely, if I have a blank {if:else} statement, the playa entries will show.

Any ideas?

**Doesn't work:**

```
{exp:channel:entries channel="my-channel" limit="1"}
   {if segment_3 == "{entry_id}" }

        {exp:playa:children field="my-channel-field"}
            <li><a href="#">{title} - {other-field}</a></li>
        {/exp:playa:children}

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

```

**Works:**

```
{if segment_3 == "{entry_id}" }
  Nice id!
 {if:else}
  Sorry, underage!
{/if}

```

**Also works:**

```
   {if segment_3 == "{entry_id}" }
        {exp:playa:children field="my-channel-field"}
            <li><a href="#">{title} - {other-field}</a></li>
        {/exp:playa:children}
    {if:else}
   {/if}

```

# Answer
The difference may be due to the parsing order. The 1st block in your example is a simple conditional, vs the advanced conditional in the 3rd block. So the time the conditional is parsed is later with the advanced. What if you try adding parse="inward" to your first example:

```
{exp:channel:entries channel="my-channel" limit="1" parse="inward"}

```
> 1 votes

---
Tags: playa, conditionals
---


# Question
Title: How to stop new members created by admins using Profile:Edit from going into the Pending group
I'm using Profile:Edit to create new member accounts on the front-end. I've got my member preferences set to 'Manual activation by an administrator.'

When creating a new member account (by a Super Admin, or a 'client admin' member account that has permissions to create new members), I'm finding that new member accounts are still going into the Pending queue.

Is there a way to make accounts created by an admin go into the proper member group that I've specified? This is adding an extra step to the process of creating new members. I'd rather not change the activation preference to 'No activation required' as we do still want to approve new member accounts that are created on the front end of the site by guests; but I would have thought/hoped that EE or Profile:Edit would smart enough (unless I'm doing something wrong) to realise that if an admin is creating the new member account, it doesn't need to go into the Pending group. Any advice or workarounds would be appreciated, thanks.

Here's the simplified code from my new member registration form for Profile:Edit:

```
{exp:profile:register include_jquery="no" datepicker="no" return="/extranet" dynamic_screen_name="[cf_profile_first_name] [cf_profile_last_name]" group_id="10"}

  <p><label>First name <em>*</em></label></p>
  <p><input class="required" name="cf_profile_first_name" placeholder="First Name" type="text" value="{cf_profile_first_name}" /></p>

  <p><label>Last name <em>*</em></label></p>
  <p><input class="required" name="cf_profile_last_name" placeholder="Last Name" type="text" value="{cf_profile_last_name}" /></p>

  <p><label>Email <em>*</em></label></p>
  <p><input class="required" name="email" placeholder="Email" type="text" value="{email}" /></p>

  <p><label>Password <em>*</em></label></p>
  <p><input class="required" name="password" placeholder="Password" type="password" value="" />

<input type="submit" value="Create new login »" />

{/exp:profile:register}

```

# Answer
From looking at your code, you aren't telling Profile:Edit what member group to place the new user, so it's using the default. Based on the Profile:Edit documentation your code should include an admin visible ONLY: member group drop down menu.

```
{if logged_in}
    {exp:profile:register}

        {exp:profile:member_group_select member_groups="5|6|7"}

    {/exp:profile:register}
{/if}

```

So based on your form data, you'd need to modify, something like this…

```
{exp:profile:register include_jquery="no" datepicker="no" return="/extranet" dynamic_screen_name="[cf_profile_first_name] [cf_profile_last_name]" group_id="10"}

  <p><label>First name <em>*</em></label></p>
  <p><input class="required" name="cf_profile_first_name" placeholder="First Name" type="text" value="{cf_profile_first_name}" /></p>

  <p><label>Last name <em>*</em></label></p>
  <p><input class="required" name="cf_profile_last_name" placeholder="Last Name" type="text" value="{cf_profile_last_name}" /></p>

  <p><label>Email <em>*</em></label></p>
  <p><input class="required" name="email" placeholder="Email" type="text" value="{email}" /></p>

  <p><label>Password <em>*</em></label></p>
  <p><input class="required" name="password" placeholder="Password" type="password" value="" />

{if logged_in}

        {exp:profile:member_group_select member_groups="5|6|7"}

{/if}

<input type="submit" value="Create new login »" />

{/exp:profile:register}

```

Obviously, specify your member groups, instead of the default, but that should do the placement.
> 1 votes

# Answer
As Jessica noted, "Require Member Account Activation?" is an EE config setting (available in the CP Member module) that Profile:Edit is simply echoing in its own settings. Unless you change this setting to "No Activation Required" then the new registered user will go into Pending group if you are registering them with a Profile:Edit register tag.

To get around it, you'd need to hook into P:E or the Member module and make some changes.
> 1 votes

---
Tags: members, profile-edit
---


title: Change author using Safecracker

text:
# Question
Title: Change author using Safecracker
I'm looking at a way to change the author of a channel entry through a Safecracker form, in same style as used in the CP with a drop down select.

From what I can see it needs some sort of query, I've tried all sorts with variables member\_id and author\_id within tag pairs, without any results writing back to db.

Anyone done this?

# Answer
I also had this issue. It'd be nice if this functionality was available via a native tag or a third party plugin, but in the meantime, I used the following code with the Query module:

```
{exp:query sql="SELECT member_id, screen_name, group_id FROM exp_members ORDER BY group_id DESC, screen_name ASC;"}
  <option value="{member_id}" {if "{member_id}" == "{author_id}"}selected="selected"{/if}>{screen_name}</option>
{/exp:query}

```

The above code worked fine for me in EE 2.5.5. If you get T\_STRING errors (which I got in certain situations for certain members in EE 2.5.0 when using the above), then try changing the conditional that picks the current author from:

```
{if "{member_id}" == "{author_id}"}selected="selected"{/if}

```

to:

```
{if {member_id} == {author_id}}selected="selected"{/if}

```
> 1 votes

---
Tags: safecracker
---


# Question
Title: safecracker login form not accepting login details
I am fairly new to Safecracker, so forgive me if my question is stupid. On the following \[site Click\]\[1\] Here when you click on the promo materials button, a pop up window appears requiring users to login with a username and password.

I have noticed the login form is not recognising my username and password. I am currently trying to login using my super admin. is there anything i need to select in the control panel. Also looking at the code i have submitted is this the correct set up?

below is a snippet of my code

```
{exp:member:login_form}

 {if logged_in}
<a href="{path="press-creative/pressKit/{segment_3}"}">Presskit</a>
   {/if}

<div class="tencol margin-bottom">
    <ul class="plain inset">
        <li>
        <label for="name">Username</label>
        <input type="text" name="username" value="" onclick="this.value = ''" id="email">
        </li>
        <li>
        <label for="password">Password</label>
        <input type="password" value="password" onclick="this.value = ''" type="password">
        </li>

{if auto_login}
      <p><input type="checkbox" name="auto_login" value="1"> Auto-login</p>
 {/if}

        <li>
        <button type="submit" style="margin-top: 10px;">Submit</button>
        </li>

</div>
    </ul>

     <p><a href="{path='member/forgot_password'}">Forgot your password?</a></p>

</div>

    {/exp:member:login_form}

```

# Answer
> 1 votes
You need to put name="password" into your form. I think that should work then.

---
Tags: templates, safecracker, members, authenticate
---


title: Playa Entries and Unique Identifiers

text:
# Question
Title: Playa Entries and Unique Identifiers
I'm displaying a list of Packages and within those Packages are Products. The Packages channel entry has a Playa field populated by Product channel entries. So to display them I have something like this:

```
{packages} {!-- Playa field --}

{exp:playa:children field="packages_products"} {!-- Playa entries --}
{product 1}
{product 2}
{/exp:playa:children}

{/packages)

```

I have detailed descriptions for the Products that are hidden until clicked on and they expand, using Bootstrap's Collapse plugin. And the issue I'm running into is that I need each Product to have some sort of unique identifier because each Package can have one or more of the same Products.

So looking at the example below you can see that Product 2 is in both Packages. Using Bootstrap's Collapse if you click on Product 2 in Package 1 the details will expand, BUT clicking on Product 2 in Package 2 only expands Product 2 in Package 1. Essentially I need to add some sort of unique identifier to every Product that's repeated across Packages in order for Collapse to work correctly.

```
{packages} {!-- Package 1 --}
{exp:playa:children field="packages_products"} {!-- Playa entries for Package 1 --}
{product 1}
{product 2}
{/exp:playa:children}
{/packages)

{packages} {!-- Package 2 --}
{exp:playa:children field="packages_products"} {!-- Playa entries for Package 2 --}
{product 5}
{product 2}
{/exp:playa:children}
{/package)

```

Theoretically I'd be able to grab the entry\_id of the Package channel entry that the Product Playa entry is in, so something like this:

```
{packages} {!-- Package 1 --}
{exp:playa:children field="packages_products"} {!-- Playa entries for Package 1 --}
{product 1}
{product 2-1}
{/exp:playa:children}
{/packages)

{packages} {!-- Package 2 --}
{exp:playa:children field="packages_products"} {!-- Playa entries for Package 2 --}
{product 5}
{product 2-2}
{/exp:playa:children}
{/package)

```

But I've tried for the last few hours and haven't figured it out. Any thoughts?

**UPDATED** More specific code from my template:

```
{films_packages_products}
{exp:playa:children field="packages_products"}
<h3>{packages_name}</h3>
<ul>
<li>
{products_summary}
{!-- need a unique id for the Collapse js to target next line --}
<a data-toggle="collapse" data-target="#{unique id}_{url_title}">More Info</a>
{!-- need a unique id for the Collapse js to target next line that matches the above --}
<div id="{unique id}_{url_title}" class="collapse">
{products_features}
<li>{feature_bullet}</li>
{/products_features}
</li>
</ul>
{/exp:playa:children}
{/films_packages_products}

```

# Answer
If your `{exp:playa:children}` tag pair is within an `{exp:channel:entries}` tag pair, you can use the `var_prefix` parameter on the `{exp:playa:children}` to tell Playa to only parse certain variables with that prefix:

```
[removed code - updated answer]

```

## Update

Sounds like your nesting playa fields, so use two `{exp:playa:children}` tags with `var_prefix`'s so playa knows which fields to parse for each channel.

```
{exp:playa:children channel="films" field="films_packages_products" var_prefix="films"}
    {exp:playa:children channel="packages" field="packages_products" var_prefix="packages"}
    <h3>{packages:title}</h3>
        <ul>
            <li>
            {packages:products_summary}
            {!-- need a unique id for the Collapse js to target next line --}
            <a data-toggle="collapse" data-target="#row_{films:entry_id}-{packages:entry_id}">More Info</a>
            {!-- need a unique id for the Collapse js to target next line that matches the above --}
            <div id="row_{films:entry_id}-{packages:entry_id}" class="collapse">
                <ul>
                {packages:products_features}
                <li>{packages:feature_bullet}</li>
                {/packages:products_features}
                </ul>
            </div>
        </ul>
    {/exp:playa:children}
{/exp:playa:children}

```
> 1 votes

---
Tags: templates, playa
---


title: Cartthrob Price modifier in view cart

text:
# Question
Title: Cartthrob Price modifier in view cart
I am trying to wrangle an events management system using Carthrob. The system will have to manage different events so in order to streamline the process as much as possible I have created a product channel called events with two price modifier fields called 'booking\_options' and 'registration\_details'.

Booking options allow the user to select the correct type of booking for the event (ie. day pass, full board etc) which they can do on the product details page.

'Registration\_details' is set to request the relevant booking information for each event attendee (ie. name, email etc)

I have multiple items showing separately in the cart and want to add the registration\_details price modifier to the cart but I can't seem to output the two modifiers separately so that the booking options show as a select dropdown and the registration details appear as text inputs for each item.

I have read through all the documentation but I am still stuck!

# Answer
> 1 votes
I have solved the issue by adding individual item option fields in the cart that allows the user to fill in their registration details. I am going to use playa to allow the person setting up the event to select the registration fields they require.

---
Tags: cartthrob
---


# Question
Title: Dynamic path for cachedir when placing system folder above web root
I've got a query about setting the cachedir path in system/config/database.php when placing the system folder above web root.

When the system folder isn't above web root, I'd normally set the path like this:

```
$db['expressionengine']['cachedir'] = "${_SERVER['DOCUMENT_ROOT']}/my_system/expressionengine/cache/db_cache/";

```

But when the system folder is placed above web root, what dynamic path should I be using instead? Thanks.

Edit: In fact, does anyone know the purpose of this cachedir? I've checked a few sites and I've got nothing stored at this folder location anyway.

# Answer
I've found a solution for this in the Webunder EE2 config template repository:

```
$db['expressionengine']['cachedir'] = APPPATH."cache/db_cache/";

```
> 2 votes

---
Tags: config, system
---


# Question
Title: Track one-time GA event for new user registrations
On the face of it this seemed like it would be something simple to implement, and a common requirement given how important a metric it is, however after a lot of searching and work around ideas this seems to not be the case (I would like to avoid writing a custom plugin for something so basic).

Can anyone offer suggestions on how to do this simply (no hopping through meta redirects) and keep it strict? Or maybe there is a plugin I have missed? The registration system in question is using zoo\_visitor and does not require email authentication.

Thank you.

# Answer
Based on the comments from madebyhippo's suggestion, use the free Session add-on (http://devot-ee.com/add-ons/session-variables-plugin).

So in your generic site header template (throughout the site), have a conditional similar to:

```
{if logged_out}{exp:session_variables:set name="registration" value="no"}{/if}

```

Then on the page that get's shown on successful registration check this on a conditional and will prevent refresh issues.

```
{if logged_in}
  {if "{exp:session_variables:get name="registration"}" == "no"}
    {exp:session_variables:set name="registration" value="yes"}
    {!-- ADD YOUR GA CODE HERE --}
  {/if}
{/if}

```

Depending on your server session reset it may be possible to re-trigger if they try that "successful registration" page at a later date, but that's going to be on extreme cases.

You could even go to the further extreme of auto-submitting a user account edit form on the success page to save a custom user field and use that instead of the session variable.
> 1 votes

# Answer
An Obvious thought would be to put a Google click track on the registration button? Since users can only register once, this would do the job wouldn't it?

Why do you need to track registrations via Google? Surely a count of the active members would do the same thing?
> 0 votes

---
Tags: zoo-visitor, registration, analytics, signup
---


# Question
Title: how to dynamically insert image into dynamic text
Ok, let say I have a channel entry that is dynamically being displayed on a page, and I also want to have an image displayed in that text as well, with the text nicely flowing around the image. So far I've been able to put an image at the top by putting the image inside the P tag, and I can float it to get the text to wrap around it, but that only puts the image at the beginning or the end of the text, depending on where I place the image tag in relation to the EE tag that pulls in the channel content.

I would really like to have a few paragraphs of text, and then an image floated nicely to the side with the text flowing around it, and then have more text after that. How would I do that?

To be clear, I know this can be done with a WYSIWYG editor, or by having the content administrator enter an image tag in the midst of the paragraph when they're actually writing the channel entry, but that's not what I'm looking for. I have a file upload channel field that allows an image to be uploaded for that channel entry, and then the template dynamically pulls that image in if they uploaded one.

The only way I can think of to do it would be to have multiple channel fields, and one field would be the portion of text before the image, and the other would be the portion of text after the image, but that feels like an ugly work-around to me. I would think this would be something pretty standard, I just don't know how to do it.

# Answer
> 8 votes
You can use jQuery with **.insertBefore()** or **.insertAfter()** to accomplish this.

If you want to insert the image after the first paragraph, use something like:

```
<div class="article">
    {article}
</div>

$('{custom_image_field}').insertAfter('.article p:first-child');

```

If you want it elsewhere, just adjust your selector (ie: '.article p:first-child').

# Answer
> 2 votes
I accomplish this all the time with a Matrix field and NSM Transplant. Basically, you upload your images row-by-row in a Matrix field, then insert tokens (like `{image_1}`, `{image_2}`, etc) into your content area where you want the images to appear. NSM Transplant then replaces these with your images when rendered on the front-end.

This tutorial video should give you an idea of how to do this. (Some of the add-ons it uses are outdated now, like ED ImageResizer, but you can substitute similar current add-ons with ease.)

# Answer
> 2 votes
In addition to the options already listed, Hop Studios has created an "Inject" addon to do exactly what is being asked (just float the inserted element):

http://devot-ee.com/add-ons/hop-inject

# Answer
> 0 votes
I've done what you're looking for before with Matrix. One field, with, for example, a column for image, image caption/description and "body paragraph". Basically you just instruct the admin to create a new row each time a new image is being inserted into the body flow. The main complicating factors are that you really should clear floats after each row when rendered on the front end - which doesn't always look pixel-perfect but does prevent your floated images from banging into each other. I have a couple of clients for whom this was the preferred approach. In my case I added a couple other columns that related to the image position (such as left vs right, for example). Perhaps not quite as elegant a solution as you were looking for, but it's less ugly than a bunch of separate custom fields and allows you the same separation of markup from content that you're aiming for.

# Answer
> 0 votes
You could whip up a plugin to process the content tag's output and swap the image with a custom "tag" you've embedded in your content. It's basically a find & replace. Something like:

```
{exp:swapimage img='/path/to/img.jpg'}{content_field}{/exp:swapimage}

```

In your content you could have:

```
<p>Some text...</p><swapimage/><p>Some more text...</p>

```

Check out the `article` method in this plugin I've been working on this week. It has some replace functions that will show you how to do the swap in a plugin:

https://github.com/Clearbold/ee-toc

# Answer
> 0 votes
For simple setups, you can also go vanilla and make it very simple for the end user. Basically, create x image/file fields and divide you body into x textarea/Wysiwyg fields.

* Image 1
* Body 1
* Image 2
* Body 3
* Image 3
* Body 3

Only the first image and body field would be mandatory and shown by default. The other would be collapsed. Then, the end user can upload up to three images and place them exactely where she/he wants by splitting the content of the article into the three body fields.

You could then add custom fields for floating each image left or right, crop it a certain way, etc.

Simple approach, not much margin for error on the client side. Easy to move back into a single field if needed down the road.

# Answer
> 0 votes
We've recently released a plugin we had made for this on a project. It's available for free at Devot:ee. Check out String Divide, it might help you.

http://devot-ee.com/add-ons/string-divide

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


# Question
Title: Safecracker - author_only="yes" - can't view entry when logged out or logged in as another user
So I've setup a safecracker form, all works great to submit an article and the editing page also works if you're logged in as the author. However if you're logged out you get the following message:

```
The form you submitted contained the following errors
You are not the author of this entry.

```

This is fine for the edit page and works as it should do, however when trying to simply view the article it still displays this message, any ideas why?

```
{if freebie_3 == ""}

  {embed="site/_header" page_name="{segment_1}"}

  <div class="primary-col">

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

    <h1>{title}</h1>

    <div class="bio">
      {company_bio}
    </p>

    <div class="work-samples">
    {company_samples}
      <article><img src="{image:url}" alt="{image:title}" /></article>
    {/company_samples}

  {/exp:channel:entries}

  </div>

{if:else}

  {embed="site/_header" page_name="edit"}

  <h1>Your Profile</h1>

  <div class="primary-col">

    {if logged_out}  You aren't a member or aren't logged in.<br /> <a href="{path='member/login'}">Login</a>  | <a href="{path='member/register'}">Register</a>  {/if}

    {exp:safecracker channel="profile" author_only="yes" return="companies/URL_TITLE" url_title="{segment_2}" error_handling="inline" include_jquery="no" rte_selector=".rte"}
      {edit-form}
    {/exp:safecracker}

  </div>

{/if}

{embed="site/_footer"}

```

I'm using Freebie to detect if segment\_3 is empty, if it is then the article is displayed, but if segment\_3 is edit then you'll get the edit form. I've tried swapping the ifs around so that if freebie\_3 == "edit" but it does exactly the same thing.

# Answer
> 3 votes
Because your freebie conditional uses an {if:else} statement, it is considered an *advanced* conditional. Advanced conditionals are rendered after module/plugin tags are rendered (see: Rendering Stages). The safecracker tag in the else condition is getting parsed and executed before the condition is evaluated. The solution is to split it into two simple conditionals (example below) or to use the IfElse plugin.

```
{if freebie_3 == ""}
...
{/if}
{if freebie_3}
...
{/if}

```

---
Tags: safecracker, users, freebie
---


# Question
Title: Categories not appearing in playa:children
One of the main templates on my site, the product page, has a single products channel entry, and up to 3 playa children (also products). I'm trying to get the categories for playa children. Here's my test code:

```
{exp:channel:entries channel="products" limit="1" status="open|wide|feature|glory"}
    <h1>Main Product: {title}</h1>
    {exp:playa:children field="also_like" status="open|wide"}
        <h1><a href="{title_permalink='site/product'}">{title}</a></h1>
        <div class="age">Age: {categories show_group="5" limit="1" note="age range"}{category_name}{/categories}</div>
        <div class="environ">Env: {categories show_group="6" limit="1" note="environment"}{category_name}{/categories}</div>
    {/exp:playa:children}
{/exp:channel:entries}

```

Another page manages to display the categories, but it's directly from the channel:entries tag, rather than going through the playa:children.

Any help appreciated.

# Answer
NotoriousWebmaster -

Playa disables categories by default. You'll need to add disable= to over-ride the parameter.

```
{exp:playa:children field="also_like" status="open|wide" disable="members"}

```

or similar.

Let me know if that helps!
> 4 votes

---
Tags: playa, categories
---


# Question
Title: Can I add together the values of the cells in each Matrix row?
The Matrix docs say:

> :average, :lowest, :highest, and :sum
>
> These tags return the average, lowest, highest, or sum value of a given numeric column in your Matrix field.

I have a matrix field that is all about hours spent on different activities and different weeks. I not only want to get the sum of each column (the weeks) but also the sum of each row (the activities) and if possible get the sum of every cell in the whole table. Is that possible or do with just Matrix or do I need to install something like the Simple Math Add-on?

so instead of {matrix\_field:sum col='week1'} is there something like {matrix\_field:sum row\_id="1"}

# Answer
You could do this using Matrix and the Math add-on \- but not in Matrix without any other add-ons/PHP. I hope that helps!
> 1 votes

# Answer
If you are ok with php on output, how about

```
<?php
$my_row_sum = {matrix_field:sum col='week1'} + {matrix_field:sum col='week2'} + etc...;
?>

```
> 0 votes

---
Tags: matrix, math
---


title: Retrieving/setting cookie in index.php

text:
# Question
Title: Retrieving/setting cookie in index.php
I'm attempting to retrieve a cookie in index.php to record the value in a global\_variable. I'd like to do it this way to avoid including PHP/plugin code on every template. Currently I have;

```
$assign_to_config['global_vars']['user_location'] = $this->EE->input->cookie('user_location');

```

However this throws the error;

> Fatal error: Using $this when not in object context in /xx/xxx/xxx/index.php on line 28

Am I allowed to do this sort of thing?

# Answer
This will not work as object isn't being initialized. You can use PHP $\_COOKIE to get it.

```
$assign_to_config['global_vars']['user_location'] = $_COOKIE['user_location'];

```
> 1 votes

---
Tags: global-variables
---


title: Caching Nested Stash List

text:
# Question
Title: Caching Nested Stash List
I have a list and nested stash list loading and displaying ok until I try to cache. Once cached they both display fine on first load, but upon reload the nested list disappears.

I'm not clear on how to cache and reload a nested list, could someone please provide an example or modify the code below?

Thanks!

**Not Working (Caching)**

```
{!-- Stash list of homes and communities (in nested list) they belong to. Communities are stored in a playa relation within a matrix field. --}
  {exp:stash:set_list
    name="home_results_{segment_2}"
    parse_tags="yes"
    parse_depth="2"
    parse_conditionals="yes"
    save="yes"
    refresh="1"
    scope="site"
    replace="no"
  }
    {exp:channel:entries
      channel="homes"
      dynamic="no"
      category="1"
      disable="member_data|pagination"
    }
    {stash:entry_id}{entry_id}{/stash:entry_id}
    {stash:entry_title}{title}{/stash:entry_title}
    {!-- Nested stuff. Stash the communties that this house is in.  --}
     {exp:stash:set_list:nested
        name="related_entries_{entry_id}"
        parse_tags="yes"
        save="yes"
        refresh="1"
        scope="site"
        replace="no"
      }
        {elevations} {!-- Matrix field --}
          {stash:incommunity}
              {elevation_community}{title} - {city_province}{/elevation_community} {!-- Playa field --}
        {/stash:incommunity}
        {/elevations}
      {/exp:stash:set_list:nested}
    {/exp:channel:entries}
  {/exp:stash:set_list}
{!-- End of Home results stash. --}

{!-- Load the nested stash list with communities into content --}
{exp:stash:append name="content"}
    {exp:stash:get_list name="home_results_{segment_2}"}
      <div>
        <strong>{entry_title}</strong><br>
        {!-- Stash get the list of communities the home is built in --}
          {exp:stash:get_list:nested unique="yes" prefix="nested" name="related_entries_{entry_id}"}
           - {incommunity}<br>
         {/exp:stash:get_list:nested}
      </div>
    {/exp:stash:get_list}
{/exp:stash:append}

```

# Answer
> 1 votes
You would need to use the same scope `scope="site"` when getting the lists as when setting, unless you have set the `stash_default_scope` configuration value to 'site'.

---
Tags: matrix, playa, stash
---


title: Profile:edit, no redirection

text:
# Question
Title: Profile:edit, no redirection
The {exp:profile:login return="profile/edit"} doesn't work as expected : the page doesn't redirect on submit. The template\_group/template exist, I can access this page via the template manager and it renders correctly. I'm using "structure", the profile channel isn't managed by the module.

The EE login form works.

Well, I'm … lost :(

Any idea ? Please ?

# Answer
> 3 votes
I’m using 2.5.5 and 1.09 and I’m also experiencing this problem with the return parameter.

When I check the rendered form markup I can see this in the HiddenFields `div`:

```
<input type="hidden" name="RET" value="http://domain.com/templategroup/template">

```

Whereas that value is just the path to the template where I’m using the `profile:edit:login` tag.

and below that:

```
<input type="hidden" name="return" value="group/template">

```

Wherein the value is exactly the content entered in my `return=` parameter in the `profile:edit:login` tag.

For anyone else experiencing this problem, here’s a hacky fix:

If you drop in a duplicate of the `RET` hidden input right before the close your `profile:edit:login` tag, the page will use that instead of the broken p:e generated one.

```
<input type="hidden" name="RET" value="{path="group/template"}">

```

---
Tags: structure, profile-edit
---


# Question
Title: Search parameter to check if Assets field is (not) empty
Is it possible to check if an Assets field is empty, using the search:fieldname attribute? I cannot use the if-method within the loop, because I'm using pagination.

Thanks, in advance! Diederik.

# Answer
Yes you can. I just tested with this code:

```
{exp:channel:entries search:pt_assets="not IS_EMPTY"}
<h1>{title}</h1>
{/exp:channel:entries}

<hr />
{exp:channel:entries}
<h1>{title}</h1>
{/exp:channel:entries}

```

and definitely got only entries back that had Assets in the first set of entries; and all entries in the second.

I hope that helps!
> 3 votes

---
Tags: assets, channel, filter
---


# Question
Title: Issues with date output with DropDate add-on
I'm using Stephen Lewis' now unsupported DropDate add-on to simplify selecting dates in the Control Panel. (Chiefly because I'm trying to use a fieldtype that allows me to disable selecting times. I want my Control Panel users to just pick a date. If there are other options to do this that I haven't seen, I'm open to them.) I'm using EE 2.5.5.

I first noticed that the dates were outputting one day behind when just choosing a date. So if I selected & saved May 1 2013 in the entry, the output from the tag would be April 30 2013. (I'm also using Title Master to put the date into the entry's title using the DropDate fieldtype tag, and the same thing was happening there.)

I assumed that this was because the date saved was UTC and my server is 5 hours or more behind. I could, however, find no way to compensate for that.

After poking around on Devot:ee and in the readme files with the add-on, I found the git repository and the recommendation to use the re-written Dev branch.

I've given this a try, and can report that in my local, Mac/MAMP Pro environment things look right. Why they look right, I don't know. In my template I have:

```
{wedding-date-date format="l, F d, Y"}

```

And it just works. I should point out that, for another project, my php.ini file has:

```
date.timezone = "America/New_York"

```

in it.

The same tag is storing the correct value in Title Master. (When I configured Title Master to include `{wedding-date-date format="F d, Y" timezone="Greenwich"}`, it didn't have any impact or output the date differently.

**On my server, however**, I'm continually seeing this error when Title Master updates the entry title:

```
An invalid timezone parameter was passed to DropDate.

```

That's the tag output there, being bundled into the entry title.

I've updated `/etc/php5/apache2/php.ini` on my server (Ubuntu) to have:

```
date.timezone = "America/New_York"

```

in it and reloaded/restarted Apache. I'm still seeing the same thing, including in template output. The output of the tag is simply:

```
An invalid timezone parameter was passed to DropDate.

```

Whether or not I include the parameter.

Has anyone run into this and gotten it working? I really need two things to work here:

1. Admins able to just choose a date in the entry.
2. Title Master to be able to insert that date field's formatted value into the entry title.

**Update** I've downgraded MAMP Pro from PHP 5.4.4 to 5.3.14, using the default template which has `date.timezone = MAMP_timezone_MAMP` & things worked fine locally. Going down to 5.2.17, less than the server's 5.2.4, broke things locally. Think I might see the issue...

# Answer
> 1 votes
Built a new server for the client and deployed there, with a newer version of PHP. Error has gone away.

---
Tags: add-on, date, dropdate, title-master
---