# Question
Title: How do I include a Grid field in Channel Form
I have a channel form with a lot of fields, so many in fact, I am about to max out the field group's limit. I would like to use the Grid field to reduce the actual number of custom fields in the group.

Here is the current code I am using to capture input on the form:

```
{exp:channel:form channel="name" class="order" return="liners/confirmation" }
<table class="fourteen-col">
    <tbody>
    <tr>
        <td class="plant_name">Azalea Native</td>
        <td>$2.25</td>
        <td>$2.00</td>
        <td>$1.75</td>
        <td>$1.50</td>
        <td>$0.70</td>
        <td>$0.85</td>
        <td>$1.00</td>
        <td><input type="text" name="az_native_1g_spr" value=""/></td>
        <td><input type="text" name="az_native_2g_spr" value=""/></td>
        <td><input type="text" name="az_native_series_3g_spr" value=""/></td>
        <td><input type="text" name="az_native_series_1g_fall" value=""/></td>
        <td><input type="text" name="az_native_series_2g_fall" value=""/></td>
        <td><input type="text" name="az_native_series_3g_fall" value=""/></td>
    </tr>

</tbody>
</table>
<input type="submit" name="submit" value="Submit">
{/exp:channel:form}

```

I just need some guidance on how to integrate the Grid field values which are like this:

Grid field name: grid\_name

Grid column names: 1\_gal\_spr, 2\_gal\_spr, 3\_gal\_spr, 1\_gal\_fall, 2\_gal\_fall, 3\_gal\_fall

I would normally use {grid\_name:1\_gal\_spr} to reference that information, but when I include the curly brackets in the form it throws an error.

What is the correct way to do this?

# Answer
This looks to be a duplicate of this : Adding New Grid Entries With Channel:Form

Also, someone else has asked a virtually identical question just now here : Add New Grid Rows via Channel Form

(you can use the same logic while switching Matrix with Grid, Or Channel form with SafeCracker Form)

Check out that question and my answer, it basically deals with what you're asking.

In short what you need to do is make sure you have the previously set rows in the Channel form as hidden elements. When you sumbit the channel entry form it takes your grid/matrix values in their entirety and saved them as the field value, it does not append them. So as you see, you will need to add the existing values to the form, then add your new values, and submit the whole lot!

There is also a simplier way, you can usethe `field` tag syntax to get the matrix onto your form. See this post (which I based my previous answers on) : How to work with the new channel forms and the new grid fieldtype ( and updateing it)

Basically use `{field:your_grid_fieldname}`...
> 0 votes

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


# Question
Title: Issuing Partial Refunds in Expresso Store
I need to be able to refund single items from orders containing multiple items. Currently, I can delete a unwanted item from an order, but my only option for returning funds to the customer appears to be refunding the entire order and then creating a new payment for the new amount owing.

Is there another way to accomplish this?

# Answer
There is not a way to do it from the Store CP; depending on what payment gateway you are using I have found that it is usually easier to do it from the payment gateway actual account portal.
> 0 votes

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


# Question
Title: Solspace: User - Total Entries showing as 0 for user
I am running Solspace User 3.5.3 on EE 2.9.2 and have a discrepancy with the total number of entries shown for a user.

When I am logged in as admin for the site and I go to my profile in user\_main, it says I have a total of 0 entries. However it also has a link to the page that displays all my entries and there are 19 pages worth of entries.

The code for this section is:

```
<li class="list-group-item">
<strong>Total Entries:</strong>
{if last_entry_date == "0"}
This user has not published any entries yet.
{if:else}
{total_entries}   <i>(last published: {last_entry_date format="%F %j, %Y"})</i>
{/if}
  <a href="{path='user_main/user_entries'}/{member_id}/">view all →</a>
</li>

```

The same problem is evident on the user\_entries page where despite the fact that there are 19 pages of entries, the total\_count shows as 0.

The code:

```
<h2 style="margin-bottom:20px;">{exp:user:stats member_id="{segment_3}" limit="1"}{if logged_in_member_id == "{segment_3}"}My{if:else}{screen_name}'s{/if} Entries <span class="label label-warning">{total_entries}{/exp:user:stats}</span></h2>

```

Clearly {total\_entries} is having a bad day.

# Answer
There must have been some sort of issue with EE's stats being up to date for channel entry data. I ran the recount stats utility on your site and the numbers seem to be correct now. :)
> 0 votes

---
Tags: solspace-user
---


# Question
Title: Trying to post through Channel form anonymously - "The provided member id to use for guest submissions is invalid."
I'm trying to get Channel From working with non logged in users. Unfortunately with no success. I have

```
{exp:channel:form channel="calendar_events" return="site/index" logged_out_member_id="3"}

```

When I try this logged in - it works. When I'm logged out - it says

> The provided member id to use for guest submissions is invalid.

Does anybody experienced these problems with channel form and anonymously posting en entry?

p.s. I allowed the Guest submission in the CP admin -\> Channel Form page.

# Answer
In addition to this I beleive you have to allow the group access to the specific channel you want them to post too. I just tested this on my sandbox...

So after you've done your thing in `Admin > Channel Administration > Channel Form`, head over to `Members > Member Groups`, click 'edit group' for the Guests Row, scroll down to the "Channel Assignment" section (quite near the bottom) and for the channel they are posting to select 'Yes'.

I beleive this should get you rocking, let us know if there's any more issue!
> 2 votes

---
Tags: safecracker
---


# Question
Title: Is there a way to configure a custom separator for channel field checkboxes?
I am working with a template where items are filtered by their checkbox values. The each item can have multiple checkbox values, and when they are selected the checkbox values are separated with a comma.

example: The template looks like this:

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

When multiple checkboxes are selected it looks like this:

`<div class="value1, value2, value3></div>`

I am using the isotope (http://isotope.metafizzy.co/) plugin to filter and sort my website values but isotope won't read the values with a comma after them. In the example above the only filter my filter function would read would be value3 (because it doesn't have a comma after it). Is there a way to customize the checkbox separator from a comma to a space? Or is there a different channel field that is better suited for something like this?

**edit:** This problem has been solved by adding some PHP to the replace the commas in the string of the class.

example:

```
<div class="<?php echo str_replace(",","","{checkbox_values}") ?>"></div>

```

# Answer
YOu could simply strip the commas, as there's spaces in there already...

You can use a 3rd party plugin like String Replace Exp which is free :

```
<div class="{exp:strrexp pattern="," replace="" string="{checkbox_values}" }"></div>

```

Or you could drop a simple piece of PHP on the page like so

```
<div class="<?php echo str_replace(",","","{checkbox_values}") ?>"></div>

```

(**PHP** on **Output**)
> 1 votes

---
Tags: templates, html, channel-fields, checkbox
---


# Question
Title: CE Cache not working with ExpressionEngine v2.8 Template Layouts - any workarounds?
Just starting to setup a new project, and using ExpressionEngine v2.8.x with its new Template Layouts functions. Problem is that if I have the CE Cache tags in the setup, and have set to dummy while I'm developing, it will break the Template {layout} tags.

Here's the template code with CE Cache that breaks:

```
{layout="_layouts/base" title="The Title"}

{exp:ce_cache:it id="page-home" tag="home" seconds="14400"}

{exp:channel:entries channel="site_content" limit="1"}

    <h1>{title}</h1>

    {cf_content_body}

    {layout:set name="page_title"}
        {title}
    {/layout:set}
    {layout:set name="page_description"}
        {cf_content_summary}
    {/layout:set}

{/exp:channel:entries}

{/exp:ce_cache:it}

```

And here's the same code without CE Cache that does work: {layout="\_layouts/base" title="The Title"}

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

    <h1>{title}</h1>

    {cf_content_body}

    {layout:set name="page_title"}
        {title}
    {/layout:set}
    {layout:set name="page_description"}
        {cf_content_summary}
    {/layout:set}

{/exp:channel:entries}

```

If anyone has any kind of solution, I'm up for it or at the least some acknowledgement that it's a known problem and it's being worked on in the devotee thread that starting back in March 2014 (http://devot-ee.com/add-ons/support/ce-cache/viewthread/12978).

Thanks Brendan

# Answer
> 1 votes
I've run into this before as well. The issue is that the layout:set action doesnt occur when the cached content is retrieved, so the parent layout has no way to know what it's contents should be. Have you tried escaping the layout:set part from the cacheing? That may or may not work. Worst case, and the route that I ended up taking is to just use native tag cacheing when layout was being set. It's not ideal, but latest EE at least gives us a Redis driver for the native cache.

# Answer
> 1 votes
This has also been asked on the official support forum here: https://devot-ee.com/add-ons/support/ce-cache/viewthread/14051.

This comment: https://devot-ee.com/add-ons/support/ce-cache/viewthread/14051#49482 also provides a way of caching the layouts although I'm pretty sure it won't address your layout:set issue.

---
Tags: ce-cache, template-layouts
---


# Question
Title: Exclude category group from category_archive
I have the following code below. Trying to show categories from one category group, but instead all categories are being outputted. I've tried using `category_group="1"`, but no luck. Any help is much appreciated.

```
{exp:channel:category_archive channel="speakers" style="linear" backspace="7" category_group="1"}
    <li>
        {categories}
            <a class="btn-open" href="#">{category_name}</a>
        {/categories}
        {entry_titles}
        <ul class="list-unstyled">
            <li><a href="{path='site/speaker'}">{title}</a></li>
        </ul>
        {/entry_titles}
    </li>
{/exp:channel:category_archive}

```

# Answer
This doesn't seem to be an option.

https://ellislab.com/expressionengine/user-guide/add-ons/channel/category\_archive.html

I curled and searched that page and found zero references to "Category Group" (case insensitive search). How dynamic is that group? Can you use the `show` parameter and list the categories you want to show?

```
{exp:channel:category_archive channel="speakers" style="linear" backspace="7" show="1|3|5|7|9|666"}
<li>
    {categories}
        <a class="btn-open" href="#">{category_name}</a>
    {/categories}
    {entry_titles}
    <ul class="list-unstyled">
        <li><a href="{path='site/speaker'}">{title}</a></li>
    </ul>
    {/entry_titles}
</li>
{/exp:channel:category_archive}

```

I know that is a pain, but sometimes we must develop and play the maintenance game.

**Edit** Thanks for giving me the check; but I'm an idiot and just thought of a much better potential answer!

https://ellislab.com/expressionengine/user-guide/add-ons/channel/categories.html#variables

Try this parameter! (assuming your cat group is 1):

```
show="{exp:channel:categories category_group='1'}{category_id}|{/exp:channel:categories}"

```
> 1 votes

---
Tags: categories, category-group, category-archive
---


# Question
Title: Textarea (Rich Text) stripping html/form (paypal donate code)
The field strips the 'form/action' tags that are used for the Paypal link/button. Because of this the button is not a clicking link. Is there any way i can prevent this?

```
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank"><input name="cmd" value="_xclick" type="hidden"><input name="business" value="my@email.com" type="hidden"><input name="item_name" type="hidden"><input name="currency_code" value="USD" type="hidden"><input name="amount" type="hidden"><input src="/images/paypal.jpg" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" type="image"></form>

```

# Answer
I've tested this in 2.9.0 and could only recreate a edit\_entry issue.

You have to click on the "View Code" button before pasting in a form in a Rich Textarea. This will work, and the form should populate when the entry is display in a template. However, when you go edit that entry, the form tag will be stripped out. Can you verify you are also having this issue?

Also, I heartily suggest getting WYGWAM.

https://devot-ee.com/add-ons/wygwam

It's $29 bucks, I've used it to paste forms/all sorts of HTML code into an enhanced Textarea. Just make your employer buy it for you (I am in no way associated with WYGWAM and make no money from that Addon \[well, except for doing a good job at my regular engineering job, which pays me\]).
> 0 votes

---
Tags: richtext, textarea
---


title: Resource Router for Markets

text:
# Question
Title: Resource Router for Markets
I'm building a site that has 20 city markets using a Markets Channel. Each market will have it's own version of a page, so austin/store, nyc/store, austin/about, nyc/about, etc.

I also have a National market that is the catch all version of a page that does not have a market in the first segment, so /store, /about, etc.

The thing is that if we're using the National market channel to display a page I don't want that segment in the URL. It should not be national/store, national/about. A visitor should never see a market in the URL unless it's on a proper market like austin or nyc.

My question is, can I use resource router to accomplish something like this and how would I go about setting it up so I don't have to create two versions of a route, one for national and one for proper markets? And then on top of that only displaying segment\_1 if it's a market besides national.

# Answer
I can't tell you how Resource Router can do this, but I *can* tell you how standard Template Routes can do this.

Make templates or template groups for `/store`, `/about`, etc. (Doesn't really matter where they are or what they're named, since you'll be adding routes to them anyway.)

Then add a route for each of those templates like so:

`store/{market:alpha}`

`about/market:alpha}`

Etc.

Leave *Segments Required* set to "No".

Then in your template, use the `channel:entries` tag like so:

```
{exp:channel:entries channel="markets" {if segment:market}url_title="{segment:market}"{if:else}url_title="national"{/if} dynamic="no" limit="1" require_entry="yes"}

```

Does that do the trick?
> 1 votes

---
Tags: resource-router
---


# Question
Title: Mass find-and-replace URLs in rich text fields
I have a number of EE rich text fields for a bunch of entries with inline images that have been uploaded. I'm noticing that the HTML image tags this generates is including the full, absolute image URL with a domain, e.g. http://www.cool.pizza/assets/img/etc.jpg instead of just /assets/img/etc.jpg. We are switching subdomains soon, however. Is there any way to do a mass text replace on these fields to remove the "http://www.cool.pizza" from image URLs?

# Answer
There's a tool for this kind of task on the Control Panel -\> Tools -\> Data -\> Search and Replace.

Just look for `http://www.cool.pizza/assets/img/` and replace it by `/assets/img/`.
> 1 votes

# Answer
MySQL to the rescue!!

```
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');

```

You need to use this command to do exactly what you want. You're will look like this (this is an example, DON'T RUN THIS COMMAND):

```
UPDATE channel_data SET field_id_25 = replace(field_id_25, 'bad_url.com', 'good_url.com');

```

It might be the channel\_entries table that has the data, I can't remember. Also, you need to figure out which field your's is, it's not going to be field\_id\_25. As always, you **must** back up this database table before you try anything, or you'll be sorry. But this will do a complete find and replace on your field's column. To figure what your field ID is, you need to go to your channel field's field group. You'll find the field ID on this page:

`Your site -> CP Home -> Administration -> Channel Fields -> Group: Your Field Group`
> 0 votes

---
Tags: url, richtext, image-path
---


# Question
Title: Submit Video URL no longer working in Channel Videos
My clients site has been using Channel Videos module for a couple years. Recently the 'Submit Video URL' for YouTube has stopped working, you enter a URL click OK, but nothing happens. Searching for them by Keyword still works, and both functions still work for Vimeo. I have tried to update to the latest version (3.2.0A) as noticed in the Change Log it adds support for Youtube v3 API. (Which I figured could have been the problem) But when I try and update the module as described in the documentation I get a syntax error on the site –

> Parse error: syntax error, unexpected ':' in /home/sites/domain.com/public\_html/system/expressionengine/third\_party/channel\_videos/ft.channel\_videos.php on line 293

and have had to revert back to the previously installed version. Can anyone offer any help? Thanks in advance.

# Answer
> 0 votes
I removed the offending

> ? :1

from line 293 and line 342 in ft.channel\_videos.php. This stopped the error and the plug-in now works. I guess it might have lost functionality connected to 'video\_views' but the main purpose that it was being used is now working.

---
Tags: module, devdemon, channel-videos, syntax
---


# Question
Title: Template won't embed on one entry page but fine on everything else
I'm trying to add my embedded contact form template to one page for a blog entry. I've never had an issue with this template or embedding it until now.

Here is my code.

```
{embed="inc/html_header" page_title="{page_title} - {site_name}"
      page_description="{meta-description}"}
<div class="blog-page entry-main">
    {embed="inc/nav"}

    {embed="blog/listing"}
</div>

{embed="contact/form"}
 <!--Hey footer footer-->
{embed="inc/html_footer"}

```

So the embedded html\_footer appears on the entry template page just fine along with my random Hey footer comment. In fact, everything on this page displays correctly except for **{embed="contact/form"}**.

I've done so many things to try and fix this -- use snippets for the form, use conditionals to check for segment\_3, etc, but still no success. The pages I'm trying to display have the root structure of:
/blog/entry/the-entry-post-title-whatever-user-enters

When I navigate to just /blog/entry/index.php. I see the footer, but also every single blog entry and the html header and footer embedded templates.

Any thoughts? I'm nearly going insane over this and even had a nightmare where I spent a day trying to figure this out. Dreams are not meant to infested with EE code. Thanks.

# Answer
> -1 votes
I feel dumb -- all I needed to do was add dynamic="no" to my form template channel entries tag. Lesson learned

---
Tags: templates, solspace-freeform, embeds, entry
---


title: Expresso Store stripe not submitting

text:
# Question
Title: Expresso Store stripe not submitting
Weird one, Expresso+Stripe usually works but in this one case it won't!

The payment\_token is being generated (after 1-2 second delay) but the form isn't submitting after that.

Jquery is included ok, here's my template (just the important bits, all else is generic stuff)

```
<p>
<select name="payment_method">
<option value="">Please select</option>
<option value="Stripe">Credit/Debit card</option>
<option value="PayPal_Express">Paypal</option>
</select>
</p>

{!-- STRIPE FORM --}
<input type="text" id="payment_token" name="payment[token]" value="">
<dl>
<dt><label for="s1">Name on card</label></dt>
<dd><input type="text" id="s1" data-stripe="name"></dd>
<dt><label for="s2">Card number</label></dt>
<dd><input type="text" id="s2" data-stripe="number"></dd>
<dt><label for="s3">Expiration month</label></dt>
<dd>
    <select id="s3" data-stripe="exp-month">
    <option value=""></option>
    {exp_month_options}
    </select>
</dd>
<dt><label for="s4">Expiration year</label></dt>
<dd>
    <select id="s4" data-stripe="exp-year">
    <option value=""></option>
    {exp_year_options}
    </select>
</dd>
<dt><label for="s5">CVV</label></dt>
<dd><input type="text" id="s6" size="4" data-stripe="cvc" /></dd>
</dl>

<script>
$(function() {
    $.getScript('https://js.stripe.com/v2/', function() {
        Stripe.setPublishableKey('pk_test_REMOVED');
    });
    /* Ensure your checkout submit button has id="checkout_submit" */
    $checkout_submit = $("#checkout_submit").click(function() {
        /* Only handle requests for Stripe gateway */
        if (this.form.elements["payment_method"].value == "Stripe") {
            /* Temporarily disable the checkout submit button */
            $checkout_submit.attr('disabled', true);
            /* Create a Stripe card token */
            Stripe.card.createToken($(this.form), stripeResponseHandler);
            /* We don't want to submit the form yet */
            return false;
        }
    });
    /* This function is triggered once Stripe has generated the token */
    function stripeResponseHandler(status, response) {
        /* Re-enable the checkout submit button */
        $checkout_submit.attr('disabled', false);
        /* Check whether we have a valid credit card */
        if (response.error) {
            alert(response.error.message);
        } else {
            /* Set the card token and submit the checkout form */
            $("#payment_token").val(response.id);
            $checkout_submit.off("click").click();
        }
    }
});
</script>

<p class="checkout-next">
    <input type="submit" id="checkout_submit" name="submit" class="btn btn-pri btn-m" value="Place order">
</p>

```

Can't for the life of me see where its failing, no JS errors. Anyone have any idea?s

# Answer
> 1 votes
I just battled this for half a day myself with Store and Stripe , and the issue ended up being with forms not being able to submit via javascript when there is any element inside the form named `submit`.

This is tricky since originally, Store required that you have an input named `submit` to complete the checkout process. They did add the ability to use `commit` instead though as of version 1.3.

In my testing, naming the submit input - or button - with `commit` still didn't work (it was submitting as an empty value, which Store didn't detect), so I simply added a hidden input instead.

```
<input type="hidden" name="commit" value="y" />

```

Then made sure I left by submission button unnamed:

```
<button type="submit">Submit Payment</button>

```

(One note as well: I opted to use Stripe's javascript template \- which uses `data-stripe` attributes - as a starting point, as it's much more up-to-date.)

---
Tags: expresso-store, stripe
---


# Question
Title: Wrap label tags around Checkboxes and Radio buttons
Is there a way to wrap label tags around radio and checkbox buttons. I am trying to use bootstrap inline form to make it look better but I can't find a good way to handle it.

```
{freeform:field:field_1 backspace="2" wrapper_open=""
wrapper_close=""
row_wrapper_open=""
row_wrapper_close="
input_wrapper_close=""
label_wrapper_open="<label class='radio-inline'>"
label_wrapper_close="</label>"}

```

The above code is an example of some of the ways I tried to handle this. but this gives me a clickable label tag that doesn't select anything.

```
<label>
    <input type="radio" name="field_1"> Field 1
</label>

```

Is the result I would like.

# Answer
> 0 votes
? You can just construct your own form, you don't need to use tags with FreeForm.

```
{exp:freeform:form form_name="contact" return="freeform-return/%%entry_id%%"}

<label for="first_name">
    Name
    <input type="text" name="name">
</label>

<label for="submit">
    Submit
    <input type="submit" name="submit">
</label>

{/exp:freeform:form}

```

This creates a valid form that submits to FreeForm and returns you to url-root.com/freeform-return/666.

**Edit** if that is the case (responding to your comment), why don't you use the fields as variable pairs?

https://solspace.com/docs/freeform/form/#variable\_pairs

From the docs:

```
{freeform:all_form_fields}
<p>
    <label>{freeform:field_label}</label>
    {freeform:field_output}
    {if freeform:field_type == 'text'}hello!{/if}
</p>
{/freeform:all_form_fields}

```

Will this magic work for the solution you want?

---
Tags: solspace-freeform
---


# Question
Title: How to get Low Search results based on the category of a related item?
I have doctor channel and a locations channel. Each doctor has one or more related locations. Each location has one or more categories assigned.

For example, Location1 has Region1 and Region2 categories assigned to it, and Location1 is related to Doctor1.

Is there a way to return a list of Doctor search results with doctors who work in Region1?

# Answer
> 1 votes
Low Search cannot do this out of the box, but you can achieve it with either a custom filter or an extension.

For example, if you use the low\_search\_pre\_search hook, you can read the Region category, query the database for Location entries, and assign those entries to a Relationships filter parameter.

Note that I could create the extension (or custom filter) for you, for a fee. Just drop me a note if you're interested in that.

---
Tags: relationships, low-search
---


title: Entries in a category not looping

text:
# Question
Title: Entries in a category not looping
This is my code:

```
{exp:channel:categories channel="products_insurance" style="linear"}
                <li data-submenu-id="submenu-{category_name}">
                    <a href="{path='borrow/#filter={category_url_title}'}">{category_name}</a>
                        <ul class="submenu">
                            {exp:channel:entries category="{category_id}"}
                            <li><a href="{url}">{title}</a></li>
                            {/exp:channel:entries}

                         </ul>
                 </li>
{/exp:channel:categories}

```

this part though:

```
{exp:channel:entries category="{category_id}"}
<li><a href="{url}">{title}</a></li>
{/exp:channel:entries}

```

is not looping, it's only showing the entries for the first category.

This is for a custom dropdown menu I'm working on.

Any ideas why it's not looping? From what I can tell it should be.

# Answer
As JChrono asks, please verify the outer categories loop is putting all relivent ID's out.

Further still, to avoid any unwanted URL interference add the `dynamic` tag to your channel entries loop, also try forcing the parse order with `parse="inward"` on the categories loop, like so :

```
{exp:channel:categories channel="products_insurance" style="linear" parse="inward"}
  <li data-submenu-id="submenu-{category_name}">
    <a href="{path='borrow/#filter={category_url_title}'}">{category_name}</a>
      <ul class="submenu">
        {exp:channel:entries category="{category_id}" dynamic="no"}
                        <li><a href="{url}">{title}</a></li>
        {/exp:channel:entries}
      </ul>
   </li>
{/exp:channel:categories}

```

Just a couple of simple things to try first, let us know if we need to get more in depth on this.
> 0 votes

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


title: Image Path Not Resolved

text:
# Question
Title: Image Path Not Resolved
I'm transferring my site to a different server. I'm building out a microsite on Expression Engine 1.6.8. The issue is the image path is not resolved using the Image Sizer plugin. Here is an example of a tag:

```
<a href="{global_url}tour/"><h2>{title}</h2>
<img src="{master_site}{exp:imgsizer:size src="{small_img}"
justurl="yes" width="249" alt=""}" width="249" alt="gator image" class="gator" /></a>

```

What happens is the master\_site global variable works, but no path is added for Image Sizer. So the resulting tag is:

```
<img src="http://www.example.com" width="249" alt="gator image" class="gator">

```

# Answer
> 0 votes
Did you say you're using imagesizer??

Check the permissions and ownership fo the folders where imagesizer is putting its cache. I'll bet its not writable, or owned by someone other than the web executing user (and thus it can not create its directories). Error Reporting can stop the errors appearing properly.

Apart from this, sort those quotes out, as you never know PHP's magic quote settings might have changed or it may be reading differently, like so :

```
<a href="{global_url}tour/">
  <h2>{title}</h2>
  <img src='
    {master_site}
    {exp:imgsizer:size src="{small_img}" justurl="yes" width="249" alt=""}
    ' width="249" alt="Assisted Living Facilities Buffalo Grove - Take a tour" class="lifestyle" />
</a>

```

And lastly, jsut output hte path instead of obfuscating it inside the `img` tag. Like so :

```
<a href="{global_url}tour/">
    {exp:imgsizer:size src="{small_img}" justurl="yes" width="249" alt=""}
</a>

```

This last test will tell you if its a problem with the images (resizing, mkdir, mv file ect) or with the path itself. i.e. if the path looks good but there's no image on the filesystem this screams write permissions or ownership, if the path is blank but there's a file there its a problem somewhere inside imgsizer. Let us know whats happening, specifically if the images are being created in the right place and if the paths coming out right.

Some last things to check, since the server move has the server path to your root directory changed? i.e. was it `/home/mysite/public_html` and now its `/var/www/vhosts/mysite/htdocs` ? If the answer is Yes, please double check your paths in Content \> Files \> File Upload Preferences, as these may not have updated...

Also, you have got GD lib installed and activated in PHP/Apache right? without it imgsizer won't be doing no resizing!!!!

Let us know how you fare!!!

---
Tags: plugin, image
---


title: Grid/Matrix in Content Elements

text:
# Question
Title: Grid/Matrix in Content Elements
I doubt I'm the first person to request this, but it seems such an obvious requirement I can't believe it's not been done as yet. I'm looking at Content Elements, or Blocks I want to be able to place a grid (or matrix) within either of these systems, but I can't seem to find a solution that allows this? Is it simply impossible or has no one else had the requirement? seems kind of an obvious requirement and would mean that these block builders offer the full flexibility that I need.

Please note blocks allows Nolan to be used inside it, however this isn't as flexible or user-friendly as I require.

Thanks

Dave

# Answer
> 0 votes
You may find yourself hard up here, as from my first glance neither of these modules support native field types, instead supplying their own.

Personally I develop blocks and block embedding systems by hand depending on the client requirement, then to populate these blocks I might use Low:Variables (which does support Grid, Matrix, P&T fields, anything!) to define the variables for that block.

If its a template and you may have many blocks of the type, why not drive the blocks off a channel field?

Just some ideas for you as you haven't had an answer yet...

---
Tags: grid, content, blocks
---


# Question
Title: Exp:resso Store and Authorize.net auth only?
Is there any way to run x\_type "AUTH\_ONLY" transactions from Exp:resso Store using Athorize.net AIM?

Reference link to Authorize.net x\_type: http://developer.authorize.net/guides/AIM/wwhelp/wwhimpl/js/html/wwhelp.htm#href=3\_TransDataReqs.06.3.html

Reference link to Authorize.net AUTH\_ONLY transaction: https://support.authorize.net/authkb/index?page=content&id=A64

# Answer
> 0 votes
You can do this by navigating to Store \> Settings \> General \> Credit Card Payment Method and selecting *Authorize Only* from the select box.

> If set to Authorize Only, you will need to manually capture payments before the funds will be transferred to your account.

This is however not gateway specific if you have multiple payment gateways in your store they will all be set to only authorize the transaction.

---
Tags: expresso-store
---


# Question
Title: Include Issue Calling an External PHP Script from Expression Engine
I'm trying to call an external PHP script from an Expression Engine form response template that sends emails using Mandrill API. The script I have works on regular PHP, I have tested it, but there is some sort of issue with the path for the includes. I've double checked the absolute paths and they are correct. Anyone see an issue?

```
require_once '/www/host/public_html/mandrill-api-php/Mandrill.php';
require_once '/www/host/public_html/mandrill-api-php/madrillSend.php';

$msg = "TEST MESSAGE";

$location = "{location}";
$ebrochure = "{ebrochure}";

$output = SendMandrill($location, $msg, $ebrochure);

echo $output;

```

=================================================

```
function SendMandrill($location, $msg, $ebrochure) {

    $mandrill = new Mandrill('xxx');
    $message = array(
        'html' => null,
        'text' => $msg,
        'subject' => $subj,
        'from_email' => 'leads@yourdomain.com',
        'from_name' => 'Leads Account',
        'to' => array('email' => 'jon@otherdomain.com', 'type' => 'to),
        'headers' => array('Reply-To' => 'leads@yourdomain.com'),
        'important' => false,
    );

    $async = false;
    $ip_pool = 'Main Pool';
    $send_at = '';
    $result = $mandrill->messages->send($message, $async, $ip_pool, $send_at);
    return $result;

}

```

==================================================

Warning: require\_once(/www/host/public\_html/mandrill-api-php/madrillSend.php) \[function.require-once\]: failed to open stream: No such file or directory in /www/host/public\_html/system/core/core.functions.php(634) : eval()'d code on line 15

Fatal error: require\_once() \[function.require\]: Failed opening required '/www/host/public\_html/mandrill-api-php/madrillSend.php' (include\_path='.:/usr/share/pear:/usr/share/phpz ) in /www/host/public\_html/system/core/core.functions.php(634) : eval()'d code on line 15

# Answer
> 0 votes
What have you tried? There are all these variations (assuming /www/host/public\_html/ is where your EE install is and is your document root):

```
require_once('/www/host/public_html/mandrill-api-php/Mandrill.php');

require_once('../../../../../mandrill-api-php/Mandrill.php';

require_once(realpath($_SERVER["DOCUMENT_ROOT"]) . 'mandrill-api-php/Mandrill.php');

require_once($_SERVER['DOCUMENT_ROOT'] . 'mandrill-api-php/Mandrill.php');

```

and like 10 others. It's always possible the error is reporting the path you put in, but it actuality it's trying to load it from a relative path because EE or CI set's an environment thing. Just guessing a little, but try out some varaitions and report back.

Are file permissions all correct? Do you have two different PHP agents (one for EE core, one running everything else)?

**edit** Are these templates set on PHP Input or Output?? If set on Input, your $location and $ebrochure variables won't get set properly.

---
Tags: php, curl
---


# Question
Title: How can I set up nginx to serve Stash's static cache?
Mark Croxton helpfully provided this sample .htaccess for using Stash's static cache on Apache servers. Unfortunately, I'm running this particular site on nginx, and I haven't found any good answers on how to accomplish these same rewrite conditions with nginx. I'm hoping someone else has done it already and doesn't mind sharing their solution.

# Answer
So I dug into it, and here's what I've come up with. I've tested it extensive *on my setup* (Laravel Forge), but of course YMMV.

The methodology is a little different than the Apache version. Since we have to check for the existence of the cache file anyway (and we know there won't be a cache file for anything that isn't supposed to be cached), there's no benefit to excluding image files or other file assets from the rewrite conditions.

Essentially, if the cache file exists, it's a GET request, and there isn't a query string that starts with css, ACT, URL, or preview, serve up the cache file.

Put this in the server block (but not within a location block):

```
# BEGIN STATIC CACHE RULES
set $cache false;

# Disallow direct access of cache directory
location /cache {
    internal;
}

# Only serve up cache if this cache file exists
if (-f $document_root/static_cache/[site_id]$request_uri/index.html) {
    set $cache true;
}

# Don't serve up cache if not GET request
if ($request_method != GET) {
    set $cache false;
}

# Don't serve up cache if any of these arg names start the query string
if ($args ~* ^(css|ACT|URL|preview)) {
    set $cache false;
}

# Don't serve up cache to any logged-in user
if ($http_cookie ~ 'exp_sessionid') {
    set $cache false;
}

# If cache is still enabled, go!
if ($cache = true) {
    rewrite ^(.*)$ /cache/1$request_uri/index.html break;
}
# END STATIC CACHE RULES

```
> 1 votes

# Answer
This may not be the most helpful answer, but their are conversion tools for htaccess files to Nginx configuration files. See the first answer to this stack answer:

https://stackoverflow.com/questions/5840497/convert-htaccess-to-nginx
> 0 votes

---
Tags: stash, cache, static, nginx
---


# Question
Title: Welcome discount limited to time and membership group
For the moment when people signing up on new membership the system send out a welcome email with discount % to be used at our store limited to the membership group (Restrict to Member Groups) and limited to one purchase per customer (Limit Per Customer).

The down side is this discount code has unlimited time. I'm not sure if there is an already builtin feature to set how long this discount should last since member signed up (example 14 days) or if this is a feature request?

Thanks

# Answer
> 0 votes
There is nothing built in to Store that would allow you to do this. You would need to write an extension to check the members registration date against the coupon code.

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


title: Discussion Forum Email Templates HTML

text:
# Question
Title: Discussion Forum Email Templates HTML
I have changed Default Mail Format to HTML in email configuration but when I get email notifcations via the Discussion Forum it still contains HTML tags .

e.g., `<p>`

Anyone any idea?

# Answer
> 1 votes
The "default email format" setting does only one thing, and that is determine the initial state of the "Email Format" dropdown when you go to **Tools → Communicate**.

All other emails generated by EE - be it from the Forum module, or comment notifications, new entry notifications, etc - will be sent as plain text. Currently there is no way to change that without altering core files.

---
Tags: wygwam, forum, discussion
---


# Question
Title: Google Maps for ExpressionEngine Store locator open infowindow from search results
I'm using Google Maps for ExpressionEngine to create a store locator.

This is the code I'm using to display the results.

```
{exp:gmap:init id="map" scrollwheel="false" class="distributor-map"}
{exp:gmap:results order_by="distance" sort="asc" match_categories_exact="true" parse="inward"}
    {if has_searched}
        <ul>
        {results}
            <li>{title} - {distance}</li>
        {/results}
        </ul>
        {results}
            {exp:gmap:marker id="map" show_one_window="true" latitude="{location_lat}" longitude="{location_lng}" geocode="false" clustering="true"}
                <h4>{title}</h4>
                {address}<br />
                {distributor_postcode}
                {if contact_number}
                    <br />
                    <i class="fa fa-phone"></i> {contact_number}
                {/if}
            {/exp:gmap:marker}
        {/results}
    {if:else}
        {exp:channel:entries channel="distributors" dynamic="no" disable="member_data|pagination" parse="inward"}
            {location_gmap id="map"}
        {/exp:channel:entries}
    {/if}

    {if absolute_count == 1}
    <p><em>Hint: Try searching for 'Hoosier National Forest' at a distance of 20 miles.</em></p>
    {/if}

    {if no_results}
        <p>No results found</p>
        {exp:channel:entries channel="distributors" dynamic="no" disable="member_data|pagination" parse="inward"}
            {location_gmap id="map"}
        {/exp:channel:entries}
    {/if}
{/exp:gmap:results}

```

I'd like to add a link around the title and distance that will open the info window.

```
<ul>
    {results}
        <li>{title} - {distance}</li>
    {/results}
</ul>

```

Could someone please point me in the right direction?

Thanks

Wayne

# Answer
Well, first, you need to associate your list item tags with the corresponding markers. If the {exp:gmap:markers} tag only outputs DOM elements for the map and nothing that shows automatically, you can first reduce your loops by one for association:

```
    {results}
        <li>
            <a href="#" class="marker_link" data-markerclass="marker_box_{result:entry_id}">
                {title} - {distance}
            </a>
        </li>
        {exp:gmap:marker id="map" show_one_window="true" latitude="{location_lat}" longitude="{location_lng}" geocode="false" clustering="true" class="marker_box_{result:entry_id}"}
            <h4>{title}</h4>
            {address}<br />
            {distributor_postcode}
            {if contact_number}
                <br />
                <i class="fa fa-phone"></i> {contact_number}
            {/if}
        {/exp:gmap:marker}
    {/results}

```

This gives you a link with the class and data link (example)

```
class="marker_link"
data-markerclass="marker_box_42"

```

and the infobox has a class of

```
class="marker_box_42"

```

And from there, you can just jam some JavaScript on the bottom of your page. This is a an approximation and you will need to modify it to fit your code:

```
$(document).ready(function(){
    $(".marker_link').click(function(e){
        e.preventDefault();
        var class = $(this).data("markerclass"); // = "marker_box_42"

        /*
        here you have to do your research on the gmaps JS api,
        to figure out the method to show a marker based on it's class name.
        but now you have the class of the info box you want to pop-up
        in jquery, it might be as simple as this
        */

        $(class).show();

    });
});

```

Thaaat should get you there, or really close to your solution.
> 0 votes

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


# Question
Title: Channel Image - get detailed image by ID
I want to get the image detail by its ID rather than the URL. Here is my code that is not working.

List page {exp:channel:entries channel="gallery"}

```
{gallery_images}
 <li>
<a href="/gallery/detail/{image:id}/"><img src="{image:url:medium}" class="img" alt="{image:title}"></a>
 </li>
{/gallery_images}

```

{/exp:channel:entries}

Detailed Page

{exp:channel:entries channel="gallery"} {exp:channel\_images:images segment\_3="{image:id}"} {/exp:channel\_images:images}

Thanks

# Answer
> 0 votes
Here is how you would do the detail page:

```
{exp:channel_images:images image_id="{segment_3}"}
{image:url}
{/exp:channel_images:images}

```

Another choice if you have a variable called image already is to do this:

```
{exp:channel_images:images image_id="{segment_3}" prefix="ci"}
{ci:url}
{/exp:channel_images:images}

```

Brad

---
Tags: channel-images
---


# Question
Title: Expression Engine + FreeForms Pro --> MS Dynamics Integration
At the moment we have a website running on Expression Engine with FreeForms Pro. We hope to integrate the forms in a way that this data exists in our MS Dynamics CRM package.

What's the best way to realize this? Would there be any example code/demos online or would this be something only specific vendors could do?

Hope to hear from you.

Many thanks, Peter

# Answer
> 0 votes
Well, according to this:

https://social.microsoft.com/Forums/en-US/a3295c3c-a446-471d-9f30-1753a3e591d0/ms-dynamics-crm-api?forum=crm

MS Dynamics CRM supports a web-surface API in the SDK. And according to me, you can develop your own extensions and modules using the FreeForm extension hooks and the ExpressionEngine addon developers guides:

https://solspace.com/docs/freeform/extension\_hooks/

https://ellislab.com/expressionengine/user-guide/development/

Soooo unless you can expand on your answer, a good developer (especially one familiar with EE addon development) should have no problem solving this for you. As for code examples, use the SDK guide to learn about the Dynamics CRM API, and use the EE addon guides to learn about how to connect your server to that API, and use the FreeForm extension hooks to grab data submitted by FreeForm in your custom modules and extensions (that then connect to the CRM API).

# Answer
> 0 votes
Peter,

As jrothafer pointed out, you can reference the documentation for each platform (including the Freeform extension hooks) and build a solution that will do what you want. I don't know of any one tutuorial that covers this specific case. Of course, that's the trouble with API integrations: they tend to be specific to the project.

There are a lot of development companies out there that can do the customization work for you. Solspace, who makes Freeform, also does custom CRM integrations (see: https://solspace.com/services/salesforce) and might be able to help.

---
Tags: solspace-freeform, php, database-migrations, integration
---


# Question
Title: Conditional Statements to show Open Hours
So I want to show "Open-Now" if the current time is in betwee in the open hours (which are put in a grid time select field).

This is what I have right now:

`{if {current_time format="%h"} >= {branch_hours:opening_hour} && {current_time format="%h"} <= {branch_hours:closing_hour} } <span class="open-now text-right">Open Now</span> {/if}</p>`

It's not really working, and not sure why? Is what I'm aiming for even possible?

# Answer
jrothafer's troubleshooting suggestion will tell you a lot. If that looks good, try putting the tags in single quotes like so:

```
{if '{current_time format="%h"}' >= '{branch_hours:opening_hour}' && '{current_time format="%h"}' <= '{branch_hours:closing_hour}' } <span class="open-now text-right">Open Now</span> {/if}

```
> 1 votes

---
Tags: conditionals, grid, time
---


# Question
Title: Is it possible to throw a 404 when pagination URL goes beyond the number of entries?
For example with a `limit` of `10` and a total number of entries of `18`, page 1 (`/foo/bar`) should return 10 entries, page 2 (`/foo/bar/P10`) would receive 8, any other page (`foo/bar/P20`) should throw a 404.

# Answer
> 0 votes
you ready for this? I pray to crap that someone has a better answer but heeere we go...

Turn PHP on output for your form. At your template start, add this:

```
<?php $paginate = FALSE; ?>

```

Then, in your paginate loop set it to true:

```
{paginate}
    <?php $paginate = TRUE; ?>
    Pagination links and stuff and things...
{/paginate}

```

Then after your channel entries (or search or whatever loop) (this assumes segment\_4 is your pagination segment):

```
<?php if (!$paginate) {

    if ("{segment_4}")
    {
    ?>
         {redirect="404"}
    <?php
    }
    ?>

<? } ?>

```

Next issue... This works, but **not** for a single paging number past your last result. So if P580 is your last pagination page, and you have 588 results, manually entering P588 works, P590 and up 404's, but P589 loads with a broken template display.

I have a solution for fixing that, but this train just keeps getting messier, so see probably what else you can do; this is a kind-of band-aid.

# Answer
> 0 votes
AB Pagination has support for "Strict URLs" which will throw a 404 if you reach a page where there are no more entries: https://devot-ee.com/add-ons/ab-pagination

---
Tags: pagination
---


# Question
Title: Expression Engine image:url not replaced on style attr
Is there a escape mechanism for strings in EE to render EE tags? This is my snippet

```
{exp:channel:entries channel="used_vehicles" paginate="top"}
{paginate}
    {pagination_links page_padding="2"}
{/paginate}
<article>
    <a href="{permalink='site/usado'}" class="car">
      <div class="image_holder" style="background-image: url({image:url:medium})"></div>
      <p>{title}</p>
      <span class="ver_mas">Ver más</span>
    </a>
</article>
{/exp:channel:entries}

```

I need that {image:url:medium} be replaced by the entry's image url. But on the inspector it seems it only puts {image:url:medium}. Any ideas?

**edit:** Forgot to say that, sadly, I can't change the div to an img tag.

# Answer
Looks like you are using channel images syntax. Are you using that addon? or do you have a native file field? if you are using native you should be using a tag pair like this:

```
{image}
<div class="image_holder" style="background-image: url({url:medium})"></div>
{/image}

```

Just one other thing: you'll get the best EE answers on http://expressionengine.stackexchange.com
> 1 votes

---
Tags: tags
---


title: Issue with Multiple Site Manager

text:
# Question
Title: Issue with Multiple Site Manager
I've gone through all the steps of installing and activating the Multiple Site Manager for EE. It was all pretty straight forward. Everything appeared to work correctly, but when I click the "Edit Sites," button at the top I'm sent to just a plain white screen. No errors or anything. From what I can tell the URL is correct, it points to the page "manage\_sites".

Wasn't sure if anyone had a similar issue like this when using Multiple Site Manager.

# Answer
Your MSM and EE versions are incompatible.

* MSM 2.1.7 works with EE 2.9.0
* MSM 2.1.6 works with EE 2.7.0
* MSM 2.1.5 works with EE 2.6.0
* MSM 2.1.4 works with EE 2.5.0

You'll either need to upgrade your copy of EE (recommended), or contact EllisLab to get a copy of MSM 2.1.4.
> 1 votes

---
Tags: multi-site-manager
---


# Question
Title: deny access to directory but allow to sub directories, how?
Im using native EE image manipulations to create small images. How ever, EE saves the original files, and everyone can access to those.

I need to deny access to these original images but allow access to sub directories EE is created.

So, simple example: /myimages/\_cropped/image.jpg and /myimages/\_customsmall/image.jpg

Those are the files that I need to serve to visitors.

But I want to deny access to original images that are saved to /myimages/image.jpg

How this can be done with something like via htaccess? I've tried to google but did'nt find any articles about this. I do not wat to use any password protection, but deny from all (the main directory) and yet to allow needed sub directories.

Thanks in advance.

# Answer
> 0 votes
Easy peasy. Use .htaccess rules.

For /myimages/.htaccess:

```
Order deny,allow
Deny from all

```

for /myimages/whateverdirectory/.htaccess:

```
Order allow,deny
Allow from all

```

---
Tags: image, .htaccess
---


# Question
Title: 404 redirect on structure site not working
...or only "partially" working.

My issue is if someone types in a non-existant url using an existing template group like this:

www.mysite.com/existing\_template\_group/cvgdghdbhbcdbcdh

The results are it will pull up index.html for existing\_template\_group and try to load ALL of the entries I have in the database. The curious thing about this issue is it only occurs with 3 out of 8 template groups in my site.

The other template groups seem to trigger the custom template (404/index) just fine.

If anyone can give me any insight to what the problem may be I'd appreciate it!

Thanks.

# Answer
Figured it out. I had pages in Structure that had the same name as a template group.

About us page: www.mysite.com/about-us Template group name: about-us.group

So if someone were to type in www.mysite.com/about-us/ccgsdcedh EE would look in the about-us template group and display the index template with all of my entries.

My solution was to change the names of the conflicting template groups to something no one would ever guess.
> 0 votes

---
Tags: structure, 404, pages
---


# Question
Title: Conditional with Low Variables, Matrix and Playa
I've gone every which way to get the following conditional to work, but it never renders the if:else variable:

```
<!-- matrix field -->
{show_override_age_policy}
  <!-- loop through Playa column and collect entry_ids of entries, if entry_id in Playa column matches the entry_id of current entry then display Low Variable from related Playa column -->
  {if "{override_market:child_ids}" == "{exp:stash:get name='market_entry_id'}"}
    {override_age_policy:var}
  <!-- if no matched entry_id than display default Low Variable -->
  {if:else}
    {show_age_policy:var}
  {/if}
{/show_override_age_policy}

```

The first part of the conditional when it matches displays both the matched and non-matched results. And when I'm on an entry that does not have a matching entry\_id it should display whatever is in if:else. Instead it displays the if:else conditional twice. Any thoughts on how I might approach this?

# Answer
As with others you've spoken to, I'm very out of practice with EE. However, if you look at the EE manual for conditionals, the way you've written this is recommended against. If you look here, it will tell you not to use brackets or quotes for variables in conditionals:

https://ellislab.com/expressionengine/user-guide/templates/conditionals.html#embedding-tags

I'd try remedying this, as I recall EE has always been very touchy on such points, and it may solve your problem. In other words, no quotes or brackets on that left-hand variable.

In your next troubleshooting step, I think you mean a simple string value for "generic sting", but I think you'll find that "Yes" wouldn't be a logic value within a conditional, so this seems unlikely to tell you anything.

I'd try getting rid of the quotes and brackets around your variable first.

If this doesn't solve the problem by itself, you might try replacing that whole Stash call with a quoted string value that matches your override\_market:child\_ids variable exactly. I'm a little concerned that this variable appears by name to be plural - is it an array? In which case it will never by itself work in an EE conditional, would seem.

Given the problem shows to be in the stash call, it's possible you have one of the cases where parse="inward" is needed, in order to get the right order of evaluation so that the stash value is returned before the conditional is evaluated. Here's a stackexchange where that's mentioned and illustrated:

plugin value in a template conditional

Here also is a famous cheat sheet on EE parse order, and you can look up how parse inward relates to this.

http://loweblog.com/downloads/ee-parse-order.pdf

Finally, there's also a new conditionals parser in EE 2.9, and you can read about that here, if you happen to be on that or a later version.

https://ellislab.com/blog/entry/new-conditionals-parser-in-2.9

Good fortune - really the answer here should be simple, if you haven't been trying to compare two values that can't be compared (for example, if your variable is an array). Parse order can make it a bit trickier, but again parse inward properly applied should fix that without more complication if it's needed, from the look of this.
> 1 votes

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


title: Send Email weekly

text:
# Question
Title: Send Email weekly
I want to send a weekly email based on time (no other trigger) that inclues channel entries which is defined in a template.

The recipients are always the same, just a few people.

I cannot seem to find a time-based option in postmaster.

Can anyone help? Another solution is fine.

# Answer
> 1 votes
> Use CRON jobs to send email at anytime in the future. Specify a specific and/or relative date to give you the maximum amount of flexibility. You can even configure a parcel to send emails at re-occurring intervals.

This is directly from their Devot-ee page. You need to set up a cron job to curl your site once a week; It seems PostMaster allows for triggering emails via a URL. I'm busy and wish I had time to dig through their documentation, but I'm pretty sure you can just make a template, and you curl that path:

```
www.your-domain.com/notification_template_group/weekly_email

```

and just curl that with a cron job, and use something like

https://objectivehtml.com/postmaster/api/postmaster-base-api#send

to actually send the mail. You can probably use an htaccess block on that template page to only allow request from 127.0.0.1; then you're protected and only your server can curl that notification address!

**Note** Read through the docs. I probably just gave you a more complicated solution than is necessary, the people at Objective are quite nice (in my experience) so you can just shoot them an email and they can probably walk you through it.

# Answer
> 0 votes
There's a 1st party addon for this: Cron-Email.

It's quite old, but, since it's from EllisLab itself, I guess you can ask for help if it isn't compatible to the current EECMS version.

# Answer
> 0 votes
I have worked it out with a combination of Postmaster and Cronjobs. In Postmaster you do have notifications. Just fill them out, do NOT enter anything in the timebased fields and use the Expression Engine Mail.

Once saved, the notification will have an url in the overview. Just call the url with a cron job on a time based manner and you will get it working.

---
Tags: email, postmaster
---


title: Guest upload expression engine

text:
# Question
Title: Guest upload expression engine
I know that by default EE doesn't allow guests to upload a file. Though a client really needs this feature in his site. Isn't there a possibility to enable this for guests as well?

I guess I would then need to have a look at specific code pieces to enable this but I can't seem to figure out where this might be located, did anyone ever solve this problem?

# Answer
> 1 votes
This is probably a duplicate of : Allow Guests to Upload to Directory? FreeForm PRO / EE2.6.1

Try the answer there, and let us know how you get on.

In short Guests should be able to upload (like any other group) **if** you set the relivent permissions. This will be "Can post to (channel where the files are attached)" (Channel Assignment & Channel Posting Privileges sections). Permissions can be found at Members \> Member Groups \> Edit Group (Guests)

Also, you'll need to review your File Upload preferences (Content \> Files \> File Upload Preferences), at the bottom of this section is the part that the duplicate post refers too). I do note here that Guest group is removed (as well as banned, super admins ect), I suggest a work around of cloning the Guest group with all the same permissions, set this group as the anonymous group (Member \> Preferences) and it *should* appear in the File Upload Preferences.

---
Tags: safecracker, guest
---


title: Getting images out of the system

text:
# Question
Title: Getting images out of the system
I updated ee to v2.10.1

I have an image with umlauts in the filename which I'm unable to remove.

* The .jpg file is not present, but still in the filemanager
* Synchronizing the upload folder doesn't remove it.
* recreating a fake file with the same name does nothing.
* Last idea is to delete the file by hand in the database with sequel pro.
* Since the file is added in an entry I can no longer edit the entry because I can't get past the file error message (Nice error handling by the way).

I've never made anything by hand in the db. Where do I find the images in the database?

Any other ideas?

# Answer
> 1 votes
You started fine with the manual deletion; you just need to complete the process. Open your Edit form and find your entry\_id. Then, go to your field groups and find the field\_id of the file field. Then head to your channel\_data MySQL table, find that entry\_id (if your field\_id is 10 and entry\_id is 20, use `SELECT field_id_10 FROM exp_channel_data WHERE entry_id = "20";`), and clear out any value for that field.

**Edit** Ahh, a matrix field. That data is store in exp\_matrix\_data.

`SELECT * FROM exp_matrix_data WHERE entry_id = "20" AND field_id = "10";`

Find that row, and remove the sucker! You can drop the "field\_id" requirement of that query if you're having trouble finding the row.

---
Tags: file-uploads, database, file-manager
---


# Question
Title: Use of undefined constant FILEINFO_MIME_TYPE
I'm currently testing a site (EE 2.10.1) and getting a string of the following errors when trying to do anything with image uploads.

> A PHP Error was encountered Severity: Notice Message: Use of undefined constant FILEINFO\_MIME\_TYPE - assumed 'FILEINFO\_MIME\_TYPE' Filename: Mime/MimeType.php Line Number: 117
>
> A PHP Error was encountered Severity: Warning Message: finfo\_open() expects parameter 1 to be long, string given Filename: Mime/MimeType.php Line Number: 117

This supposedly stems from the fileinfo extensions only being available from 5.3.10 onwards. The PHP version on this server is 5.3.29 and it looks to have been compiled -with-fileinfo

I have a support request in with the hosting company at the moment but I wondered if anyone else had run into this and may have a workaround.

# Answer
Turns out that in this case it was simply that PHP 5.3 had been mistakenly compiled with an old version of the fileinfo extension. The host recompiled it and now all works as it should.
> 0 votes

# Answer
There's a simple workaround, but it does require modifying the core files....

**Danger, there be pirates**

You're best bet is to change th code to use `FILEINFO_MIME`, so instead of `FILEINFO_MIME_TYPE` use :

```
( strstr(FILEINFO_MIME, ";") === false ? FILEINFO_MIME : substr( FILEINFO_MIME, 0, strstr(FILEINFO_MIME, ";") - 1 ) )

```

(You need to split the string by the semi colon, if there is one)

Or use the function `mime_get_content_type()` which should get you there.

Ref : https://stackoverflow.com/questions/7906292/fileinfo-mime-type-is-undefined
> 0 votes

---
Tags: php, error, php-errors, file-manager
---


# Question
Title: ExpressionEngine 2.4.0 and PHP 5.6 support
My service provider is planning on upgrading from PHP 5.4 to PHP 5.6.

I'm currently running EE 2.4.0.

First of all will it work and secondly can I expect and issues after the upgrade.

# Answer
> 1 votes
You're probably going to get errors/warnings for not using MySQLi or PDO.

http://php.net/manual/en/migration55.deprecated.php

http://php.net/manual/en/migration56.deprecated.php

There's not a ton of functional deprecation from 5.4 to 5.6, so I predict you'll be fine. However, I highly recommend upgrading your EE install; it is foolish not to. To answer your question directly:

It will probably be a functional site; but expect PHP warnings and deprecation notices.

---
Tags: ee2
---


# Question
Title: Hookan and permission on front end template
We have about 30+ member groups (schools) and about 15 channels (books).

After logging in at the front end, member groups should have access to the channels we set. For the moment we use snippets to do it, but its very hard for a non tech person to manage it. So when we came across Hookan module from de Beer, it looks like the perfect fit to manage it (instead of the snippets). This module is purchased and installed and looks like it works well.

I only one the user groups to view, no edit or create anything.

On the front end template, how do I code the persmission to only display channels (books) the user group who have access to?

I would appreciate if you could just send me off in the right direction. I'm just stuck at the moment.

Thanks

# Answer
You cannot control access to channel content based on group membership in native EE. So far as I know Hooblong is the only module that gives that kind of control. HooKan can't help either since HooKan only makes normal \`control panel features more accessible.

With native EE, if you want members of group A to only access entries belonging to channel X, for example, then your template must use the `channel="X"` parameter. To make that dynamic, you will need a conditional something like `{if logged_in_group_id == 'groupA_ID'}Something{/if}`in your template around your channel entries tag. Unfortunately you would need this for each channel/group combination, so your template can become quite complex.

Hooblong just takes care of all that once you have set it up
> 0 votes

---
Tags: members, permissions
---


# Question
Title: Don't allow American express card in Expresso store
Is it possible to set Expresso Store to not accept American Express payments? The client us using stripe, and within stripe there is no option to disallow Amex.

I can block american express cards using JS but this is not a very robust solution.

I thought it might be possible to pass payment\[card\_type\], but this has no effect.

would there be a hook i can use to validate before it'd passed to the payment processor?

Many thanks,

Tom

# Answer
There is nothing built in to Store that would allow you to prevent a particular card type from being processed at the module level.

If the gateway required the card type you would be able to use a select and omit any card types you did not want to support. So for example you could do

```
<select name="payment[card_type]">
    <option value="">Select one...</option>
    <option value="visa">Visa</option>
    <option value="mastercard">MasterCard</option>
    <option value="discover">Discover</option>
</select>

```

if you only wanted to support Visa, MasterCard and Discover but not Amex. Stripe however does not require the card type to be submitted for a successful transaction. I also don't think that submitting the wrong card type would cause the transaction to fail as a result (even if you added `data-stripe="card_type"`). Having the select however would give a visual cue to the end user that Amex is not accepted.

If a JS option is out of the question you should be able to use the store\_payment\_request\_start hook to do any additional processing/validation before the transaction to sent to the payment processor.
> 1 votes

---
Tags: expresso-store, stripe
---


# Question
Title: How to redirect empty url to a specific page
I have an event website and I want visitors to www.example.org to be redirected to www.example.org/todays-info

"todays-info" is an entry, and I have "Enable strict URL'S" set to No so that I can leave out the template group.

I'm using Cloudflare, and want to cache the html of www.example.org/todays-info to reduce the load on the server, so I want everyone sent to that specific page on visiting so they hit the cached page rather than the homepage.

I'm using the standard htaccess from Ellis Lab to remove index.php and when I try this redirect I just get into a loop

```
Redirect 301 /  http://www.example.org/todays-info

```

I'm guessing that the rewrite to remove index.php is part of the problem. Any suggestions?

# Answer
> 3 votes
My friend... I'm afraid your syntax is incorrect. Place this rule **after** your index.php rewrites (at the end of the standard EllisLab htaccess file):

```
RedirectMatch 301 ^/?$ http://www.example.org/todays-info

```

This is the magic you seek. The second parameter of a RedirectMatch is a **regular expression**.

---
Tags: htaccess, redirects
---


# Question
Title: Disable the ability to check multiple categories
Is it possible to disable the ability to check multiple categories for an entry in the control panel, only leaving the option to check one category?

# Answer
> 0 votes
If I actually understand you question, no, it's not possible with native EE. You would need to write a custom add-on. However, with something like this:

https://solspace.com/software/expressionengine/primary\_category

You can can probably add both of those categories as Primary Categories; and only one should be selectable. It probably isn't exactly what you want, but I'm not sure. Check out the docs (or just download it and test it on a dev server, it's free anyways) and see if this is right for you.

https://solspace.com/docs/primary\_category/control\_panel/

---
Tags: categories
---


title: (MSM) 'View Site' CP Link

text:
# Question
Title: (MSM) 'View Site' CP Link
Using MSM with EE v2.9.0

My 'View site' button in the top right hand corner of the control panel only links to the default\_site.

Is this normal behaviour? Is there a config setting that could be conflicting and causing this?

# Answer
This is kind of a bug, but also kinda by design. When you setup secondary sites in the control panel, you never actually enter a Site URL for your those sites, so the control panel never actually *knows* what your other site URLs are.

Your *templates* know, because when you add your custom MSM config variables to your secondary sites' you set it explicitly via `$assign_to_config['site_url']` \- but again, the CP doesn't load this file or even know it exists.

So, the View Site link is working "correctly", but it's bad UI. You may want to file a bug with EllisLab.
> 0 votes

---
Tags: multi-site-manager
---


# Question
Title: Make a member have to "re-agree" to a site's TOS when their member group changes
We have a client that has their users agree to a particular terms-of-service agreement when they register for an account.

This is **not** the standard EE "terms of service" as it's different for the member depending on what member group their are part of.

We had been doing this with a conditional statement and Solspace's User module's register functionality.

Now the client needs to be able to have the members "re-agree" to a different TOS if their member group changes when a site admin changes it in the control panel.

Basically...

"If Jason's member group is not the same as the last time he logged in and is one of these specific member groups, make him have to agree to this new TOS via a modal window (."

Anyone familiar with how to accomplish this or an add-on that can manage that? It doesn't have to be a modal window, but figured that would get the user's attention.

# Answer
Basically, you're going to want to use an extension that hooks this:

```
member_update_start

```

https://ellislab.com/expressionengine/user-guide/development/extension\_hooks/global/member\_model/index.html#member-update-start

A in your extension, do something like this (pseudo code, don't got time to write up a full thing for you):

```
function check_tos_member_update_start($member_id, $data)
{
    $old_member_gr = ee()->db->select('member_group')
                         ->from('exp_members')
                         ->where('member_id', $member_id)
                         ->get->row_array();

    if ($old_member_gr['member_group'] != $data['member_group'])
    {
        // our user has changed their member group
        // here, you could insert a row into a custom table
        // that says member_id, and flag a "changed column",
        // and the new group
    }
}

```

Then, you could write another function in this extension that hooks on to (one of the member\_login hooks, just picking this one):

```
member_member_login_single

```

https://ellislab.com/expressionengine/user-guide/development/extension\_hooks/module/member\_auth/index.html#member-member-login-start

that does something like this:

```
function check_tos_member_member_login_single($hook_data)
{
    $check = ee()->db->select('changed_column')
                     ->from('exp_check_tos') // custom table
                     ->get->row_array();

    // did we submit with a checked TOS?
    if (ee()->input->post('new_TOS))
    {
        // delete my flagged row from exp_check_tos!
    }

    // if not are we flagged for NEEDING one?
    else if ($check['changed_column'] == "true")
    {
        if (!ee()->input->post('new_TOS'))
        {
            // didn't recheck the TOS !!!
            // redirect to login form with TOS flag
            ee()->function->redirect('login-form?tos=1');
        }
    }
}

```

And then you can use the input class in your login form to see if they are flagged to recheck their TOS (I forget the login form tag so I'm making it up):

```
{exp:login:form}

    <?php
    if (ee()->input->get('tos'))
    {
    ?>
        <input type="checkbox" name="new_TOS">
    <?php
    }
    ?>

{/exp:login:form}

```

Yea, that's kinda a convoluted answer, but I basically thought out your custom addon for you :)
> 1 votes

---
Tags: members, solspace-user, member-management
---


# Question
Title: Delete Assets input fields in a front-end form
I have the following in a Zoo Visitor Update form:

```
<label class="control-label" for="member_photo">Performer / Band Photo</label>

    <input type="hidden" name="member_photo[]" value="0"/>

    {member_photo}<div><img src="{url}" width="150" /><input type="hidden" name="member_photo[]" value="{file_id}"/> (To delete this just remove the hidden input for this image)</div>{/member_photo}

    <p><input type="file" name="member_photo[]" id="member_photo" multiple></p>

    <input type="hidden" name="member_photo_filedir" value="8">

```

I need users to be able to remove images as well as adding new ones.

As per the bracketed comment, P&T have suggested that in order to remove the input I need something like a 'delete' checkbox that toggles the name of the input but this is beyond my limited js-fu and will no doubt be useful to others too.

Any jquery ninjas able to offer up a solution?

# Answer
> 1 votes
I think you need to output a delete button/checkbox alongside each image/input. You can then use jQuery to remove that img/input from the DOM so when you submit the form it's no longer there.

Maybe something like this:

```
<input type="hidden" name="member_photo[]" value="0"/>

{member_photo}<div><img src="{url}" width="150" /><input type="hidden" name="member_photo[]" value="{file_id}"/> (To delete this just remove the hidden input for this image) <button class="delete-img">Delete</button> </div>{/member_photo}

<p><input type="file" name="member_photo[]" id="member_photo" multiple></p>

<input type="hidden" name="member_photo_filedir" value="8">

$('.delete-img').click(function(){
    $(this).siblings().remove();
    $(this).remove();
})

```

*Added '()' after function from first post.*

# Answer
> 1 votes
Darren used a button, which should work too, but here's the jQuery I came up with to remove the name attribute value:

HTML:

```
<label class="control-label" for="member_photo">Performer / Band Photo</label>

    <input type="hidden" name="member_photo[]" value="0"/>

    <div>
        <img src="http://placehold.it/150x150" width="150" />
        <input type="hidden" name="member_photo[]" value="{file_id}" id="photo" /> <br>
        (To delete this just remove the hidden input for this image)
    </div>

    <input type="checkbox" name="remove_file"> Remove file

    <p><input type="file" name="member_photo[]" id="member_photo" multiple></p>

    <input type="hidden" name="member_photo_filedir" value="8">

```

jQuery:

```
$('input[type="checkbox"]').click(function() {
    $('input#photo').val('');
});

```

(Note that I gave the image an ID.)

# Answer
> 1 votes
Should use 'change' event instead of click. Cause user may not select any new file, then it will remove the existing file.

```
<img src="{url}" />
<input type="hidden" name="member_photo" value="{file_id}" id="cur_file_id">
<input type="file" name="member_photo" id="file_upload">
<input type="hidden" name="member_photo_filedir" value="8">`
<pre><code>{/member_photo}</code></pre>

<script type="text/javascript">
  $("#file_upload").change(function (){
    $('#cur_file_id').val('');
  });
</script>

```

---
Tags: assets, forms, zoo-visitor, jquery, javascript
---


# Question
Title: Getting CKEditor in Wyvern to not use inline styles
I've seen this post: Remove inline styles from WYGWAM \- but it's for WYGWAM. Has anyone successfully changed CKEditor's behavior, from Wyvern, to output this:

```
<img src="blat.gif" height="200" width="200">

```

Instead of this:

```
<img src="blat.gif" style="width:200px; height:200px;">

```

It's not clear which file I should edit.

# Answer
Hrmm. I wouldn't recommend changing core files.

:p I feel like being awful today. Here's a PHP solution (turn template on PHP output):

```
<?php
echo preg_replace("/height\=\\"(\d*)\\" width=\"(\d*)\\"/", 'style="height:$1px; width:$2px;"', '{wyvern_image_field}');
?>

```

This regex will turn

```
<img src="blat.gif" height="200" width="200">

```

to

```
<img src="blat.gif" style="height:200px; width:200px;">

```

**bunch of edits** that was some quote nightmare to get right, lol. AND OH, woops, you wanted it to go the **other** way. Hold on, regex coming up in a few minutes!

Here ya go, buddy!

```
<?php
echo preg_replace("/style=\\"height:(\d*)px; width:(\d*)px;\\"/", 'height="$1" width="$2"', '{wyvern_image_field}');
?>

```

This will take this

```
<img src="blat.gif" style="height:200px; width:200px;">

```

and produce this!

```
<img src="blat.gif" height="200" width="200">

```
> 1 votes

# Answer
Wyvern has a similar config file, you can add this line to it:

config.disallowedContent = 'img{width,height}';
> 1 votes

---
Tags: css, ckeditor, wyvern
---


# Question
Title: Is there another way to output Categories and all respective entries other than category_archive?
I'm trying to output a category group and its respective entry listing titles (in this case the titles are names of people) in alphabetical order by last name in a menu navigation like so. To do this, I've created a custom field called `last_name` thinking I could use this tag `orderby="last_name`, but because `category_archive` doesn't support this parameter, I'm not able to accomplish this way.

* Category 1
    + Jon Doe
    + Jane Doe
    + Janet Doe
* Category 2
    + Jon Doe
    + Jane Doe

Here's the code I have:

```
<ul class="list-unstyled main-list">
    {exp:channel:category_archive channel="speakers" style="linear" backspace="7" show="not 28}
        <li>
            {categories}
                <a class="btn-open" href="#">{category_name}</a>
            {/categories}
            <ul class="list-unstyled">
                {entry_titles}
                    <li><a href="{path='site/speaker'}">{title}</a></li>
                {/entry_titles}
            </ul>
        </li>
    {/exp:channel:category_archive}
</ul>

```

Is there any other way to accomplish so I can get a bit more flexibility. Perhaps playa or some other plugin or native code? Any help is much appreciated.

# Answer
Sure, something like this:

```
{exp:channel:category_archive channel="my_channel" style="linear"}
    {categories}
            <h3>{category_name}</h3>

        {exp:channel:entries channel="my_channel" category="{category_id}"}
            <a href="{comment_url_title_path}">{title}</a>
        {/exp:channel:entries}

    {/categories}
{/exp:channel:category_archive}

```
> 2 votes

---
Tags: categories, entries, navigation, category-archive
---


# Question
Title: Responsive Images solution with native EE and/or Addons
Considering that add-ons like Channel Images and even the native EE image upload functionality provide the option to create duplicates of uploaded images at rescaled sizes, (or produced on-the-fly with CE Image) has anyone had experience in using this functionality in conjunction with JS to serve image files based on screen sizes?

I'm not referring to the RWD CSS on the front end (responsive images and media queries), I'm interested in the aspect of serving different image files from EE based on screen sizes via Ajax after the page has loaded and I can detect the screen width. Any caveats, or gotchas specific to EE?

# Answer
I use an add-on I developed which sets a screen width variable which you can use in conditionals and then I use an image sizing plugin to serve up different sized images based on that. A bit more detail here.
> 16 votes

# Answer
I can't see any issues to worry about here. A couple of approaches that could work, using the PictureFill technique:

Using EE image manipulations:

```
<div data-picture data-alt="My picture">
    <div data-src="{my_image:small}"></div>
    <div data-src="{my_image:medium}" data-media="(min-width: 400px)"></div>
    <div data-src="{my_image:large}" data-media="(min-width: 800px)"></div>
    <div data-src="{my_image:xlarge}" data-media="(min-width: 1000px)"></div>
    <noscript>
        <img src="{my_image:small}" alt="My picture">
    </noscript>
</div>

```

Or using CE Image:

```
<div data-picture data-alt="My picture">
    <div data-src="{exp:ce_img:single src='{my_image}' width='300' output='{made}'}"></div>
    <div data-src="{exp:ce_img:single src='{my_image}' width='380' output='{made}'}" data-media="(min-width: 400px)"></div>
    <div data-src="{exp:ce_img:single src='{my_image}' width='780' output='{made}'}" data-media="(min-width: 800px)"></div>
    <div data-src="{exp:ce_img:single src='{my_image}' width='980' output='{made}'}" data-media="(min-width: 1000px)"></div>
    <noscript>
        {exp:ce_img:single src='{my_image}' width='300' output='<img src="{made}" alt="My picture" />'}
    </noscript>
</div>

```
> 26 votes

# Answer
I don't know of any gotchas specific to EE. And I've had good luck using the native EE file manager, as well as Assets and Channel Images, to create and serve up multiple sizes of images to different devices. I like the way Channel Images structures its directories; I think it makes it easier to use for responsive images than the other solutions.

Also, this isn't image-specific, but there's an addon by Tyssen that will let you set an EE cookie for the window size via JS and then access it in templates. It makes the whole serving-multiple-images thing much easier. It's called RESS.
> 5 votes

# Answer
Don't bother!

Read this blog post, it might be of interest to you?

http://boagworld.com/dev/how-should-we-handle-responsive-images/
> 2 votes

# Answer
The above answers mention the picture pollyfill this is now in some browsers: http://filamentgroup.com/lab/picturefill\_2\_a.html

So set up your image manipulation and use the picture tag with srcset
> 1 votes

# Answer
Now that SRCSET is becoming more widely supported you can use EE Image manipulations to output various sized images, something like this:

```
{my_image_field}
<figure>
    <img src=”{url:small}”
    srcset=”
        {url:small} 600w,
        {url:medium} 960w,
        {url:large} 2000w
    ” alt=”“>
    <figcaption>{title} {description} {credit}</figcaption>
</figure>
{/my_image_field}

```
> 0 votes

---
Tags: image-galleries, ce-image
---


# Question
Title: IF conditional using segment_url leave a blank space in text
In creating page titles based on URL segments (for list pages), we have utilized conditionals that point to the segment urls for conditional inclusion. HOWEVER when the page source is viewed (and the page is indexed), the conditionals that are not met leave extra spaces within the Meta Title text.

```
Chocolate {if segment_2 == ""} Cookie{/if}{if segment_2 !=  "any"} {segment_2_category_name}{/if}{if segment_3 != "any"} {segment_3_category_name}{/if}{if segment_4!= "any"} {segment_4_category_name}{/if} Recipes

```

Results in Meta title (the dots are extra spaces): Chocolate Cookie.....Recipes

The extra spaces should not be included BUT if the other segments are filled in, the spacing is correct:

Chocolate Raisin Caramel Cookies

Why does the unmet conditional leave a space? - AND how do we get rid of it?

# Answer
> 0 votes
Try this:

```
Chocolate {if segment_2 == ""} Cookie{if:elseif segment_2 !=  "any"} {segment_2_category_name}{if:elseif segment_3 != "any"} {segment_3_category_name}{if:elseif segment_4!= "any"} {segment_4_category_name}{/if} Recipes

```

# Answer
> 0 votes
The trick is to add the space only inside the conditionals, for example:

```
Chocolate{if segment_2 == ""} Cookie{/if}{if segment_2 !=  "any"} {segment_2_category_name}{/if}

```

---
Tags: conditionals, url, segments, advanced-conditionals
---


title: Embed not updating

text:
# Question
Title: Embed not updating
We have an embed that shows latest posts on the home page.

```
{embed="/embeds/.sidebar_articles}

```

This works. But when I go to change anything in it, such as filtering the posts or even just making a text change nothing updates on the live website.

```
{if segment_1 == "section"}

    {if segment_3 == ""}

            {!-- ============================================

            DISPLAY A LIST OF MOST READ ARTICLES FROM THE
            CURRENT CATEGORY. FOR HOME PAGE- DISPLAY ACROSS
            ALL CATEGORIES.

            ============================================= --}

            <div class="art-preview">
            {exp:channel:entries
                channel="sections"
                limit="3"
                dynamic="off"
                {if segment_2}category="{segment_2_category_id}"{/if}
                orderby="view_count_one" }

                {if count == "1"}
                    {if segment_2 == ""}
                    <h3>Most read stories</h3>
                    {if:else}
                    <h3>Popular in <span data-source="{segment_2}">{segment_2_category_name}</span></h3>
                    {/if}
                {/if}
                <a href="/section/{segment_2}/{url_title}">
                    <div class="preview">
                    {if article_cover_image}
                        {exp:ce_img:pair src="{article_cover_image}" width="160" height="160" crop="yes"}
                        <img src="{made}" alt="">
                        {/exp:ce_img:pair}
                    {if:else}
                        <img src="http://placehold.it/160x160">
                    {/if}
                        <h4>{title}</h4>
                        <div class="meta">Last edited {edit_date format='%d/%m/%y'}</div>
                        {!-- <div class="lead"> {article_lead} </div> --}
                    </div>
                </a>
            {/exp:channel:entries}
            </div> <!-- /art-preview -->

    {if:else}

            {!-- ============================================

            DISPLAY A LIST OF ENTRIES FROM THE SAME CATEGORY
            AS THE CURRENT ARTICLE.

            ============================================= --}

            <div class="art-preview">
            {exp:channel:entries
                channel="sections"
                limit="3"
                dynamic="off"
                {if segment_2}category="{segment_2_category_id}"{/if}
                url_title="not {segment_3}"}

                {if count == "1"}<h3>Related</h3>{/if}

                <a href="/section/{segment_2}/{url_title}">
                    <div class="preview">
                    {if article_cover_image}
                        {exp:ce_img:pair src="{article_cover_image}" width="160" height="160" crop="yes"}
                        <img src="{made}" alt="">
                        {/exp:ce_img:pair}
                    {if:else}
                        <img src="http://placehold.it/160x160">
                    {/if}
                        <h4>{title}</h4>
                        <div class="meta">Last edited {edit_date format='%d/%m/%y'}</div>
                        {!-- <div class="lead"> {article_lead} </div> --}
                    </div>
                </a>

            {/exp:channel:entries}
            </div> <!-- /art-preview -->

    {/if}

{if:else}

            <div class="art-preview">
            {exp:channel:entries
                channel="sections"
                limit="3"
                dynamic="off"
                {if segment_1 == ""}orderby="view_count_one"{/if}}

                {if count == "1"}
                    {if segment_1 == ""}
                    <h3>Most read stories</h3>
                    {if:else}
                    <h3>Latest News</h3>
                    {/if}
                {/if}
                <a href="/section/{categories}{category_url_title}{/categories}/{url_title}">
                    <div class="preview">
                    {if article_cover_image}
                        {exp:ce_img:pair src="{article_cover_image}" width="160" height="160" crop="yes"}
                        <img src="{made}" alt="">
                        {/exp:ce_img:pair}
                    {if:else}
                        <img src="http://placehold.it/160x160">
                    {/if}
                        <h4>{title}</h4>
                        <div class="meta">Last edited {edit_date format='%d/%m/%y'}</div>
                        {!-- <div class="lead"> {article_lead} </div> --}
                    </div>
                </a>
            {/exp:channel:entries}
            </div> <!-- /art-preview -->

{/if}

```

I've tried pasting this code direct into the template, it shows up but again doesn't show any changes made.

# Answer
Your embed tag syntax looks wrong, missing closing quotes, also you don't need the first slash:

```
Wrong
{embed="/embeds/.sidebar_articles}

Correct
{embed="embeds/.sidebar_articles"}

```
> 0 votes

---
Tags: embeds
---


title: Custom template for 3 level url

text:
# Question
Title: Custom template for 3 level url
How to make custom template for entry? Example: site.com/service/repair/ I have 2 entry about repair. iPhone repair & iPad repair So how to make page with url site.com/service/repair/iphone-repair and unique template for this page?

# Answer
> 1 votes
Switchee by Mark Croxton would be of use here:

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

{!-- Index page. Match empty string or pagination --}
{case value="phone"}
    phone page
{/case}

{!-- Single entry --}
{case default="yes"}
    pad
{/case}

{/exp:switchee}

```

If you need to match an empty string or use pagination, use it like this:

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

{!-- Index page. Match empty string or pagination --}
{case value="#^P(\d+)$#|''"}
    Index page
{/case}

{!-- Single entry --}
{case default="yes"}
    Single entry
{/case}

{/exp:switchee}

```

# Answer
> 1 votes
Or you could just make 1 template, with a route of `service\repair\{any}`. This template then gets all URL's with first 2 segemetns of /service/repair...

Then you cna switch on the `segment_3`, like so :

```
{if segment_3 == 'iphone-repair'}
  {embed="partials/iphone-specific"}
{if:elseif segment_3 == 'ipad-repair'}
  {embed="partials/ipad-specific"}
{if:else}
  {embed="partials/mobile-generic"}
{/if}

```

# Answer
> 0 votes
Another slightly different way, in your "repair" template:

```
{if segment_3 == ""}
  Your content for service/repair
{if:else}
  Your content for service/repair/iphone-repair (where segment 3 has a url_title)
{/if}

```

---
Tags: ee2
---


title: comment count + syntax error?

text:
# Question
Title: comment count + syntax error?
Am I missing something? It displays the 0, and 1 comment, but not multiple comments.

I'm sure it's a simple answer, but I can't see what error I'm making, and I'm not getting any feedback in developer mode.

I'm using default comments with EE, and i'm using version 2.9.2.

Thanks!

```
{if {total_results} == 0}<h4>0 Comments</h4>
{if:elseif {total_results} == 1}<h4>{total_results} Comment</h4>
{if:elseif {total_results} > 1}<h4>{total_results} Comments</h4>{/if}

```

# Answer
> 0 votes
Try these two variations:

```
{if total_results == 0}<h4>0 Comments</h4>
{if:elseif total_results == 1}<h4>{total_results} Comment</h4>
{if:elseif total_results > 1}<h4>{total_results} Comments</h4>{/if}

```

or:

```
{if "{total_results}" == 0}<h4>0 Comments</h4>
{if:elseif "{total_results}" == 1}<h4>{total_results} Comment</h4>
{if:elseif "{total_results}" > 1}<h4>{total_results} Comments</h4>{/if}

```

The template parser can get really wonky sometimes, and doesn't parse everything in the correct order.

# Answer
> 0 votes
Can you try something like this:

```
<h4>
{total_results} Comment{if total_results == "0" OR total_results > "1"}s{/if}
</h4>

```

---
Tags: error, comments, syntax
---


# Question
Title: Members not logged in after submitting the login form on front-end
I have the following issue:

I have a simple login form on a simple template with some content wrapped in {if logged\_in} conditional. I submit the login form, get the "Thank you, you are logged in" message, get redirected back to the template and still see the content in the {if logged\_out} conditional i.e. the login form, and the {member\_id} is 0.

A previous dev may have done something to prevent spam member registrations and I am trying to figure out what and where and how to fix.

Any insight or anything that would point me in the right direction would be much appreciated.

Thanks!

# Answer
> 0 votes
Turned out the IP address stored for the session didn't match the session IP address and that's why an active session couldn't be created.

I had to go in /system/codeigniter/system/core/Input.php and switch some of the if cases around in function ip\_address(), so that I store server('REMOTE\_ADDR') instead of server('HTTP\_X\_FORWARDED\_FOR').

And then everything worked.

# Answer
> 0 votes
Ok, this might not be the answer but I'm not going to type all this out in a comment.

Could you please post your template code? This could help me pinpoint any issues there, but it doesn't seem likely to be the problem.

Next, please take a good look at your .htaccess file. You can definitely mess with cookies in there. Also, even more important, is to check to see if this is an environment issue.

http://php.net/manual/en/function.phpinfo.php

Rock this command somewhere, and grep/search that page for "cookie". Find the "Session" section of your phpinfo() call, and look for any funny settings there (like if session.use\_cookies is set to "No", you've got some environment problems!). Let me know if any of this helps you.

# Answer
> 0 votes
Check any template caching you may have turned on as that can interfere with content updating after logging in.

Some solutions:

1. Turn off caching for the template the member is redirected back to.
2. Convert member content into an embed template, that way you can leave caching on on the main template but not caching the embed will allow content to update.

---
Tags: ee2, members, login
---


# Question
Title: Multiple channel entries on the same page?
I'm creating a site that uses a masonry grid layout as the homepage. It's designed in a way that the content is organised semi-randomly (I've chosen the randomness). I have portfolio images, which link to the single entry, showing in various blocks of the grid. My issue is that only the content in the first channel entries tag pair is parsing. For example here, only two entries are being displayed—

```
{exp:channel:entries channel="projects" limit="2"}
<div class="element">
<a href="{title_permalink='projects/index'}">
<figure class="images"><img src="{project_image:project_thumb}"/></figure>
</a>
</div>
{/exp:channel:entries}

some other elements here...

{exp:channel:entries channel="projects" limit="2"}
<div class="element">
<a href="{title_permalink='projects/index'}">
<figure class="images"><img src="{project_image:project_thumb}"/></figure>
</a>
</div>
{/exp:channel:entries}

```

Is it possible to have multiple channel entries tags, displaying information from the same channel, on one page?

Thanks in advanced.

# Answer
I thought it should be possible. Anyway, you should avoid calling the channel entries tag multiple times because it is quite an heavy operation. You could solve it like this:

```
{exp:channel:entries channel="projects" limit="4" dynamic="off"}
{if count == 3}some other elements here...{/if}
<div class="element">
<a href="{title_permalink='projects/index'}">
<figure class="images"><img src="{project_image:project_thumb}"/></figure>
</a>
</div>
{/exp:channel:entries}

```
> 0 votes

---
Tags: ee2, channel-entries, multiple-channels
---


title: Category Count and EE transcribe

text:
# Question
Title: Category Count and EE transcribe
I’m using a plugin name « Category Count » to count the number of entries in a specific category.

When i create an entry, transcribe create one for French and one for English so my counter show me two entries. I need only one entry count.

Here’s my code :

```
{exp:channel:categories category_id="8" style="linear"}
  {if soin-visage-section == 'Catégorie' }
    <li><a href="{exp:transcribe:uri path="soin-visage/par-categorie/list/{category_url_title}"}">{category_name} ({exp:catcount cat_id="{category_id}" channel="products"})</a></li>
 {/if}
{/exp:channel:categories}

```

Someone Can help me with this ?

Thank you very much.

Kind regards

Jérôme

# Answer
> 1 votes
It's possible Transcribe and Category Count aren't very sympatico. How about just running a query with the Query module? This is completely untested as I'm quite busy but I though I'd throw it out their. Probably have a bunch parse order issues with this idea.

```
{exp:query sql="SELECT COUNT(*) as outer_count FROM exp_category_posts WHERE cat_id = '8';"}
    {exp:query sql="SELECT * FROM exp_category_posts WHERE cat_id = '8' LIMIT {outer_count} / 2;"}
        {count}
    {/exp:query}
{/exp:query}

```

---
Tags: channel-entries, categories, transcribe
---


title: jQuery not loading on Control Panel

text:
# Question
Title: jQuery not loading on Control Panel
I checked this post out and followed the things the OP posted and what other users suggested, but jQuery still isn't loading in the control panel. The themes folder is properly linked and the CSS for it has loaded just fine. It's only the jQuery that's giving me problems.

# Answer
Try reuploading your themes/javascript folder. This could be a symptom of a failed or incomplete upload. Also, when you open your developer console in Chrome or Firefox (hit F12), jump over to your console. What errors are you getting? Please edit your answer with this information and I can probably get you fixed up.
> 0 votes

---
Tags: control-panel, jquery
---