# Question
Title: What is the best way to modify entry data when submitting and updating entries
I am looking to modify a counter which is a field in a channel when i submit or update an entry. I am looking to count the number of matrix rows and then add that into the input field to act as the counter.

What is the best way for me to do this?

What hook should i use?

And what files should i create?

Thanks

# Answer
First - you can get this count in your template by using `{my_matrix_field:total_rows}` \- but I'll assume you need the number stored as a value in a field for other purposes (use in `orderby` perhaps).

In which case - yes, you'd write an extension, and use the entry\_submission\_ready hook.

Then in your method, pass `$data` by reference, so you can modify it. Check to make sure you're in the channel you're looking for, then dump the `$data` array so you can see how the data is structured. From there you can figure out how to count your Matrix rows, and then set the value of `$data['field_id_XX']` (which would be your "counter" field).

```
function entry_submission_ready($meta, &$data, $autosave)
{
    if($meta['channel_id'] == XX)
    {
        // This is just to let you examine the data - you'd remove it after
        print_r($data);
        exit();
    }
}

```
> 2 votes

---
Tags: matrix, hook, update
---


# Question
Title: Show currently displayed results and total results in pagination
I have the following channel entry tag:

```
{exp:channel:entries channel="designs" orderby="title" sort="asc" limit="8" paginate="bottom" dynamic="no"}

{!--output--}

{paginate}
    <div class="pagination clearfix">
        <ul>
            <li class="pagination-button">
            {if previous_page}<a href="{auto_path}">{/if}
            <i class="icon-angle-left"></i>
            {if previous_page}</a>{/if}
            </li>
            <li><p>{current_page} of {total_pages}</p></li>
            <li class="pagination-button">
            {if next_page}<a href="{auto_path}">{/if}
            <i class="icon-angle-right"></i>
            {if next_page}</a>{/if}
            </li>
        </ul>
    </div>
{/paginate}

{/exp:channel:entries}

```

Now that pagination displays the current and total pages, but instead I want it to show the current entries range and total entries, like this:

`1 - 8 of 26 results` for page one

`9 - 16 of 26 results` for page two

and so on.

I assembled this string:

`{count} to {absolute_count} of {absolute_results} results`

but I obviously can't just put it in the entry tag as it would parse for each entry. Moreover, {count} references the currently displayed items (ie. {count} will always be 1-8). I would have to do some sort of calculation to find the first count of the page. I assume an addon like Math would be suitable.

So to get the correct last count (ie. 8, 16, 24 etc.) the string should only be parsed on the final entry for a given page. What sort of condition could I use to ensure it only parses for the last entry?

# Answer
I'm not a big proponent of PHP in templates, but this is a case where it might be your best option. (You could roll this code into a simple plugin as well, which accepted the three required variables at the top as parameters.)

Enable PHP on output, and add this code:

```
{paginate}
    $per_page = 8;
    $current_page = '{current_page}';
    $total_entries = '{absolute_results}';

    $end = $per_page * $current_page;
    $start = ($end - $per_page) + 1;
    $end = ($end > $total_entries) ? $total_entries : $end;

    echo $start.' - '.$end.' of '.$total_entries;
{/paginate}

```
> 1 votes

---
Tags: channel-entries, pagination, count
---


# Question
Title: migrating content from EE1 to EE2 with Structure and Datagrab
I've been working on a horrible EE1 installation and bring it into EE2. Unfortunately it was one of those sites that decided to use Gypsy, oh and Structure and just to make things interesting, MX Uni Editor's file field.

The upgrade went relatively smoothly actually, although Gypsy was used throughout there were only a handful of channels so was able to just have 1 field group in the EE2 site and share it amongst channels.

The Structure upgrade went smoothly also.

Where we fell down was the assignment of images and attachments to entries.

# Answer
We created an XML feed of all channels (we couldn't automatically export because http://devot-ee.com/add-ons/weblog-entries-exporter doesn't support Gypsy).

We then used Datagrab to import the XML feeds respectively. Datagrab did a great job of mapping the Matrix rows of MX Uni Editor file fields to Assets 2 fields on 'news' and 'press release'. However, when we did the same thing for the 'page' channel that Structure uses as a general page type, it would blow out the Structure settings.

The simple way around this for us was to temporarily change the 'page' channel to an asset type in the Structure settings, run the import, confirm the images/attachments were properly assigned and then revert that channel back to being a page.

It took a few attempts before we realised the import was screwing the parent Structure entries.
> 1 votes

---
Tags: structure, file-uploads, ee1, ee2-upgrades, datagrab
---


# Question
Title: Can upload image with Assets, but image does not "stick" to entry
I can upload an image to my Asset field(s) and publish the entry. However, here are the weird issues I'm experiencing:

1. The Asset field is blank when re-editing the published entry, (but...)
2. The original, uploaded image is available in the template
3. Trying to publish the entry where the Asset field appears blank throws a "Field is required" error as if the field contains no data

Ideas?

* Assets — 2.1.4
* ExpressionEngine — 2.5.5

# Answer
Pixel and Tonic graciously made a ticket out of this request and cleared this issue up. (Thanks, guys!)

Here's what Andris had to say:

> You have set your upload folder paths to be relative, however when you access the CP from the address admin.php, those paths turn out to be incorrect.
>
> For them to work correctly, you must access the CP using the system folder in path - for example - http://domain.com/system/index.php?D=cp&C=content\_publish&M=entry\_form&channel\_id=1&entry\_id=1
>
> In Assets file manager everything was loading fine, because everything there is loaded via Ajax and Ajax requests are routed via front-end due to EE's design. Assets compensates for those requests, if they are made this way.

I was accessing the control panel from `domain.com/admin.php` with relative upload paths and I needed to access the control panel from `domain.com/system/` for those paths to work.

Hope that helps anyone else with this issue!
> 0 votes

---
Tags: assets, database
---


# Question
Title: Display Total_Stock of each item in the cart
I often have customers try to add a greater amount of inventory than what is available. So, if there is 2 left in stock, they might try to add 10.

I'd like to control this by displaying "amount available" in the cart page, so they can see what's left.

As far as I can tell, {total\_stock} is not available to the {items} {/items} loop in the Checkout Tag.

Whats the best way to go about this? Or, better yet, is there error handling for updating quantities?

Thanks. Lisa

# Answer
There's total\_stock variable:

```
{if total_stock} In Stock {if:else} Out of Stock {/if}

```

But that doesn't work if you have modifiers. Then there's an odd approach to using style classes: https://exp-resso.com/docs/store/product\_tag.html#dynamic\_product\_variables:

```
store_product_stock
store_product_in_stock
store_product_out_of_stock

```

But that only works for single or no modifiers.

Alternatively, drop me an email on peter@peteralewis.com and I'll send you a beta version of my store\_options plugin which can output everything relevant to the modifiers (single or multiple), options, in stock/out of stock and their stock levels.
> 1 votes

---
Tags: expresso-store
---


title: Displaying Matrix entries by category

text:
# Question
Title: Displaying Matrix entries by category
I'm using Matrix to list my clients services. I've added a 'Promoted Service' category to allow them to filter the services which get shown on the home page.

How can I set each Matrix row with an option to choose that category?

I thought this plug-in was perfect but it actually adds the category to the whole entry as well as the individual row which defeats my initial purpose as it then just shows every category on the home page.

http://devot-ee.com/add-ons/matrix-cat-col

Is there an easier way to do this?

# Answer
The first solution that comes to my mind is using something like MX Select Plus to retrieve the categories using a sql query and associate one with a matrix row. You'll then be able to search the matrix fields for the category you want, as long as you make the field searchable. Hope this helps.
> 1 votes

---
Tags: matrix, pixelandtonic
---


# Question
Title: How can I default to target="_blank" for Wygwam links
I would like to have target="\_blank" selected as the default for new links in any Wygwam field. I've tried a variety of things using the CKEditor config file, but I haven't been able to get this working properly.

Anyone out there done this with any success?

Thanks.

# Answer
> 1 votes
Here's a bit of jQuery that adds `target="_blank"` to all external link (links to another domain):

```
$(document).ready(function() {
  $("a[@href^=http]").each(
    function(){
      if(this.href.indexOf(location.hostname) == -1) {
        $(this).attr('target', '_blank');
      }
    }
  )
});

```

Would that solve your problem?

# Answer
> 0 votes
Not quite the solution you're after but if you were to wrap each instance where you output the content of the Wygwam field with a specific class in your templates. You could then add some javascript to target any links within it and force them to open in a new window.

---
Tags: wygwam
---


title: Showing parent relationships to events

text:
# Question
Title: Showing parent relationships to events
I'm facing another challenge with Solspace Calendar and relationships. I have the usual Events channel and a separate Organisations channel. Entries in the Events channel have a multiple relationships field that allows the event to be related to organisation(s).

As an example, a recurring 'Book Club Meeting' event might be associated with the 'Book Club' entry in the Organisations channel.

Each organisation has its own page on the website and I want to show a list of any upcoming events that are associated to that organisation.

I have tried the below but it shows all events and not just those that are related to the entry I'm looking at. This code doesn't look right to me but I'm not sure what else to try.

```
{exp:channel:entries channel="organisations" require_entry="yes"}
{parents field="event_organisations" channel="calendar_events" limit="5"}{if parents:count == '1'}<!-- Start Upcoming -->
<section id="upcoming" class="events">
  <div class="hd">
    <h2 class="heading"><a href="/events">Upcoming Meetings & Events</a></h2>
  </div>
  <div class="bd">
    <!-- Start Entry Listing -->
    <ul class="entries">{/if}
      {exp:calendar:events date_range_start="today" show_months="1" pad_short_weeks="n" event_limit="5"}<li class="entry event">
        <h3 class="name"><a href="{path='events/event'}/{if edited_occurrence}{event_parent_id}{if:else}{event_id}{/if}/{event_start_date format="%Y/%m/%d"}">{event_title}</a></h3>
        {if event_all_day}
        <time class="eventdate" datetime="{event_start_date format="%Y-%m-%d"}">{event_start_date format="%j<sup>%S</sup> %F %Y"}</time>
        {if:else}
        <time class="eventdate" datetime="{event_start_date format="%Y-%m-%dT%H:%iZ"}">{event_start_date format="%j<sup>%S</sup> %F %Y <i>at</i> %g:%i%a"}</time>
        {/if}
      </li>{/exp:calendar:events}
    {if parents:count == parents:total_results}</ul>
    <!-- End Entry Listing -->
  </div>
  <div class="ft">
    <a href="/events">See full diary of events</a>
  </div>
</section>
<!-- End Upcoming -->{/if}{/parents}
{/exp:channel:entries}

```

How can I extract information about events and occurrences based on parent relationships?

# Answer
> 1 votes
Have you tried adding event\_name="{parents:url\_title}" to the exp:calendar:events tag?

# Answer
> 1 votes
I appear to have found a solution to my own problem. I'm not sure if this is the most efficient method, but it certainly seems to work.

I'm calling an embedded template within the `channel:entries` loop on my Organisation page. Using a `parents` tag pair, I'm passing the `entry_id` of each related entry. I've had to include some conditional logic to separate multiple IDs with a pipe character.

```
{embed="organisations/.org-related-events"
test_entry_id="{parents field="event_organisations"
channel="calendar_events" dynamic="off"}
{if parents:count == parents:total_results}{parents:entry_id}{if:else}{parents:entry_id}|{/if}
{/parents}"}

```

In my embedded template, I'm using `exp:calendar:cal` to pull out the details of each occurrence. The `event_id` is pulling through the ID(s) from the embed.

```
{if embed:test_entry_id ==''}
{if:else}
    <!-- Start Entry Listing -->
    <ul class="entries">
      {exp:calendar:cal event_id="{embed:test_entry_id}" date_range_start="today" show_months="2" pad_short_weeks="n" event_limit="5"}
      <li class="entry event">
        <h3 class="name"><a href="{path='events/event'}/{if edited_occurrence}{event_parent_id}{if:else}{event_id}{/if}/{event_start_date format="%Y/%m/%d"}">{event_title}</a></h3>
        {if event_all_day}
        <time class="eventdate" datetime="{event_start_date format="%Y-%m-%d"}">{event_start_date format="%j<sup>%S</sup> %F %Y"}</time>
        {if:else}
        <time class="eventdate" datetime="{event_start_date format="%Y-%m-%dT%H:%iZ"}">{event_start_date format="%j<sup>%S</sup> %F %Y <i>at</i> %g:%i%a"}</time>
        {/if}
        <p class="description">{event_summary}</p>
        <p class="more"><a href="{path='events/event'}/{if edited_occurrence}{event_parent_id}{if:else}{event_id}{/if}/{event_start_date format="%Y/%m/%d"}">See event details</a></p>
      </li>{/exp:calendar:cal}
    </ul>
    <!-- End Entry Listing -->
{/if}

```

Now, on my Organisations page, it's showing a list of upcoming occurrences from any and all related events, in chronological order, within the limits I've set.

# Answer
> 0 votes
It may not make a difference, but doesn't the parents tag pair also require a channel parameter?

---
Tags: relationships, solspace-calendar
---


title: Safecracker File Field in Matrix

text:
# Question
Title: Safecracker File Field in Matrix
I have created a Safecracker form that uses CKEditor to allow users to update the content of a page. Within this page, I have a slider which displays one Matrix row at a time - an image in one column and a text field in a second.

As I'm trying to keep the form as visually consistent with the actual page as possible, I'd like to be able to separate the Matrix into two individual fields for editing. I've been able to accomplish this with two text fields, but can't seem to figure out how to make it work with the Safecracker file field.

```
<ul class="slides">
  {orgs}
    <li>
      <div class="span6" style="background-image:url({image}); height:335px;">
    <div class="chng">
          {field:orgs[row_id_{row_id}][col_id_61]}
    </div>
  </div>

  <div class="span6">
    <div class="padding-left" contenteditable="true" id="orgs[row_id_{row_id}][col_id_62]">
      {description}
    </div>
  </div>
    </li>
  {/orgs}
</ul>

```

Here is the code I currently have. The {orgs} tag loops through the matrix. I would expect that the {field:orgs....} would make the Safecracker file upload field appear, but alas it does not.

I'm hoping this is a relatively easy fix and I'm just not looking for an answer in the right places. :)

# Answer
Try this guide:

http://bluefishdesignstudio.com/blog/article/breaking-up-a-matrix-field-for-use-in-a-safecracker-form

Basically you'll need to do two things:

1. Manually create your inputs and name them appropriately (something like `your_file_field_name[row_new_0][col_id_61]` and `description[row_new_0][col_id_62]`)
2. Write your own JavaScript logic to add and remove matrix rows and increment the numbers on your input names.
> 1 votes

---
Tags: matrix, safecracker, fieldtype, safecracker-file
---


# Question
Title: CartThrob - Is it possible to have more than one orders channel?
My client is selling two types of tickets - one is really a voucher that has separate fields for the voucher holder and voucher payer and another is a general ticket. Both are really the email notification that is redeemed at the door. I’ve set up the voucher orders channel and had the shipping information actually be the voucher holder information. Now I want to set up the tickets orders which won’t have any shipping information. After these two, we’re going to set up physical products, such as T-shirts with different colors and sizes, to sell as well which will require separate billing and shipping information.

In short, we’re selling widely different products with different characteristics. Each type of product - tickets, vouchers, physical products will be sold separately - the customer can not buy all three in one order.

It would seem logical to have separate orders channels - one for each type. Is this possible in CartThrob? I can see that it’s possible to add additional products channels but I haven’t found any way to set up corresponding orders channels. Do I have to combine them all into one large orders channel?

JP

# Answer
> 1 votes
In short, no, you cannot to my knowledge have multiple orders channels.

My question to you would be, "why do you feel you need multiple orders channels?"

All purchases through your site are orders and are irrespective of the actual items being purchased. The orders channel is a list of transactions made. Everything in that channel is an entry indicating something was purchased. The data being stored is the same for each order (no, you don't have shipping details for some items, so those fields just stay blank). The point is, it is still a record of a purchase.

Personally I think you'd run into big problems later trying to audit orders if they were split into different channels.

Think of the real world. Would a business keep records of orders in separate systems? The only time I can think that this might be a sensible idea is if the orders were actually for separate businesses being run through the same 'front' - it would keep the accounting much simpler.

Multiple product channels, as you note, are supported and this does make sense since the products can be wildly different and as such require different types of data to be stored. But orders are orders so they should always be together.

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


# Question
Title: Switchee, Stash, Low Variables, Playa and Parse Order
I’m curious about a parse order issue I’m running into with Low Variables and Stash.

I have a client site that’s using Switchee, Stash, Low Variables and Playa. I am able to retrieve the custom fields just fine inside of the tag, but for whatever reason, I am unable to retrieve the url\_title. It just simply doesn’t render any value.

**Here’s the page template:**

```
{exp:switchee variable="{segment_2}" parse="inward"}
    {case value=""}
        {embed="layouts/.default"}

        {exp:stash:set name='pagetitle'}Gay Blog — The New GayTravel.com!{/exp:stash:set}
        {exp:stash:set name='bodyclass'}blog index{/exp:stash:set}

        {exp:stash:set name='maincontent' parse_tags="yes" parse_depth="3" parse_conditionals="yes"}

            <div class="main-banner">
                <figure>
                    <figcaption>
                        <h1 class="header"><a href="#">Featured Story: <br />Gay Travel Guru’s Visit to Phuket</a></h1>
                        <p>Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
                        <a class="read-more" href="#">Read More »</a>
                    </figcaption>
                    <img src="http://flickholdr.iwerk.org/1280/800/gay, thailand, male" alt="Placeholder image from flickholdr.com" />
                </figure>
                {lv_ad_top_banner_square}
            </div>
            <div id="content">
                <main role="main">
                    <section class="content-block">
                        <h1>Gay Blog Featured Articles</h1>
                        <div class="slider-box clearfix">
                            {exp:low_variables:parse var="lv_blog_featured_articles" limit="3" var_prefix="blog"}
                                <article class="blog-block element-block">
                                    <figure>
                                        <figcaption><a href="{blog:url_title_path='blog'}">{entry_date format="%M %d, %Y"}</a></figcaption>
                                        {exp:ce_img:single src="{blog:blog_main_image}" width="500" allow_scale_larger="yes" height="300" attributes='alt="{blog:title}"' crop="yes"    }
                                    </figure>
                                    <h2><a href="{blog:url_title_path='blog'}">{title}</a></h2>
                                    {blog:blog_summary}
                                </article>
                            {/exp:low_variables:parse}
                        </div>
                    </section>
                    <section class="content-block">
                        <h1>Latest Video Blog</h1>
                        <article class="video-blog-block element-block">
                            <div class="video-container">
                                <iframe src="http://www.youtube.com/embed/dFVxGRekRSg" frameborder="0" width="560" height="315"></iframe>
                            </div>
                            <h2><a href="#">Video Blog Page Title</a></h2>
                            <p>Fusce dapibus, tellus ac cursus commodo, tortor mauris condimentum nibh, ut fermentum massa justo sit amet risus. Donec id elit non mi porta gravida     at eget metus.</p>
                        </article>
                    </section>
                    <section class="content-block">
                        <h1>Blog Archives</h1>
                        <div class="archive-wrapper">
                            {exp:channel:entries
                                channel="blogs"
                                disable="categories|category_fields|member_data|pagination|trackbacks"
                                dynamic="off"
                                limit="12"
                            }
                                <article class="blog-archive element-block">
                                    <figure>
                                        <figcaption><a href="{url_title_path='blog'}">{entry_date format="%M %d"}</a></figcaption>
                                        {exp:ce_img:single src="{blog_main_image}" width="500" allow_scale_larger="yes" height="300" attributes='alt="{title}"' crop="yes"}
                                    </figure>
                                    <h2><a href="{url_title_path='blog'}">{title}</a></h2>
                                </article>
                                {switch="||<div class='clear-left'></div>"}
                            {/exp:channel:entries}
                        </div>
                        <a class="button" href="#">View the Rest of the Archive »</a>
                    </section>
                </main>
                <div class="sidebar">
                    {lv_sidebar_featured_members}
                    {lv_sidebar_get_the_updates}
                    {lv_ad_sidebar_tower}
                    {lv_sidebar_tweets}
                </div>
            </div>
        {/exp:stash:set}
    {/case}
{/exp:switchee}

```

My Low Variable Extension settings are set to parse before snippets, and my Low Variable entry has early parsing turned on.

Also, you can see that I’ve already got parse\_depth set to a level of 3, and it’s still not rendering anything. I got the solution/suggestion from this article

As I mentioned before, everything seems to work, except for the url\_title, which just has a blank value.

Any thoughts on why this is happening would be greatly appreciated!

# Answer
> 1 votes
As it turns out, this was actually an error on the part of the original data migration. I really should have checked that out first. It seems that the url\_titles were never migrated, for whatever reason that could be.

https://www.dropbox.com/s/a6x457jdgwzsu37/Screen%20Shot%202013-07-29%20at%203.16.36%20AM.png

---
Tags: playa, stash, low-variables, parse-order, switchee
---


# Question
Title: Parsing Channel Entry inside of Low Variable inside of Stash Set
Hrm, me again. Looks like I am having problems with Stash and Parse Order, after all, but on a different variable.

**Here's my variable:**

```
<p class="heading"><b>Our Featured Members</b></p>
<div class="sidebar-block featured-members gray-box">
    <div class="member-holder">
        {exp:search_fields
            search:member_profile_image="not IS_EMPTY"
            operator="AND"
            channel="users"
            parse="inward"
        }
            {exp:channel:entries channel="users" entry_id="{search_results}" limit="9" sort="asc" orderby="random" dynamic="no" status="not closed"}
                <a href="{entry_id_path='meet-gay-people/profile'}">{exp:ce_img:single src="{member_profile_image}" width="302" crop="yes" height="302" allow_scale_larger="yes" attributes='alt="{screen_name}"'}</a>
            {/exp:channel:entries}
        {/exp:search_fields}
    </div>
    <a class="button center" href="{path='meet-gay-people'}">Connect with other travelers today!</a>
</div>

```

**And here’s my template partial:**

```
{exp:switchee variable="{segment_2}" parse="inward"}
    {case default="yes"}
        {embed="layouts/.default"}
        {exp:channel:entries
            channel="blogs"
            disable="category_fields|member_data|pagination|trackbacks"
            require_entry="yes"
        }
            {if no_results}{redirect="404"}{/if}
            {exp:stash:set name='pagetitle'}{title} — Gay Blog — The New GayTravel.com!{/exp:stash:set}
            {exp:stash:set name='bodyclass'}blog detail{/exp:stash:set}

            {exp:stash:set name='maincontent' parse_tags="yes" parse_depth="4" output="yes" parse="inward"}
                <div class="main-banner">
                    <figure>
                        <figcaption>
                            <h1 class="header">{title}</h1>
                            <p>Nullam id dolor id nibh ultricies vehicula ut id elit. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
                        </figcaption>
                        <img src="{blog_main_image}" alt="{title} Image" />
                    </figure>
                    {lv_ad_tob_banner_square}
                </div>
                <div id="content">
                    <main role="main">
                        <section class="content-block interior-page">
                            <div class="byline">
                                <h4>POSTED BY <a href="#">{author}</a> ON {entry_date format="%M %d, %Y"}</h4>
                            </div>
                            <div class="addthis">
                                <!-- AddThis Button BEGIN -->
                                <div class="addthis_toolbox addthis_default_style addthis_16x16_style">
                                <a class="addthis_button_facebook"></a>
                                <a class="addthis_button_twitter"></a>
                                <a class="addthis_button_pinterest_share"></a>
                                <a class="addthis_button_google_plusone_share"></a>
                                </div>
                                <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=xa-51bf19d02f28632e"></script>
                                <!-- AddThis Button END -->
                            </div>
                            {exp:channel_images:images entry_id="{entry_id}"}
                                {if image:count == 1}
                                    <div class="slideshow rslides">
                                {/if}
                                <figure>
                                    {if image:description}<figcaption>{image:description}</figcaption>{/if}
                                    <img src="{image:url:large}" alt="{title} Image" />
                                </figure>
                                {if image:count == image:total}
                                    </div>
                                {/if}
                            {/exp:channel_images:images}
                            {blog_body}
                            {exp:channel_images:images entry_id="{entry_id}"}
                            {if image:count == 1}
                                <div class="popup-gallery">
                                    <h4>Click any image below to view a larger version.</h4>
                            {/if}
                            <a href="{image:url:large}" title="{title}"><img src="{image:url:small}" width="75" height="75"></a>
                            {if image:count == image:total}
                                </div>
                            {/if}
                            {/exp:channel_images:images}
                            <div class="comments">
                                <div id="disqus_thread"></div>
                                <script type="text/javascript">
                                    /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */
                                    var disqus_shortname = 'new-gaytravel'; // required: replace example with your forum shortname

                                    /* * * DON'T EDIT BELOW THIS LINE * * */
                                    (function() {
                                        var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
                                        dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js';
                                        (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
                                    })();
                                </script>
                                <noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
                                <a href="http://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

                            </div>
                        </section>
                    </main>
                    <div class="sidebar">
                        {lv_sidebar_featured_members}
                        {lv_sidebar_get_the_updates}
                        {lv_ad_sidebar_tower}
                        {lv_sidebar_tweets}
                    </div>
                </div>
            {/exp:stash:set}
        {/exp:channel:entries}
    {/case}
{/exp:switchee}

```

**Finally, I’m calling the partial from this tag:**

`{exp:stash:get name='maincontent'}`

**And here’s the template for the page layout**

```
<!doctype html>
<html lang="en-US">
    <head>
        <title>{exp:stash:get name='pagetitle'}</title>
        <link rel="stylesheet" href="/assets/css/screen.css">
        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <!--Scripts before load-->
        <script src="http://modernizr.com/downloads/modernizr-2.5.3.js"></script>
        <script src="//use.typekit.net/yqk6mds.js"></script>
        <script >try{Typekit.load();}catch(e){}</script>
        <link rel="stylesheet" href="/assets/css/magnific-popup.css">
        <link rel="stylesheet" href="/assets/css/responsiveslides.css">
    </head>
    <body class="{exp:stash:get name='bodyclass'}">
        <div class="body-wrapper">
            <header>
                <a href="/" class="logo">GayTravel.com — Travel Guides with a Gay Perspective.</a>
                <nav class="main-navigation">
                    <ul>
                        <li><a class="first" href="{path='gay-friendly-hotels'}">Hotels</a>
                            <ul class="hotels">
                                <li><a class="first-child" href="#">National Chain</a></li>
                                <li><a href="#">Boutique</a></li>
                                <li><a href="#">Bed & Breakfast</a></li>
                                <li><a class="last-child" href="#">Vacation Home/Time Share</a></li>
                            </ul>
                        </li>
                        <li><a href="{path='gay-guides'}">Destinations</a>
                            <ul class="destinations">
                                {exp:low_variables:parse var="lv_gc_destination_subnav" limit="6"}
                                    <li><a class="{if count == '1'}first-child {/if}{if count == total_results}last-child{/if}" href="{url_title_path='gay-guides'}">{title}</a></li>
                                {/exp:low_variables:parse}
                            </ul>
                        </li>
                        <li><a href="{path='gay-friendly-tours-cruises'}">Tours & Cruises</a>
                            <ul class="tours-cruises">
                                <li><a class="first-child" href="{path='gay-friendly-tours'}">Tours</a></li>
                                <li><a class="last-child" href="{path='gay-friendly-cruises'}">Cruises</a></li>
                            </ul>
                        </li>
                        <li><a href="{path='gay-events'}">Events</a></li>
                        <li><a href="{path='top-tens'}">Top Tens</a></li>
                        <li><a href="{path='gaytravel-guru'}">Guru</a>
                            <ul class="guru">
                                <li><a class="first-child" href="{path='gaytravel-guru'}">About the Guru</a></li>
                                <li><a href="{path='gaytravel-guru/sponsors'}">About Our Sponsors</a></li>
                                <li><a class="last-child" href="{path='gaytravel-guru/season-3-signup'}">Signup to Be Our Season 3 Guru!</a></li>
                            </ul>
                        </li>
                        <li><a class="last" href="{path='gay-blog'}">Blog</a>
                            <ul class="blog">
                                <li><a class="first-child" href="#">Davey Wavey</a></li>
                                <li><a href="#">Carlos Melia</a></li>
                                <li><a href="#">Event Spotlight</a></li>
                                <li><a href="#">Videos We Love</a></li>
                                <li><a class="last-child" href="#">GayTravel Guru</a></li>
                            </ul>
                        </li>
                    </ul>
                </nav>
                <form action="" class="destination-search">
                    <label for="destination-input">Where do you want to travel to?</label>
                    <input type="text" name="destination-input" />
                </form>
            </header>

    {exp:stash:get name='maincontent'}

        </div>
        <div class="signup-cta-footer">
            <div class="inner-spacer">
                <h3>Know before you go!</h3>
                <div class="float-left">
                    <h4>Meet up with other gay travelers all around the globe.</h4>
                    <div class="column-collapse">
                        <p>Explore videos, photos, travel tips, maps and top Gay Destinations.</p>
                        <p>Create your profile and make friends around the world.</p>
                        <p>Meet like-minded travelers who share your interests.</p>
                        <p>Post your stories and share your travel tips with others.</p>
                        <p>Browse our events and find the most reliable information about the best gay events around the globe.</p>
                    </div>
                    <a class="button" href="#">Sign Up Now, It’s Free!</a>
                </div>
                <div class="advertisement square">
                    <p class="ad-cta">Advertisement <a href="#">Put your ad here.</a></p>
                    <div class="ad"></div>
                </div>
            </div>
        </div>
        <div class="site-search-footer">
            <div class="inner-spacer">
                <nav class="page-column">
                    <h3>About Us</h3>
                    <ul>
                        <li><a href="#">About Us</a></li>
                        <li><a href="#">Contact Us</a></li>
                        <li><a href="#">Company News</a></li>
                        <li><a href="#">Careers</a></li>
                        <li><a href="#">Media Partners</a></li>
                        <li><a href="#">Partnerships</a></li>
                        <li><a href="#">Advertising</a></li>
                    </ul>
                </nav>
                <nav class="page-column">
                    <h3>Community</h3>
                    <ul>
                        <li><a href="#">Member Profiles</a></li>
                        <li><a href="#">Newsletter</a></li>
                        <li><a href="#">RSS Feeds</a></li>
                        <li><a href="#">Sponsorships</a></li>
                        <li><a href="#">Charities</a></li>
                        <li><a href="#">Gay Travel Awards</a></li>
                        <li><a href="#">Gay Travel Associations</a></li>
                    </ul>
                </nav>
                <nav class="page-column">
                    <h3>Explore</h3>
                    <ul>
                        <li><a href="#">Gay Guides</a></li>
                        <li><a href="#">Events</a></li>
                    </ul>
                    <h3>Plan</h3>
                    <ul>
                        <li><a href="#">Hotels</a></li>
                        <li><a href="#">Cruises</a></li>
                        <li><a href="#">Tours</a></li>
                    </ul>
                </nav>
                <nav class="page-column">
                    <h3>Meet</h3>
                    <ul>
                        <li><a href="#">Profiles</a></li>
                        <li><a href="#">Travel Experts</a></li>
                        <li><a href="#">Blog</a></li>
                        <li><a href="#">Guru</a></li>
                    </ul>
                </nav>
            </div>
        </div>
        <footer>
            <div class="inner-spacer">
                <div class="contact-info">
                    <h4 class="phone-number">1-800 GAYTRAVEL <span>1-800-429-8728 (702-560-5073)</span></h4>
                    <nav class="social-icons">
                        <p>Find us on:</p>
                        <ul>
                            <li><a class="twitter" href="#">Twitter</a></li>
                            <li><a class="facebook" href="#">Facebook</a></li>
                            <li><a class="youtube" href="#">Youtube</a></li>
                        </ul>
                    </nav>
                </div>
            </div>
        </footer>
        <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
        <script type="text/javascript">
            if (typeof jQuery == 'undefined') {
                document.write(unescape("%3Cscript src='assets/js/jquery-1.9.1.min.js' type='text/javascript'%3E%3C/script%3E"));
            }
        </script>
        <script type="text/javascript" src="/assets/js/jquery.flexisel.js"></script>
        <script src="/assets/js/responsiveslides.js"></script>
        <script src="/assets/js/jquery.magnific-popup.min.js"></script>
        {exp:stash:get name='scripts'}
        <script src="/assets/js/script.js"></script>
    </body>
</html>

```

Are there other parameters I’m missing? I had assumed parse\_depth would have solved my problem, but it seems that on a detail page, it doesn’t matter.

Oddly enough, though the rest of the page renders as normal with early parsing turned on, there's an extra `{/exp:channel:entries}` tag at the bottom; removing the Low Variable causes everything to snap back into place.

I’ve gone through the suggestions so far, and setting the Low Variable element to parse in the regular flow and not early causes it to not parse the code at all.

Thanks all!

# Answer
Try `{exp:low_variables:parse var="lv_sidebar_featured_members"}` instead of `{lv_sidebar_featured_members}`
> 2 votes

# Answer
Is `{lv_sidebar_featured_members}` set to 'early parsed'? If it is, the problem could be that it contains a channel entries tag and you are nesting it inside another channel entries tag.
> 2 votes

---
Tags: channel-entries, stash, low-variables, parse-order
---


title: Strange shipping rule

text:
# Question
Title: Strange shipping rule
I have a strange problem with a rule for shipping. I setup a rule that between 0 and 50 € in total each shipping item is charged with 1,40 €. The rule match like it should and when it's over 50 € shipping is free. Now when i choose an item which is below a 2 digit number the rule doesn't match anymore and it only match when it is over 60 €.

At the moment i have only one rule. The Filter is for every country and region Maximum Order Total is 50,00 € and per Item rate is 1,40.

Another problem is also with the shipping. When i set round item prices after tax and added all prices without tax inside the backend, all store frontend prices are fine, but the shipping of 1,40 display on two items always 2,81 and i don't want that. Independently if it round the value or not where does the 0,01 come from when i set the item charge to 1,40??

To fix this i commented the following lines out at store\_shipping\_default.php to prevent the strange rounding on shipping but this can't be a solution for my problem.

It would be nice if someone can have a look why this happens. Especially the wrong charging on items where the price is under 10,00 €?

Below is also the part i commented out of the function:

```
        // this isn't particularly tidy, but it solves the tax rounding problem
    // if ($this->EE->store_config->item('tax_rounding') == 'y')
    // {
    //  $tax_multiplier = 1 + $order['tax_rate'];
    //  foreach (array('base_rate_val', 'per_item_rate_val', 'per_weight_rate_val', 'min_rate_val') as $field)
    //  {
    //      $rule[$field] = store_round_currency($rule[$field] * $tax_multiplier) / $tax_multiplier;
    //  }
    // }

```

Thanks

Peter

# Answer
This issue has been resolved via email but I'll provide a solution to anyone else who may have similar issues.

---

To answer your first problem with regards to the shipping rule, the problem here was that Store calculates tax on the tax-exclusive subtotal whereas you were displaying the subtotal **including** tax: `{order_subtotal_inc_tax}`.

So in your case with tax intended to be free on orders over €50 with the tax rate set at 19% you would use this formula to calculate what you should set your shipping rate too:

target shipping / (1 + tax rate)

Specifically:

50 / (1 + 0.19) = 42.0168

So your shipping rule should be set to €42.0168 to provide free shipping on orders over €50.

---

To answer your second question regarding rounding errors, that's not a bug but expected behaviour. If you **include** tax in your product prices (shown on the front-end) then you need to set "Round item prices after tax" to Yes. If you **don't include** tax in your item prices (displayed on the front-end) then you can set this to No.

The "Round item prices after tax" takes care of some special rounding if you are displaying tax-inclusive prices on the front end, so basically every time people are using the `{price_inc_tax}` variables they should set "round item prices after tax" to Yes.

For example, if tax rate is 10%, and your item is $20.00 exactly including tax, you would enter this as $18.18 in the CP. Now if a customer purchased one item, `{price_inc_tax}` shows $20.00 which is fine. But if they purchased 10, ($18.18 x 10) * 1.1 = $199.98. If you were displaying prices including tax in the checkout, that would display as $20.00 x 10 = $199.98 which would definitely confuse your customer. "Round item prices after tax" means that Store will calculate round\_to\_2dp($18.18 * 1.1) * 10, or $20.00 * 10 = $200.00 which is what you would expect.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Quotation marks not working - entries template
When a blog post has quotes or apostrophes in it *“like this”* or when *it’s* like *‘this,’* the punctuation is replaced with characters like â€™s or â€™s. This is only in the blog/entry template. Everything works fine in the blog/index template.

Any ideas why? Both templates have the following code in the header:

`meta charset="utf-8"`

And the site language is English.

Here is the code for the blog/entry template:

http://shorttext.com/xVwZkP

Can anyone point me in the right direction? I haven’t found much documentation on this. Help?

# Answer
What is the encoding of the blog/entry template? Open it on a code editor and make sure it's a UTF-8 no BOM file.

If you don't have access to the files by FTP, try... Well, I don't know if this will work. Let's try.
> 1 votes

---
Tags: ee2
---


# Question
Title: using JOIN in a db select statement not returning my array
I am using in the below code, and it is **not** returning anything.

Details:

* php is allowed on my template
* parsing is set on output.
* the '\[FETCH ENTRY ID\]' does not return my entry id (I can put in the ee tag `{entry_id}`, but than it only returns one entry\_id. I think I need it to stay in php without any ee tags at this point.

All ideas any welcome!

```
{exp:channel:entries channel="property" category_group="4"}
<?php
    $this->EE =& get_instance();
    $entry_id = '[FETCH ENTRY ID]';
    $res = $this->EE->db->select('c.cat_name')
                    ->from('categories c')
                    ->join('category_posts cp', 'cp.cat_id = c.cat_id')
                    ->join('channel_titles ct', 'c.entry_id = cp.entry_id')
                    ->where('c.group_id', 4)
                    ->where('ct.entry_id', $entry_id)
                    ->result_array();
?>
{exp:channel:entries}

```

# Answer
Shouldn't the second join use ct instead of cp?
> 1 votes

# Answer
It should be something along the lines of this:

```
{exp:channel:entries channel="property" category_group="4"}

    {exp:query sql="SELECT c.cat_name FROM exp_categories c
        JOIN exp_category_posts cp ON cp.cat_id = c.cat_id
        JOIN exp_channel_titles ct ON cp.entry_id = ct.entry_id
        WHERE c.group_id = 4 AND ct.entry_id = {entry_id}"}
        {cat_name}
    {/exp:query}

{/exp:channel:entries}

```

I think part your original problem may be that your closing {exp:channel:entries} didn't have the slash so it wasn't parsing the entry\_id like it should.
> 0 votes

# Answer
Although I think @Ponder The Web has answered your question directly, why are you using SQL in the first place?

```
{exp:channel:entries channel="property" category_group="4"}
    {categories show_group="4"}
        {category_name}
    {/categories}
{/exp:channel:entries}

```

Ref: Categories Documentation

Also regarding your original question:

> the '\[FETCH ENTRY ID\]' does not return my entry id (I can put in the ee tag {entry\_id}, but than it only returns one entry\_id. I think I need it to stay in php without any ee tags at this point.

\[FETCH ENTRY ID\] will do nothing, I've no idea where this has come from - it looks like Wordpress syntax...?

{entry\_id} should be set on each loop though with your PHP code being duplicated for each entry it finds, so {entry\_id} should work fine if the other issues (e.g. closing channel:entries tag) are resolved.

**Updated for new information:** using Server Variables

```
{exp:channel:entries channel="property" category_group="4"}
    {categories show_group="4"}
        {if "{exp:server_var:get var="region"}" == {category_id}}
            {category_name}
        {/if}
    {/categories}
{/exp:channel:entries}

```

or

```
{exp:channel:entries channel="property" category_group="4"}
    {exp:server_var:get}
        {categories show_group="4" show="{region}"}
            {category_name}
        {/categories}
    {/exp:server_var:get}
{/exp:channel:entries}

```

Both assumes that $\_GET\["region"\] is the category ID.
> 0 votes

---
Tags: php, parse-order
---


# Question
Title: How to get filename of uploaded Safecracker File image?
I'm using Zoo Visitor which advocates the **Safecracker File** field type for user uploaded avatars.

Safecracker File stores the image reference as `{filedir_x}filename`.

I'm wanting to use EE's image manipulation to **crop and resize** the uploaded image so I need to be able to output src attributes of the form…

```
/path/to/images/avatars/uploads/_subfolder/filename

```

How can I get hold of the **filename** in my tag output? Do I have to resort to custom PHP or is there an easier way?

# Answer
Ah, OK…

> "SafeCracker File inherits the tags of the standard File field"

…so I can just use the appropriate single variable parameter such as…

```
{member_avatar:image_manipulation_short_name}

```

Must read more carefully before posting!
> 1 votes

---
Tags: file-uploads, zoo-visitor, safecracker-file, uploads, filename
---


title: new channels shown by week

text:
# Question
Title: new channels shown by week
i have made this code to generate the new entries wich have been posted.

```
<div class="nieuwe_berichten">
  {exp:channel:entries channel="interne_memo" display_by="week" limit="1" show_current_week="yes"}
    {total_results} nieuwe berichten!
  {/exp:channel:entries}
</div>

```

This code generates only: “2 nieuwe berichten” and also 2 times. Does anybody know how to write a good code for this?

thnx in advance, Leon vd Leer

# Answer
> 1 votes
```
{exp:channel:entries
    channel="interne_memo"
    display_by="week"
    limit="1"
    show_current_week="yes"}
    {if no_results}0 nieuwe berichten{/if}

    {!-- your display for each entry here --}

    {if {count} == {total_results}}
        {total_results} nieuwe berichten!
    {/if}
{/exp:channel:entries}

```

**Update:** Revisiting this question, I can't work out why limit is in the parameters, as this will always force only 1 entry to return. This would surely be better:

```
{exp:channel:entries
    channel="interne_memo"
    display_by="week"
    dynamic="no"
    show_current_week="yes"}

```

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


# Question
Title: How can I display entries from a category but hide entries belonging to it's child categories
I have product categories with 3+ levels, sometimes a product is assigned to the second level, sometimes it's assigned to level 3, so a category may have sub categories with products, and products.

I can't figure out how to display the just products in a category if that category also has child categories with products, EE insists on displaying all the products from the child categories too.

I have tried `{if parent_id != {cat_id}}` (`cat_id` taken from a query using the url to filter), no luck as EE doesn't seem to diffentiate between direct parents and grand-parents or higher.

How can I filter out the products from the child categories?

# Answer
If you have this `Auto-assign Category Parents` set to 'Yes' in Admin \> Channel Administration \> Global Preferences, then all entries in child categories will automatically be assigned to the parent categories too. Set to 'no' to disable this behaviour.
> 0 votes

---
Tags: filter, categories, child
---


# Question
Title: Group Low Search results by channel/collection?
I know I can make collections and search one or more of them using Low Search. If I understand correctly, the results I get back will be ordered by relevance. But what if I have several channels that I want to show in different lists on the search results page? Is it possible to group the results by channel? Within each group I would still like the most relevant results first.

To clarify my intention, my results page would have a few headings like 'people', 'news' and 'pages'. The people section would present the found entries from the 'people' channel with their picture, email address etc. while the news and pages entries would have their own look as well.

# Answer
It's not possible to order/group by collection in a single Results tag at the moment.

You could achieve something similar by having multiple Results tag on a page with different collection="" parameters.
> 0 votes

---
Tags: low-search
---


title: Freeform not working?

text:
# Question
Title: Freeform not working?
Would there be any reason why my 3 Freeform forms wouldn't do the following:

* Notify Admin
* Save submission at all
* fields in submission are empty

Below is my Freeform code:

```
{exp:freeform:form
    form_id="4"
    form:class="contact-form"
    form:id="contact-form"
    required="full_name|email"
    return="focusform3/results/%%entry_id%%"
    notify_admin="yes"
    admin_notify="ADMINS EMAIL ADDRESS"
    admin_notification_template="focus_form_3"
    notify_user="yes"
    user_email_field="email"
    user_notification_template="focus_form_3"
}

```

Each of the 3 forms has 11 fields and are exactly the same just the form and admin email is different per form. Each form has the same notification template layout.

I tested each form twice. Each time with a different email address for admin. made sure this email was also updated in the form, form notification and the form code in the template. Each time it worked as it should. Client however tested each form and either her submission didnt save, was incomplete with empty fields when she filled out all fields and at times didnt receive an admin email.

My EE install is the following:

* EE 2.5.5
* MSM 2.1.3
* Freeform 4.0.10

Thanks

# Answer
What other factors are at play here? You you have AJAX/JS validation, .htaccess rewrites, captcha, etc? Would be great to see what the rest of the code in your template, or if you created a new, simplified template with barebones code and see if any difference is made. :)

You should also have a look at the Freeform Troubleshooting guide for more information about common conflicts and errors: http://www.solspace.com/docs/freeform/troubleshooting/
> 1 votes

# Answer
This won't be all the problems, but maybe the client needed to fill out a captcha and it wasn't included in the form so it didn't submit? Also, Solspace has their own forum and you might get better support thru that.
> 0 votes

---
Tags: multi-site-manager, solspace-freeform
---


# Question
Title: Embedding article template with many entry tags
I’m working on a blog and would love to make the markup for a single article its own template for embedding elsewhere so I don't have to repeat that markup in multiple places, but I don't know how to do this and still parse all entry tags. The markup for a single article will appear in multiple templates (`blog/index`, `blog/single`, etc.) and is exactly the same. Currently it appears like this in my `blog/index` template:

```
{exp:channel:entries channel="blog" dynamic="no"}
    {if post_theme}
        {post_theme}<article class="theme-{theme}" style="background-color: {background_color};">{/post_theme}
    {if:else}
        <article>
    {/if}
        <div class="interior">
            <header class="article-header {header_options}col-start-{col_start} col-end-{col_end} overlay-{headline_overlay} headline-size-{headline_size}{/header_options}">
                <h5><a href="{page_url}"><time>{entry_date format='%j %F %Y'}</time></a></h5>
                {categories}
                    <h2><a href="{path='blog/index'}">{category_name}</a></h2>
                {/categories}
                <h1>{title}</h1>
            </header>
            {blog_cover_image}
                {if image}
                    <figure class="cover-image {image_width}">
                        {if '{image_width}' == 'full-width'}
                            {exp:ce_img:single src="{image}" add_dims="yes" width="750" attributes='alt="{alt_text}"'}
                        {if:elseif '{image_width}' == 'text-width'}
                            {exp:ce_img:single src="{image}" add_dims="yes" width="500" attributes='alt="{alt_text}"'}
                        {/if}
                        {if caption}
                            <figcaption>
                                {caption}
                            </figcaption>
                        {/if}
                    </figure>
                {/if}
            {/blog_cover_image}
            <aside>
                <ul class="article-tags">
                    {exp:tag:tags
                        entry_id="{entry_id}"
                        orderby="tag_name"
                        sort="asc"
                    }
                        <li><a href="{path='blog/tag'}/{websafe_tag}" title="{tag}" style="font-size:{step}px;">{tag}</a></li>
                    {/exp:tag:tags}
                </ul>
            </aside>
            <div class="article-content">
                {blog_images}
                    {exp:mx_jumper:put name="image_{row_count}"}
                        <figure class="{placement} {size}">
                            {if '{size}' == 'full-width'}
                                {exp:ce_img:single src="{image}" add_dims="yes" width="750" attributes='alt="{alt_text}"'}
                            {if:elseif '{size}' == 'text-width'}
                                {exp:ce_img:single src="{image}" add_dims="yes" width="500" attributes='alt="{alt_text}"'}
                            {if:else}
                                {exp:ce_img:single src="{image}" add_dims="yes" attributes='alt="{alt_text}"'}
                            {/if}
                            {if caption}
                                <figcaption>
                                    {caption}
                                </figcaption>
                            {/if}
                        </figure>
                    {/exp:mx_jumper:put}
                {/blog_images}
                {exp:mx_jumper:out_global}
                    {blog_post_content}
                {/exp:mx_jumper:out_global}
                {if external_links}
                    <div class="external-links">
                        {external_links}
                    </div>
                {/if}
            </div>
        </div>
        <footer class="article-footer">
            <div class="interior">
                <ul class="tools">
                    <li class="permalink"><a href="{page_url}">Permalink</a></li>
                    <li class="tweet"><a target="_blank" href="http://twitter.com/home?status={page_url}">Tweet</a></li>
                    <li class="pinterest"><a target="_blank" href="http://pinterest.com/pin/create/button/?url={page_url}">Pinterest</a></li>
                    <li class="facebook"><a target="_blank" href="http://www.facebook.com/share.php?u={page_url}">Facebook</a></li>
                </ul>
            </div>
        </footer>
    </article>
{/exp:channel:entries}

```

Here is what I would rather do:

```
{exp:channel:entries channel="blog" dynamic="no"}
    {embed="blog/.article"}
{/exp:channel:entries}

```

I need everything between my `{exp:channel:entries}` tag to be an embed, but I don't know what to pass it so that all entry tags are parsed.

Ideas?

# Answer
Since I couldn't found nothing that looks like a snippet on your code, you can use one.

Save all the internal code of `exp:channel:entries` tags on a snippet called `snip_article` and go ahead!

If you want a way to edit snippets as plain text files, give to SnippetsSync a try.
> 2 votes

---
Tags: templates, embeds, dry
---


# Question
Title: Prevent access to templates from a remote server
I have some templates that output JSON in ExpressionEngine which we are called using a simple CURL request from a CodeIgniter app elsewhere on the same domain - we don't want these templates to be accessible to other sites as we want to control who has access to this data (though it's not sensitive) - how can we best go about achieving this?

I was thinking about using .htaccess but in some ways I would rather control it at a template level so it's not forgotten or missed in future site updates.

# Answer
> 0 votes
Could you use PHP to examine the requesting IP address or referrer?

Maybe have your requesting script pass some secret hash to the template which could check for it's presence before outputting the JSON?

---
Tags: templates, security
---


title: Using a status colour on the front-end

text:
# Question
Title: Using a status colour on the front-end
Is there a way to retrieve the colour assigned to a status to use on a front-end template?

For instance, I have an ecommerce system that uses a status of "Declined". I have made this status display in red so on the back end the store administrator can easily see any declined transactions.

Now, say I wanted to output a list of a customer's transactions for them on the front end. Would it be possible to grab that colour to use in my template or will I need to create a series of conditionals and set colours that way (using CSS classes)?

I guess a quick hack around it would be to do something like

```
<p class="{status}">Status: {status}</p>

```

# Answer
> 0 votes
You can't, my friend. Your suggestion of code is the best option.

---
Tags: templates, status
---


# Question
Title: url_title Does Not Return Results in {exp:playa:parents} Tag
I'm trying to filter a list of products based off of a Playa field. The URL for the template is like this: `http://www.mysite.com/products/seller/joes-jetpacks`

`joes-jetpacks` is the URL Title of the entry the product is related to. So to display all products that are sold by Joe's Jetpacks, I'm using this tag:

```
{exp:playa:parents
    channel='products'
    url_title='{segment_3}'
    limit='7'
    disable='member_data|category_fields'
    orderby='title'
    sort='asc'
    paginate='both'
    status='open|Featured'
}
    {!-- channel listing content --}
{/exp:playa:parents}

```

But that returns no results. Alternately, if I replace the `url_title` parameter with `entry_id`, and use the url `http://www.mysite.com/products/seller/1234` instead, I get the correct results.

* EE 2.5.2
* Playa 4.4.3

# Answer
Actually, Playa is doing everything correct here. The parameters you pass on `{exp:playa:parents}` are for defining what *parent* entries you want to get; they’re not meant to describe the *child*, which is what you’re doing with `url_title`.

If you have a URL Title for an entry and you want to get the parents of that entry, you first have to get the child entry with `{exp:channel:entries}`:

```
{exp:channel:entries channel="merchants"
                     url_title="{segment_3}"
                     limit="1"
                     disable="categories|custom_fields|member_data|pagination"}

    {exp:playa:parents channel='products'
                       limit='7'
                       disable='member_data|category_fields'
                       orderby='title'
                       sort='asc'
                       paginate='both'
                       status='open|Featured'}

        {!-- channel listing content --}

    {/exp:playa:parents}
{/exp:channel:entries}

```
> 2 votes

---
Tags: playa, filter
---


# Question
Title: 2 fields with numbers...need to add them together for sorting entries by that number
I have a channel with 2 fields, "New Square Footage" and "Remodeled Square Footage". I'm displaying both of these numbers in my template. I want to be able to sort the entries by the total of both of those fields. I currently have a form that will sort based on one of those fields and it works fine using Dynamic Parameters http://ellislab.com/expressionengine/user-guide/modules/channel/dynamic\_parameters.html. Any way to add these fields together? I'm not sure if it can be done through the template, or if there needs to be a hidden field in the Publish form that adds them together...Any ideas?

My current form

```
        <ul>
        <li>
        <label>Order By:</label>
        <select name="orderby">
            <option value="project_state">State</option>
            <option value="project_completion_date">Completion Date</option>
            <option value="project_contract_amount">Contract Amount($)</option>
            <option value="project_new_sq_ft">Square Footage</option>
        </select>
        </li>
        <li>
        <label>Sort:</label>
        <select name="sort">
            <option value="asc">Ascending</option>
            <option value="desc">Descending</option>
        </select>
        </li>
        <li>
        <input type="submit" value="Go!" />
        </li>
    </ul>

```

"prject\_new\_sq\_ft" is one of the fields, I need that to be the total of both fields.

# Answer
> 1 votes
Math add-on?

This one is free and has a lot of praise.

But I'm assuming you need the total on the page that receives the form, and as you may not be able to use the add-on as a parameter, it may not work. Worth a try.

Otherwise what about simply using JQuery/JavaScript on the form onChange event for either/both the fields, that automatically populates a hidden field with the combination of the 2 fields.

**UPDATE:** Another route...

Parent template uses an add-on (there are others) to get the POST or GET variables, you then pass those to the child embed template to be used in the channel:entries, which no longer uses dynamic parameters.

Parent Template:

```
{embed=template-group/child-template
    orderby="{exp:server_var:server:post var="orderby"}"
    sort="{exp:server_var:server:post var="sort"}"
    combined="{exp:will_hunting:solve_pair}{$result={exp:server_var:server:post var="prject_new_sq_ft"}+{exp:server_var:server:post var="prject_remodel_sq_ft"}}{/exp:will_hunting:solve_pair}"}

```

Child Template:

```
{exp:channel:entries sort="{embed:sort}" orderby="{embed:orderby}" limit="{embed:combined}"}

```

Reading back through your question, I'm a little confused as to what "I want to be able to sort the entries by the total of both of those fields." actually means as you can't "sort" by a number, so in the example above I've just used it for limit to give you the idea and you can manipulate as you see fit.

I've used a different Math add-on, as looking into it MX Calculator won't allow the tags in the parameter, but this one looks as though it could work (obviously there are others).

It's doubtful that the code above will work without further tweaking, possibly adding parse="inward" to the server\_var tags. But hopefully it'll give you the right direction.

---
Tags: forms, dynamic, math
---


# Question
Title: Is there a way to parse a template tag inside an extension hook handler?
As you know, we can't use template tags inside extension hook handlers because those will not be parsed.

However is there an alternate way to access them inside extension hook handlers? Or something like given a tag string, have a function that can parse it?

# Answer
Anything can be parsed in an extension, it just depends on what hook you're using as to what you're going to do with the output.

template\_post\_parse for example passes the templateData, so you can then manipulate it, parse it, do whatever you want with it and then return it.

You'd just use parse\_variables in the normal way.

Some hooks don't provide tagData directly and therefore there's no way to manipulate it.

**UPDATE** Yes you can access the template contents and parse them from anywhere (See \*disclaimer), but unless the code that implements the hook then continues to processes the template, what you've changed via the hook will be ignored.

e.g.

Original EE code `$myTagData = $this->EE->TMPL->tagdata;`

Hook in EE code

Your Extension code (via the hook) manipulates $this-\>EE-\>TMPL-\>tagdata.

Your code returns to the original EE code flow

Original EE Code continues to use `$myTagData` not your modified `$this->EE->TMPL->tagdata`.

\*Disclaimer: Remember that `$this->EE->TMPL->tagdata` is the template code within the tag pair (not the whole template), so if you try to get tagdata independently it probably won't be related to the tagdata that the method with the hook is using (especially a pair loop). And you probably won't be able to use `$this->EE->TMPL->tagdata` to get the tagdata! Some hooks (especially third-party) send the whole parent object, which allows access to different elements that may include the tagdata.

**Importantly the bottom line is, it depends on what hook you're using and what you're trying to do in the Extension.**
> 1 votes

---
Tags: tags
---


# Question
Title: Is there a better way to link to pages than by entry_id?
I have a need to place a few links into various templates to pages that might have their names changed as other individuals do SEO things that I do not agree with. I was thinking the easiest way to add a url in a header as a callout would be by the entry\_id. I am not finding any way to get the URL from the entry\_id other than writing my own plugin, which I did using the help of a stackoverflow answer that clued me into the url's being stored in the global array: https://stackoverflow.com/questions/8245405/expressionengine-how-to-get-the-path-of-a-page-given-its-entry-id-with-the-str

I suspect that this is a problem others have a better solution for already, but being so new to EE I just do not know of? Or maybe the need to change a pages url and title is not common enough for the need for a solution?

# Answer
You can use {title\_permalink} or {url\_title\_path} to output a link to a page with its current url title. Like:

```
{exp:channel:entries channel="some_channel" entry_id="12|43|55"}
    <a href="{title_permalink='your_template_group/your_template'}">{title}</a>
{/exp:channel:entries}

```
> 1 votes

---
Tags: plugin, pages, page-uri
---


# Question
Title: Determine if display_field is request from {safecracker} tag vs. backend?
:)

I am trying to develop a new fieldtype and would like to display different markup depending on whether the field was requested by the user or in the backend.

Is there a reliable way to detect in the display\_field() function whether it was requested via the {exp:safecracker} {custom\_fields} loop.

# Answer
> 3 votes
You could check for the presence of the Safecracker library:

```
if (isset(ee()->safecracker))

```

Or check if you're in the control panel

```
if (REQ === 'CP')

```

---
Tags: safecracker, add-on-development, fieldtype
---


# Question
Title: What's the best way to bulk add or import categories?
I'd like to import a long list of categories into ExpressionEngine and create new categories. Is there an easy way to do this, either via add-on, or some handy PHP code?

# Answer
Use DataGrab -- http://devot-ee.com/add-ons/datagrab -- and import with a spreadsheet. If you have only one level for categories, it's super easy. If you have category levels or categories with same name, it's a little more complicated.

If you have levels, your spreadsheet (csv is best, IMO) can be created safely following these steps.

1. In EE, create the first top-level category. Note its cat\_id.
2. Export the exp\_categories table from your database (or create a spreadsheet with the exact same columns as that table).
3. Add a new row for a new category (best to keep it in order for sanity's sake). If the next category is a child of the first category your entered in EE, make sure to the parent category's id as this category's parent\_id. Also, this category would have a cat\_id one number higher than the first one you created.
4. Keep adding rows like that.

If you have categories with the same name, make sure to give them a unique cat\_url\_title.
> 1 votes

---
Tags: categories, import, bulk
---


title: Wygwam Upgrade to v3.0.2

text:
# Question
Title: Wygwam Upgrade to v3.0.2
After performing a upgrade from Wygwam 2.7.1 to Wygwam 3.0.2 the wygwam-field doesn't appear anymore. For a brief moment it shows the html-code inside the field, but when the editor should appear nothing happends.

Tried it in IE en Firefox, cleared cache.

Does anyone know where to look?

With kind regards,

Jeroen van Dijk

# Answer
For me, this happened and was a cache problem -- I cleared the cache; it started working again. I know you said you tried that, but give it another go.
> 1 votes

---
Tags: wygwam, upgrade, editor
---


# Question
Title: Does Wygwam 3.0.2 strip out JavaScript in Source mode?
I have a client who uses a lot of embedded Wufoo forms in EE entries. Previously, this was no problem in Wygwam--just switch to Source mode and paste in the JavaScript from Wufoo!--but since upgrading Wygwam to 3.0.2, this client has noticed that this no longer works. Now whenever JavaScript is pasted into the Source, it seems to be getting stripped out upon submission.

Is there a way to work around this?

# Answer
Apparently, this is something WYGWAM used to do as well. Here's the support thread:

https://getsatisfaction.com/pixelandtonic/topics/wygwam\_deleting\_javascript\_tags\_in\_content
> 0 votes

---
Tags: pixelandtonic, wygwam, javascript, wysiwyg
---


# Question
Title: Is Low Search able to search on a Playa field inside a Matrix field?
Is there a way to search a Playa field inside a Matrix field?

If not, are there any other alternatives(like using a hook) or is it really not possible?

# Answer
> 1 votes
If it's just the title of the child entry you want to search, then that will be searchable by default, as Playa stores that data directly in Matrix/channel fields (when they are set to searchable in the field settings).

To clarify, that would give you a search result linking to the parent entry, not the child entry.

---
Tags: matrix, playa
---


title: Search Result Count

text:
# Question
Title: Search Result Count
Our client would like to have search result total(s) next to the filter options. Those numbers would update based on the filters chosen prior:

I can't upload an image, so here is a link to an example: http://ryanwake.com/super\_search/filter\_example.jpg

In the image - if a user chose Chemical Biology, then the total results for the other filter options would update based on the option chosen.

Has anyone done this, is it even possible with Super Search and Tags? Any help would be appreciated.

# Answer
> 1 votes
You might be able to update results using javascript/jQuery and AJAX, fetching the search form results from a separate template containing `{exp:super_search:results}`.

For example, calling a template containing {exp:super\_search:results} and searching for both checked tags and the yet unchecked tag (eg. the checked "Chemical Biology" and unchecked "Structural Biology"), is one way to go for this.

You'll probably need an ajax call for each unchecked tag, although you might be able to get all results using one ajax call (and getting results for all tags).

---
Tags: search, solspace, supersearch, update
---


# Question
Title: How to get {channel_short_name} from Solspace Rating {exp:rating:entries}?
I'm using Solspace Rating to let users rate and review entries. I have many different channels and each channel has their own rating sub-category names saved as global variables. For example, for the channel "Venues" I have global variables like {venue\_1label}, {venue\_2label}, {venue\_3label}, {venue\_4label} for the names of the 4 rating subcategories. You can see an example of this here: http://www.weddingwise.co.nz/vendor/kumeu-valley-estate#h1-reviews. On the right side of each review there are 4 sub-ratings below the overall rating. Every channel has a different set of sub-rating labels.

These global variables use the {channel\_short\_name} of the rated entry as part of the variable name, so when I'm displaying the ratings on a single entry page I pass the {channel\_short\_name} through an embed and then use it to assemble the global variable tag name like this:

```
{exp:channel:entries status="Open|Featured"}
{embed="includes/review" entry_id="{entry_id}" channel_short_name="{channel_short_name}"}
{/exp:channel:entries}

```

And then the embed template "includes/reviews" includes pieces like this:

```
<span class="label">{{embed:channel_short_name}_1label}</span>

```

Which parses to {venue\_1label} and then is replaced by the corresponding global variable by the same name.

This all works fine. My problem is now displaying the same information on a different page.

I'm listing all Ratings by the logged in user on a user profile page. For this page the {exp:rating:entries} tag is not on a single entry page and not inside {exp:channel:entries}. So I need to use the {rating\_id} to find the matching {entry\_id} of the associated rated entry, and then use that {entry\_id} to pull {channel\_short\_name}, and then use that {channel\_short\_name} to build the global variable tag like I did above through an embed.

I can't get this to work!

I've tried using 2 levels deep of embedded templates combined with an SQL query to grab the {entry\_id}. First get {entry\_id} and pass as embed variable to first embed template. Inside first embed template use {exp:channel:entries} to get {channel\_short\_name} from {entry\_id}, then pass {channel\_short\_name} to another embed template. That second level embed template then uses {channel\_short\_name} embed variable to assemble the final global variable tag.

This works for some channel names, but for some reason other channels are not working. I can't find any different between the channels that would cause one to work and not another.

**There must be a much less convoluted way to achieve this?**

# Answer
I'm assuming the goal is to get the channel\_short\_name to use in your global variable. An SQL query might be the quicker way to get to this value, and would avoid using embeds which hinder performance.

For example, this query might help:

```
{exp:query sql="SELECT ch.channel_name AS channel_short_name
  FROM exp_ratings r
  LEFT JOIN exp_channels ch ON ch.channel_id = r.channel_id
  WHERE r.rating_id = {rating_id}"
}
    {channel_short_name}
{/exp:query}

```

Then, you can pass {channel\_short\_name} in your embed to build your global variable.
> 1 votes

---
Tags: query, solspace, solspace-rating
---


title: Error 122 from Storage Engine

text:
# Question
Title: Error 122 from Storage Engine
Getting the following error message on the front end of the sites sub pages and not the home page of the site. I have fixed it before by optimising & repairing the database but it has come up again and would like to fix it permanently. EE 2.5.2

Error Number: 1030

Got error 122 from storage engine

SELECT c.cat\_name, c.cat\_url\_title, c.cat\_id, c.cat\_image, c.cat\_description, c.parent\_id, p.cat\_id, p.entry\_id, c.group\_id , cg.field\_html\_formatting, fd.\* FROM (exp\_categories AS c, exp\_category\_posts AS p) LEFT JOIN exp\_category\_field\_data AS fd ON fd.cat\_id = c.cat\_id LEFT JOIN exp\_category\_groups AS cg ON cg.group\_id = c.group\_id WHERE c.cat\_id = p.cat\_id AND p.entry\_id IN ('17') ORDER BY c.group\_id, c.parent\_id, c.cat\_order

Filename: modules/channel/mod.channel.php

Line Number: 953

# Answer
OS error code 122: Disk quota exceeded

hence optimising and fixing before may have reduced and brought you back within limit... is this possible
> 1 votes

---
Tags: mysql
---


# Question
Title: CAPTCHA not displaying within an internal network
I have a site that contains simple captchas for a contact form and registration form. The captchas have and continue to function fine on all networks except for the internal network of the client who owns the site. I am at a bit of a loss for what could be causing this issue.

Could the issue be with the firewall? I don't see how the firewall would be blocking anything external since I don't think the captchas rely on external resources? I could be wrong about that.

The only clue I have is that the issue began after the site was migrated to another server. Any help with this would be greatly appreciated.

Using v2.3.1

```
<tr>
    <td>
       Submit the word below:<br />
       {captcha}
    </td>
    <td>
       <input type="text" name="captcha" />
    </td>
</tr>

```

# Answer
> 1 votes
Quick check - if the captcha is not displaying, and they can still submit the form... then the chances are they are logged into the backend of the EE control panel and their member group has captchas disabled.

If the captcha is not displaying, and they cannot submit the form due to captcha non entry. Then i would first suggest looking at the path for the captcha - does it use a reference different than the site, a domain that is perhaps blocked? Companies often do funny things with their own domain inhouse which could cause this kind of issue.

if not i think most people will need a lot more details. like output, online links and examples. is it definitely working, or is one or other having cache issues, etc.

---
Tags: captcha
---


# Question
Title: Creating a "testimonials" form in ExpressionEngine, no clue where to start
Creating a "testimonials" form in ExpressionEngine, NO CLUE WHERE TO START

We're using ExpressionEngine v.2.2.0, just FYI.

The boss wants me to create a textfield form (served by EE) that will collect user feed back, have the responses placed in EE's moderation queue and then when approved, have those responses integrated as blockquotes on the site as "testimonials". The idea is that we'll use good feedback to hopefully inspire others to convert.

I have NO idea where to even begin. I am totally EE illiterate and there's no one here to point me in the right direction. The developer who set up EE for our blogger and videographer moved to another part of the state two weeks ago. I've spent the entire morning trying to figure this thing out, but I'm no closer than where I was when I started.

Can someone who knows EE well please give me a little direction? :( Thanks.

# Answer
> 3 votes
First of all, you should probably talk to your boss about upgrading to the latest version of EE. 2.2.0 is quite old.

Secondly, you might want to start by reading the ExpressionEngine documentation, such as The Big Picture.

ExpressionEngine uses "channels" to store data, which are basically types of content (each with their own data structure). So in your case, you would probably create a channel called "testimonials", and give it fields such as "Author" and "Body".

You can then use the `{exp:channel:entries}` tag to pull out random testimonials in your templates. I'm going to assume you are familiar with HTML and CSS, (otherwise you are going to have a very hard time using EE).

In your templates, you would use something like this (once you have set up the channels and added some data):

```
{exp:channel:entries channel="testimonials" order="random" limit="1"}
    <h3>{testimonial_author}</h3>
    <p>{testimonial_body}</p>
{/exp:channel:entries}

```

**EDIT:** After re-reading your question, it sounds like you actually want users to submit their own testimonials. In that case, everything above still applies, but you need to use the built in SafeCracker extension to allow users to submit channel entries on the front end. An overview of how to use SafeCracker is beyond the scope of this answer, so I'll leave it to you to read the documentation and feel free to post ask a new question here if you run into any specific issues.

I'll suggest though, make sure you understand the concepts of **channels** and **entries** before you bother trying to figure out SafeCracker. Work on creating the channel and entering testimonials in the control panel, then display these on your site using the tags above. Once you have got that far, you will have a much better understanding of how to use SafeCracker.

# Answer
> 2 votes
Per Adrian's suggestion, I'll elaborate on my comment.

Entries made through the front end require Safecracker, which is a first-party module that allows you to build an entry form on the front end (i.e. the user would not need to be in the EE control panel to add a new entry to the "testimonial quotes" channel. But it's a little tricky to set up, particularly for a beginner - on the upside, it is a native EE solution.

That being said, an alternative for you to consider is a free add-on called Freeform from Solspace. Compared to Safecracker, it's probably considerably easier to implement the form on the front end, since it behaves like EE entries but actually stores the data in its own tables. The documentation is solid with plenty of examples to get you started. And it has a moderation system (using statuses) just like EE, so functionally it would allow you to do the same thing, without having to get into Safecracker.

The downside to this approach would be the flip-side of its strength - because it is not an entry in EE but rather an entry in Freeform itself, you can't easily create a relationship between an entry in Freeform and an entry in EE. SO if you have a "products" channel in EE and you want to "relate" a testimonial quote to a given product in the products channel, Freeform won't give you the ability to do this. But if you don't need something like that, and the quotes can live on their own and not have a specific relationship with individual entries in EE, then Freeform may get you most of the way there.

Updating EE will be critical to this, since the latest version of Freeform requires at least EE2.4.

# Answer
> 1 votes
When I do testimonials that are simple, I create a channel called testimonials, create 1 entry in it, with comments enabled. Then I use the comment form with that entry's ID as the "submit your testimonial" form, which allows content, name, email. This also allows you to send the site admin an email when a new one is posted, and moderate them, using the built in EE comment moderation functions. Then just use the comment entries loop to output the testimonials to the page.

---
Tags: channel-entries, categories, admin, pages
---


title: Access to EE from outside script

text:
# Question
Title: Access to EE from outside script
I found this EE Bootstrap unit: https://github.com/blocka/ExpressionEngine-Bootstrap

It "bootstraps" the EE environment, so you use the EE "super object". However, I'm running into problems trying to use it with EE 2.5.2.

I have set my system\_path as required. The script is trying to include Compat.php, which isn't in 2.5.2, so I comment out that line. The script is also trying to include Base5.php, which also is not in 2.5.2, so I comment out that line.

Now, when running, I get an exception: "Class 'Controller' not found" at this line

```
class A extends Controller {

```

Any ideas how to fix this for 2.5.2?

Here's the source code that I have:

```
<?php
if (!isset($system_path)) {
    $system_path = './na_cms/';
}

$assign_to_config['enable_query_strings'] = TRUE;
$assign_to_config['subclass_prefix'] = 'EE_';

if (realpath($system_path) !== FALSE)
{
    $system_path = realpath($system_path).'/';
}

// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';

define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('EXT', '.php');
define('APPPATH', $system_path.'expressionengine/');
define('FCPATH', str_replace(SELF, '', __FILE__));
define('SYSDIR', trim(strrchr(trim(str_replace("\\", "/", $system_path), '/'), '/'), '/'));
if(!defined('UTF8_ENABLED')) define('UTF8_ENABLED', false);
if(!defined('CI_VERSION')) define('CI_VERSION', '2.0.1');
//define('AJAX_REQUEST',false);
define('DEBUG',false);

require(BASEPATH.'core/Common'.EXT);
// require(BASEPATH.'core/Compat'.EXT);
require(APPPATH.'config/constants'.EXT);

$CFG =& load_class('Config', 'core');
$URI =& load_class('URI', 'core');
$IN =& load_class('Input', 'core');
$OUT =& load_class('Output', 'core');
$LANG =& load_class('Lang', 'core');
// require(BASEPATH.'core/Base5'.EXT);

$loader = load_class('Loader', 'core');

// Load the base controller class
require BASEPATH.'core/Controller'.EXT;

class A extends Controller {

}

$EE = new A;
$EE->core->_initialize_core();

```

# Answer
Actually, I found a fork that supports EE2.5.2: https://github.com/rsanchez/ExpressionEngine-Bootstrap I am leaving this question for reference and will accept my own answer when avail.

```
<?php
if (!isset($system_path)) {
    $system_path = './na_cms/';
}

$assign_to_config['enable_query_strings'] = TRUE;
$assign_to_config['subclass_prefix'] = 'EE_';

if (realpath($system_path) !== FALSE)
{
    $system_path = realpath($system_path).'/';
}

// ensure there's a trailing slash
$system_path = rtrim($system_path, '/').'/';

define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
define('EXT', '.php');
if(!defined('BASEPATH')) define('BASEPATH', str_replace("\\", "/", $system_path.'codeigniter/system/'));
define('APPPATH', $system_path.'expressionengine/');
define('FCPATH', str_replace(SELF, '', __FILE__));
define('SYSDIR', trim(strrchr(trim(str_replace("\\", "/", $system_path), '/'), '/'), '/'));
if(!defined('UTF8_ENABLED')) define('UTF8_ENABLED', false);
if(!defined('CI_VERSION')) define('CI_VERSION', '2.0.1');
//define('AJAX_REQUEST',false);
define('DEBUG',false);

require BASEPATH.'core/Common'.EXT;
require APPPATH.'config/constants'.EXT;

$CFG =& load_class('Config', 'core');
$URI =& load_class('URI', 'core');
$IN =& load_class('Input', 'core');
$OUT =& load_class('Output', 'core');
$LANG =& load_class('Lang', 'core');
$SEC =& load_class('Security', 'core');

$loader = load_class('Loader', 'core');

// Load the base controller class
require BASEPATH.'core/Controller'.EXT;

function &get_instance()
{
    return CI_Controller::get_instance();
}

class EE_Bootstrap extends CI_Controller {}

$EE = new EE_Bootstrap;

```
> 1 votes

---
Tags: ee2, bootstrap
---


# Question
Title: Install multiple versions of ExpressionEngine plugin Store
Would it be possible to install multiple versions of an ExpressionEngine plugin (i.e. Store)?

My clients ideally would like two very separate shops on both frontend and backend. Obviously Store could be configured to act as separate shops on the frontend, however all the orders will appear in the same place on the backend etc.

Thanks, Dan

# Answer
I'd probably look at setting up MSM (Multiple Site Manager). If you're not familiar, its an EE 1st Party addon that lets you have one install of EE on different URLs. So you could set it up so you had a sub-domain as the 'backend' cart system and then just secure it so only your client can get in if needs be. The front end would be as normal.

I would also suggest looking into Cartthrob for this - The support is a bit pants at the moment with CT, but you have so much more flexibility. I love store, but I set up three shops in the manner for a client not so long ago, I went down the route of Store and hit a few brick walls.

CT takes longer to set up as you have an insane amount of control over what is happening. For example I set up the three stores using MSM and then had one category section for each site. This way the client can control what products are in what category and therefore what site they show on. Not only that, but you could also have different prices if you so wished. I believe this isn't possible with Store at the moment, but I could be wrong.

Overall, you could do it with Store and I'd just look into MSM from EllisLab. However, for this project, I'd strongly advise you take a good look at CT - Although it is a lot more expensive, there is more control for those - 'Can we do this' moments the client will no doubt throw at you in the future.
> 1 votes

# Answer
what would '2 very separate shops' be? I'd probably go down the route of running a sub-domain and keep the 2 product groups in 2 different channels or, alternatively, in 1 channel with a custom field for what shop the product belongs to (probably a checkbox as a product may belong to 2 shops).
> 0 votes

# Answer
You could also run one instance of store and then create multiple store sections with different categories, possibly each with its own subdomain. In this way there is only one financial connection but many potential store fronts.
> 0 votes

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


title: paginate not displaying next enties

text:
# Question
Title: paginate not displaying next enties
I am having and issue with pagination. I have 8 entries and displaying 4 per page. Because of the layout I cannot include the pagination in the first channel entries tag that displays the entries so I need to add a second channel entries tag just for the pagination. Problem is when I click the next page and display the next 4 entries I still get the same first 4 entries.

```
<div class="blog">
        <h4 class="heading colr">Messages</h4>
        <ul>
{exp:channel:entries channel="messages" limit="4" dynamic="yes" disable="categories|member_data|category_fields"}

            <li>
                <p class="date">{entry_date format="%M"}<br />{entry_date format="%d"}</p>
                <h2 class="colr">{title}</h2>
                <div class="clear"></div>
                <div class="cont">

                </div>
                <div class="clear"></div>
                <div class="blog_links">

                    <p class="postedby">Speaker: {speaker}</p>
                </div>
            </li>
{/exp:channel:entries}

                     </ul>
    </div>

{exp:channel:entries channel="messages" limit="4" disable="categories|member_data|category_fields" paginate="bottom"}
    {paginate}
        {pagination_links}
    <ul>
            {first_page}
                    <li><a href="{pagination_url}" class="page-first">First Page</a></li>
            {/first_page}

            {previous_page}
                    <li><a href="{pagination_url}" class="page-previous"><</a></li>
            {/previous_page}

            {page}
                    <li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
            {/page}

            {next_page}
                    <li><a href="{pagination_url}" class="page-next">></a></li>
            {/next_page}

            {last_page}
                    <li><a href="{pagination_url}" class="page-last">Last Page</a></li>
            {/last_page}
    </ul>
        {/pagination_links}
    {/paginate}
{/exp:channel:entries}

```

# Answer
Won't work because the channel:entries tag relies on the paginate parameter. If you don't include it EE won't read the pagination segment in the URL, so won't know you're on the second page of a paginated list.

Assuming the issue is your markup and you only want to close the list markup before you open the pagination elements markup, try this:

```
<div class="blog">
  <h4 class="heading colr">Messages</h4>
  <ul>
    {exp:channel:entries channel="messages" limit="4" dynamic="yes" paginate="bottom" disable="categories|member_data|category_fields"}

      <li>
        <p class="date">{entry_date format="%M"}<br />{entry_date format="%d"}</p>
        <h2 class="colr">{title}</h2>
        <div class="clear"></div>
        <div class="cont"></div>
        <div class="clear"></div>
        <div class="blog_links">
            <p class="postedby">Speaker: {speaker}</p>
        </div>
      </li>
    {if count == total_results}
  </ul>
</div>
    {/if}

{paginate}
  {pagination_links}
  <ul>
    {first_page}
      <li><a href="{pagination_url}" class="page-first">First Page</a></li>
    {/first_page}
    {previous_page}
      <li><a href="{pagination_url}" class="page-previous"><</a></li>
    {/previous_page}
    {page}
      <li><a href="{pagination_url}" class="page-{pagination_page_number} {if current_page}active{/if}">{pagination_page_number}</a></li>
    {/page}
    {next_page}
      <li><a href="{pagination_url}" class="page-next">></a></li>
    {/next_page}
    {last_page}
      <li><a href="{pagination_url}" class="page-last">Last Page</a></li>
    {/last_page}
  </ul>
  {/pagination_links}
{/paginate}
{/exp:channel:entries}

```

Note the:

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

```
> 0 votes

---
Tags: pagination
---


# Question
Title: SQL to get entry_id in exp_channel_data based on member_id
I have custom channel named `foo` that is connected to the the members via safecracker and safecracker registration.

In a hook I am making, the member\_id of a person is available to me.

Is there a way using SQL to get the entry\_id in `channel_data` table based on the member\_id that I have?

# Answer
> 2 votes
```
SELECT ct.entry_id
FROM exp_channel_titles AS ct
LEFT JOIN exp_channel_data cd ON ct.entry_id = cd.entry_id
WHERE ct.author_id = $member_id

```

Although you've requested the entry\_id in your question, you don't actually need to include channel\_data, as it's in channel\_titles. But I've included above in case you want to pull all the entry data (so change `SELECT ct.entry_id` to `SELECT *`)

$member\_id in the above would be variable you're searching on.

---
Tags: safecracker, sql
---