# Question
Title: How do I create a single template tag which outputs multiple bits of data?
I have just created my own module and need a bit of help displaying the content on the front end. I currently have some template tags `{exp:address_book:contact}{/exp:address_book:contact}` and within them a series of variables; `{ab_name}`, `{ab_contact_number}` etc.

These are laid out in the site templates as so:

```
{exp:address_book:contacts}
  <table class="contact_info">
  <tr>
    <td class="label">Title</td>
    <td>{ab_title}</td>
    <td class="label">Company</td>
    <td>{ab_company}</td>
  </tr>
  <tr>
    <td class="label">Name</td>
    <td>{ab_first_name} {ab_last_name}</td>
    <td>Company Tel No.</td>
    <td>{ab_company_contact_number}</td>
  </tr>
  <tr>
    <td class="label">Contact No.</td>
    <td>{ab_personal_number}</td>
    <td colspan="2">{ab_address_1}</td>
  </tr>
  <tr>
    <td class="label">Email</td>
    <td><a href="mailto:{ab_email}">{ab_email}</a></td>
    <td colspan="2">{ab_address_2}</td>
  </tr>
  <tr>
    <td class="label">Facebook</td>
    <td><a href="{ab_facebook}" target="_blank">View page</a></td>
    <td colspan="2">{ab_city}</td>
  </tr>
  <tr>
    <td class="label">Twitter</td>
    <td><a href="{ab_twitter}" target="_blank">View feed</a></td>
    <td colspan="2">{ab_county}{if ab_country}, {ab_country}{/if}</td>
  </tr>
  <tr>
    <td class="label">LinkedIn</td>
    <td><a href="{ab_linkedin}" target="_blank">View profile</a>
      <td colspan="2">{ab_post_code}</td>
    </tr>
  </table>
{/exp:address_book:contacts}

```

Ideally I need to find a way to output this data in a single tag, rather than having to specify the layout in the site template files. Is there any way to do this?

Here is my function in my mod.module.php file:

```
public function contacts()
{

    $contact_id = $this->EE->TMPL->fetch_param('contact_id');

    $tagdata = $this->EE->TMPL->tagdata;

    $this->EE->db->select('*');
    if( $contact_id ) {
        $this->EE->db->where('id', $contact_id);
    }
    $this->EE->db->from('address_book');
    $this->EE->db->order_by('first_name', 'asc');

    $query = $this->EE->db->get();

    if ($query->num_rows() == 0)
    {
        return $this->EE->TMPL->no_results();
    }

    foreach ( $query->result_array() as $row ) {
        $variables[] = array(
            'ab_title' => $row['title'],
            'ab_first_name' => $row['first_name'],
            'ab_last_name' => $row['last_name'],
            'ab_personal_number' => $row['personal_contact_number'],
            'ab_company' => $row['company'],
            'ab_company_contact_number' => $row['company_contact_number'],
            'ab_address_1' => $row['address_street_1'],
            'ab_address_2' => $row['address_street_2'],
            'ab_city' => $row['address_city'],
            'ab_county' => $row['address_county'],
            'ab_country' => $row['address_country'],
            'ab_post_code' => $row['address_post_code'],
            'ab_website' => $row['website'],
            'ab_email' => $row['email_address'],
            'ab_facebook' => $row['facebook'],
            'ab_twitter' => $row['twitter'],
            'ab_linkedin' => $row['linkedin'],
            );
    }

    return $this->EE->TMPL->parse_variables( $tagdata, $variables );

}

```

Any help would be greatly appreciated, thank you.

# Answer
> 1 votes
The best coding practice is to utilize view files in order to achieve that.

---
Tags: add-on-development, module, tags, variable
---


# Question
Title: Forgot Password Email Notification not rendering {username}
I am using Profile:Edit to display the "Forgot Password"/Reset form. They work fine. I get the Notification email, but in the email I get this:

===========

Admin,

To reset your password, please go to the following page:

http://local.729beauty.com:8888/?ACT=78&resetcode=s4ss0gFz&return=profile%2Freset\_password

Then log in with your username: {username}

If you do not wish to reset your password, ignore this message. It will expire in 24 hours.

729 Beauty http://local.729beauty.com:8888/

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

Notice that {username} does not get rendered.

I found this post: Does {name} always equal {username} in Forgotten Password template? which suggests that {name} and {username} are the same, but not so. In my case, {name} = Admin, and {username} = super\_admin.

I am not sure if this is an issue with EE install or Profile:Edit. Thoughts?

# Answer
> 0 votes
I would say this is an EE omission or simply a typo, although I've not used Profile:Edit before.

The text in your email notification *(Design \> Message Pages \> Email Notifications)* is the default 'forgot password' notification, and when you look at this page in EE, you can see the variables available for use in the template; `{username}` is not an option but its been included in the template.

Although `{name}` and `{username}` can be different, EE doesn't offer the facility to remind people of their username at this point, only to reset password. Other templates do include the `{username}` variable, so I can't imagine it would be too difficult to add.

It would make a nice touch to be able to include it in the password reset process, as this is triggered by your email address, which might not be the username.

---
Tags: cartthrob, profile-edit
---


title: ExpressionEngine Conditionals if:elseif

text:
# Question
Title: ExpressionEngine Conditionals if:elseif
I'm having trouble getting a condition to evaluate properly: http://goo.gl/wWkw4E.

Here's what I'm trying to achieve:

1. If an image has been uploaded, show image 1
2. If no image has been uploaded but the post is category 4, show image 2 (male)
3. If no image has been uploaded and the post is not category 4, show image 3 (female)

Your help is highly appreciated :)

# Answer
> 2 votes
I can't see the point of using an manipulation on conditional. All manipulations are generated for the directory you set to use on the field.

Please, test this:

```
{categories}
  {if voice_talent_headshot}
    {voice_talent_headshot:thumb80}
  {if:elseif category_id == '4'}
    {assets}/images/headshot-man.png
  {if:else}
    {assets}/images/headshot-woman.png
  {/if}
{/categories}

```

---
Tags: conditionals
---


# Question
Title: Upgrade error: Unknown column ‘protect_javascript’ in ‘field list’
I’m attempting to upgrade from 2.1.3 to 2.9 (I realize this should have been done before now; just took over this site recently). The upgrade fails at 2.5.5 with the following error:

> Error Number: 1054
>
> Unknown column ‘protect\_javascript’ in ‘field list’
>
> UPDATE `exp_templates` SET `template_id` = ‘36’, `site_id` = ‘1’, `group_id` = ‘10’, \>`template_name` = ‘.client\_name’, `save_template_file` = ‘n’, `template_type` = ‘webpage’, \>`template_data` = ‘{exp:channel:entries channel=\\"projects\\" entry\_id=\\"{embed:project\_entry\_id}\” limit=\“1\” dynamic=\“off\”}\n\n{work\_client}{work\_client:title}{/work\_client}\n\n{/exp:channel:entries}’, `template_notes` = ‘’, `edit_date` = 1405662666, \>`last_author_id` = ‘1’, `cache` = ‘n’, `refresh` = ‘0’, `no_auth_bounce` = ‘’, \>`enable_http_auth` = ‘n’, `allow_php` = ‘n’, `php_parse_location` = ‘o’, `hits` = ‘0’, \>`protect_javascript` = NULL WHERE `site_id` = ‘1’ AND `template_id` = ‘36’
>
> Filename: /home/skeo/webapps/skeo\_dev/system/expressionengine/models/template\_model.php
>
> Line Number: 389

I tried manually adding a protect\_javascript column of type char(1) (guessed based on documentation) but I still get the error. Anyone encountered this? I’ve seen discussion of this happening in other upgrades with other fields but not this one.

# Answer
> 4 votes
For the sake of completeness you can fix this with a simple SQL query to add the required column. See see this official EE thread

# Answer
> 2 votes
Quick dirty nasty fix to get you out of a hole.

EE is was having a problem with the contents of a template when I ran into this.

Go to your exp\_templates table and find the offending template. (in your case it's '36')

Remove template data and leave it blank. (obviously store this somewhere for later retrieval)

Run update.

Add your template data back (in CP or in TPL dir) and see what EE complains about.

# Answer
> 0 votes
Adding `protect_javascript` to the DB likely won't fix it. There is something in your templates that is throwing the error. BY simply clearing out the data for the specific template in your DB the installer should be able to run just fine.

Here are the steps I took to solve this:

Access the exp\_templates table using phpmyadmin or something similar.

Find the rows that correspond to the template ID in the error (I had about 10-12 total errors all related to this). Delete the content that is in the *template data* field until you no longer get them. Proceed with the installer (i just hit refresh on the installer after clearing the field in phpmyadmin).

Keep in mind, as long as you have a hard copy of your templates somewhere you don't need to worry about saving what is in *template data*. You can sync that up again later in the CP.

One thing to note, all the templates that through this error in this specific instance were utilizing the old `{related_entries}` tag pair.

---
Tags: database, upgrade
---


title: Zoo Visitor not outputting all members

text:
# Question
Title: Zoo Visitor not outputting all members
I'm using EE 2.8.1 and Zoo Visitor 1.3.32.

I'm trying to output a list of all members using

```
{exp:zoo_visitor:memberlist}

    {title}

{/exp:zoo_visitor:memberlist}

```

and have also tried

```
{exp:channel:entries channel="members" status="not closed" dynamic="no"}

     {title}

{/exp:channel:entries}

```

But each time it only outputs 3 members out of 15. The members it does output are guests and super admins - it won't output any member of the default Members group.

Any body come across this before?

# Answer
> 1 votes
I figured out what's happening here.

I'm also using transcribe on this site and it somewhat hijacks the channel entries output. The entry ID needs to be in the `exp_transcribe_entries_languages` table to be output on the frontend.

All of the members that weren't outputting were added through a front end Zoo Visitor registration form but this wouldn't take into account the need to add the entry into this table.

Any that were outputting I had viewed/edited the entry in the CP, meaning Transcribe kicked in and sorted out the multilingual side of things.

**Solution**

Add `transcribe='disable'` to your channel entries or zoo visitor tag.

---
Tags: members, zoo-visitor, transcribe, zoo
---


# Question
Title: Devdemon forms not working when there is a 301 redirect
If I have the following in my .htaccess

```
    RewriteCond %{HTTP_HOST} !^www\.domain\.com$
    RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

```

When I go to submit a form on the website, forms just essentially refreshes the page. There is nothing in the database and no email is received. If I comment out those two lines, then it will work fine. In the general configuration it is set to http://www.domain.com. I'm also submitting the form with the www. in the address bar.

EE 2.6.1 Forms 3.3.5

# Answer
Thanks Derek, for pointing that out.

I edited system/expressionengine/config/config.php and changed

```
$config['base_url'] = "http://domain.com";

```

to

```
$config['base_url'] = "http://www.domain.com";

```

Then added the Rewrite back to my .htaccess

```
RewriteCond %{HTTP_HOST} !^www\.domain\.com$
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]

```

After doing this, I was able to successfully submit the form.
> 1 votes

---
Tags: devdemon, devdemon-forms
---


# Question
Title: EE's Compatibility Wizard - what modules are in suggested & optional?
Trying to work out what server modules (\*nix) I need the hosting admin to install to have green across the board.

Specifically we currently have No for the following:

* CAPTCHAs feature and watermarking in Image Gallery
* JPEG Image Resising User GD (or GD 2)

See result of running the wizard below.

Thanks Brendan

# Answer
OK, I checked and managed to work out with the hosting provider what needed to be done. Basically with the PHP config, we needed the following flags set:

For CAPTCHA support:

```
'--enable-gd-native-ttf'

```

For JPEG Image Resizing support (path different depending on server setup):

```
'--with-jpeg-dir=/usr/lib'

```
> 0 votes

# Answer
If you install Expression Engine and you doesn't need a Captcha feature (to avoid spams), or no need to resize jpeg picture, it will works fine.

But if you really need a system similar to avoid spams, exists a lot of addons about this.
> -1 votes

---
Tags: compatibility
---


# Question
Title: Low Reorder, count, and total_results - trying to test for last entry in each category
I have a people page that is separated into three different categories, and I am using Low Reorder to allow my client custom control over what order the people are displayed in each category. That part works great. Now I'm trying to customize the output so that the final entry in each category is tagged with a specific class so that the layout will work right.

Here is what my template code looks like:

```
{exp:channel:categories style="linear" channel="People" show_empty="no"}
<h3>{category_name}</h3>
<div class="row">
{exp:low_reorder:entries set="staff" category="{category_id}"}
    <div class="large-3 columns text-center{if count == total_results} end{/if}">
        <p>... CE Image stuff ...</p>
        <h4 class="staff-grid-name"><a href="{page_url}">{count} {title} {total_results}</a></h4>
        <p class="organization-title staff-grid">{exp:low_widont}{person_organization_title}{/exp:low_widont}</p>
    </div>
    {switch='|||</div><div class="row">'}
{/exp:low_reorder:entries}
</div>
{/exp:channel:categories}

```

The relevant bit is this: `{if count == total_results} end{/if}`. I added in the `{count} {title} {total_results` so I could see what the count and total\_results fields were.

The output I get is this:

* All entries in the first category have a count of 1 and total\_results of 3
* All entries in the 2nd category have a count of 2 and total\_results of 3
* All entries in the 3rd category have a count of 3 and total\_results of 3
* Since all the 3rd category entries have total\_results of 3, all entries in that category are tagged with the "end" class

Perhaps there's another way to achieve what I'm trying to do? Thanks!

UPDATE: I was able to achieve the desired layout effect by just giving all of the entries the 'end' tag, but this is inelegant to be sure. I am still interested in solving this problem the "right" way.

# Answer
> 1 votes
This is because of nesting the tags. Both `{count}` and `{total_results}` are used by both tags, so the outer tag parses the ones in the inner tag.

To avoid, you can either put the LR tag in an embed (with an embed variable), or (preferably) if you're using Low Variables, use LV like so:

```
{exp:low_variables:single var="lv_low_reorder_snippet" preparse:category_id="{category_id}"}

```

Third way to work around it, and perhaps the easiest, is to use LR's prefix parameter, for example:

```
{exp:low_reorder:entries prefix="pfx_" ... }
    {if '{pfx_count}' == '{pfx_total_results}'} ... {/if}
{/exp:low_reorder:entries}

```

---
Tags: categories, low-reorder
---


# Question
Title: Advanced search form not returning results
I'm going crazy here trying to find where I've went wrong.

I have two search functions on my site, the first one in my site header area using `{exp:search:simple_form}`, the second located on search/index which uses `{exp:search:advanced_form}`.

Simple Search is working perfectly, returning results to keyword searches. However I can't get my Advanced Search to return any results... AT ALL!

My Advanced Search code, based closely on the example in EE's docs:

```
{exp:search:advanced_form result_page="search/results" channel="not event_venues|homepage_spotlight|home_page|publications|legal_notices" category="not 14|26" no_result_page="search/no-results" results="10" show_future_entries="yes" form_class="advanced-search"}
    <fieldset>
      <legend>{lang:search_by_keyword}</legend>
      <div class="adsearch-keywords">
        <p>
          <label for="advancedKeywords">Keywords:</label>
          <input type="text" name="keywords" id="advancedKeywords" value="">
        </p>
        <p>
          <label for="search_in">Search in:</label>
          <select name="search_in" id="search_in">
            <option value="titles" selected="selected">{lang:search_in_titles}</option>
            <option value="entries">{lang:search_in_entries}</option>
          </select>
        </p>
        <p>
          <label for="where">Where:</label>
          <select name="where" id="where">
            <option value="exact" selected="selected">{lang:exact_phrase_match}</option>
            <option value="any">{lang:search_any_words}</option>
            <option value="all">{lang:search_all_words}</option>
            <option value="word">{lang:search_exact_word}</option>
          </select>
        </p>
      </div>
      <div class="adsearch-channels">
        <p>
          <label for="channel_id">{lang:channels}:</label>
          <select id="channel_id" name="channel_id[]" size="8" multiple="multiple" onchange="changemenu(this.selectedIndex);">
            {channel_names}
          </select>
        </p>
      </div>
      <div class="adsearch-categories">
        <p>
          <label for="categorySelection">{lang:categories}:</label>
          <select name="cat_id[]" size="8"  multiple="multiple" id="categorySelection">
          <option value="all" selected="selected">{lang:any_category}</option>
          </select>
        </p>
      </div>
    </fieldset>
    <fieldset>
      <legend>Dates and sorting</legend>
      <div class="date">
        <select name="date">
          <option value="0" selected="selected">{lang:any_date}</option>
          <option value="1">{lang:today_and}</option>
          <option value="7">{lang:this_week_and}</option>
          <option value="30">{lang:one_month_ago_and}</option>
          <option value="90">{lang:three_months_ago_and}</option>
          <option value="180">{lang:six_months_ago_and}</option>
          <option value="365">{lang:one_year_ago_and}</option>
        </select>
        <div class="date_order">
          <input type="radio" name="date_order" value="newer" id="newer" class="radio" checked="checked">
          <label for="newer">{lang:newer}</label>
          <input type="radio" name="date_order" value="older" id="older" class="radio">
          <label for="older">{lang:older}</label>
        </div>
      </div>
      <div class="orderby">
        <select name="orderby">
          <option value="date">{lang:date}</option>
          <option value="title">{lang:title}</option>
        </select>
        <div class="sort_order">
          <input type="radio" name="sort_order" class="radio" value="desc" id="descending" checked="checked">
          <label for="descending">{lang:descending}</label>
          <input type="radio" name="sort_order" class="radio" value="asc" id="ascending">
          <label for="ascending">{lang:ascending}</label>
        </div>
      </div>
    </fieldset>
    <input type="submit" value="Search" class="button">
  {/exp:search:advanced_form}

```

What am I missing? What have I got wrong that it isn't returning any results? Or is there a setting within EE that I need to enable? Obviously I have channels and custom fields searchable within EE as I am getting results for the Simple Search form.

Thanks for any help.

# Answer
I found that this is a reported bug with EllisLab as of 2.7.3: https://support.ellislab.com/bugs/detail/20059/search-module-tag-category-parameter-does-not-support-not-as-documented
> 0 votes

---
Tags: search
---


# Question
Title: How to get the Assets index in looping field tag pair?
I'm converting some code over from using grid fields with images to use a single Assets field instead. All good so far.

But I need a way to get at the index (current asset number while looping through the field tag pair).

Looking over the docs, I don't see an obvious way to do this. {my\_asset\_field:index} doesn't appear to be a valid expression.

# Answer
> 0 votes
When you say **'index'** do you mean something like the *{count}* variable in a Channel Entries loop?

If so then I believe *(if my memory serves me correctly*) that the files tag pair allows you to use the *{count}* variable inside it.

I really hope I'm not remembering this incorrectly though.

# Answer
> 0 votes
You're correct, even though it's not documented anywhere on the Assets documentation, I discovered that {count} does indeed work for it.

If you're like me, and needed an index (zero-based), I found that this plugin will do the trick for you without having to enable PHP for your template page:

http://devot-ee.com/add-ons/mh-index

---
Tags: assets
---


# Question
Title: Changes /edits not reflected on live site but can publish new or delete
I have a site I moved from one server to another and everything looks good but when I try and edit an entry the changes are accepted and saved, but when I view the front/public page the changes/edits are not being shown.

If I go back and look at the entry, the changes are still saved, just not on the front end.

This is an EE 1.7.3 site

I checked my config file and the database settings are correct. How could the changes be saved on the back end but not the front end?

Strangely I can add a new entry or delete an entry, just not make an edit

# Answer
> 1 votes
If you moved the site from one server to another (the actual physical files) then did you delete the Cache folder or not?

Have you tried to delete it and see if that fixes things on the front end?

As to the backend you say you can't edit some entries but in what way **can't** you edit the entries? Can you click on them to edit them but then they don't save or do you click on the save button and you get an error or something else?

# Answer
> 0 votes
Do you have any template or entry caching going on? Or third party caching at the server level? Can you verify that what's showing on the front end is in fact the entry you think it is by exposing but commenting out the entry id in the template?

# Answer
> 0 votes
seems to be a strange caching issue. I was forced to duplicate the template group and everything works as it should.

---
Tags: channel-entries
---


title: Trouble with resetting passwords

text:
# Question
Title: Trouble with resetting passwords
On a site running EE 2.7.2 there is a problem with resetting passwords from the auto-generated reset link.

When a user clicks on **Forgot your password?** at the login screen and submits their email address, an email with the following link is generated:

> http://sitexyz.com/index.php?S=0&D=cp&C=login&M=reset\_password&resetcode=KJ82wnTS

However, when you click on that link it takes you to the home page instead of the password reset page. Any clues why this is happening and what the solution is?

# Answer
> 0 votes
The problem was the CP Url in the config file. It had the CP as index.php instead of admin.php.

Problem solved.

# Answer
> 0 votes
The CP URL in the config file was already set as admin.php for myself.

I am still running into the issue that the link sends you back to the home page. The link is correct... ".com/preferred-member-registration/forgot\_password", however this 'forgot password' URL is linked to the sites homepage.

Thoughts?

---
Tags: password, forgot-password
---


# Question
Title: Cartthrob 2.6 tax being calculated incorrectly with allow_user_price
I seem to have found a bug with Cartthrob 2.6 where the tax is calculated incorrectly when using allow\_user\_price="yes" within the "add\_to\_cart\_form" tag. The cart seems to display the tax of the item, rather than the allowed user price which should override this. The previous version of CT was working fine.

(Updated on EE 2.9)

Has anyone come across this and found any solution? I will have a dig about to see what is going on, but it's unusable in my case until I find a fix.

**UPDATE:** I've looked into this further and it seems to be where the base\_price() function is called and uses retrieves the item's price rather than the dynamic price in this case (found in in cartthrob/core/item/Cartthrob\_item\_product.php).

If there's a way to detect if product has a dynamic price, then we could tell it to use retrieve the calculated price. However I am unable to see any identifier to say this has a dynamic price within the $item/$this object? Or perhaps I'm missing something?!? Any suggestions very welcome...

Thanks

# Answer
> 1 votes
Ah yes... The fix is to replace line 566 within the cartthrob/cartthrob/core/Cartthrob\_item.php file.

This is within the get\_item\_tax function where you'd replace:

```
$tax = $plugin->get_tax($this->base_price(), $this);

```

with

```
$tax = $plugin->get_tax($cost, $this);

```

This fixed the problem and haven't seen any issues with it.

---
Tags: cartthrob
---


# Question
Title: CartThrob {if error:your_field} conditional not working for item_options
Trying to use CartThrobs Inline Errors within a add\_to\_cart\_form to validate a simple form with two fields. For the **price** field, the validation works, but for the **item\_options\[invoice\_number\]** it does not. Here is the code for the form and both fields.

```
    {exp:cartthrob:add_to_cart_form
        return="/portal/checkout/" secure_return="no"
        on_the_fly="true" allow_user_price="yes"
        title="Invoice Payment" quantity="1"
        error_handling="inline"
        rules:item_options[invoice_number]="required|is_numeric"
        rules:price="required|is_numeric"
        shipping_exempt="yes" tax_exempt="yes"
        }

        <div class="row">
            <div class="six columns">
                {if error:item_options[invoice_number]}<span class="error">{/if}
                <label for="item_options[invoice_number]">Invoice #</label>
                <input type="text" name="item_options[invoice_number]" class="textinput required" value="" />
                {if error:item_options[invoice_number]}<p>Enter a value.</p></span>{/if}
            </div>
            <div class="six columns end">
                {if error:price}<span class="error">{/if}
                <label for="price">Amount</label>
                <input type="text" name="price" data-symbol="$" class="textinput required dollar-amount" value="" />
                {if error:price}<p>Enter a numeric value.</p></span>{/if}
            </div>
        </div>
        <div class="row">
            <div class="large-12 columns">
                <input type="submit" class="btn btn-large spacebeforesm" value="Enter Payment Info →" />
            </div>
        </div>
    {/exp:cartthrob:add_to_cart_form}

```

The error

```
Error
You have an invalid conditional in your template. Please review your conditionals for an unclosed string, invalid operators, a missing }, or a missing {/if}.
Parser State: Unexpected ‘[’ (MISC); expected RD in Template “portal/pay-invoice” on line 27.

```

Line 27 is the first **{if error:item\_options\[invoice\_number\]}**. It will render if I remove the brackets **{if error:item\_options}** Does not matter what value I insert between the brackets, the page will not render.

Documentation doesn't indicate that it won't work with item\_options. And as often as the item\_options is used, it is also likely that it works with item\_options.

# Answer
I had a similar issue. Try adding quotes around the full tag so that you have:

```
{if "{error:item_options[invoice_number]}"}

```

Hopefully that should resolve it.
> 2 votes

---
Tags: cartthrob, conditionals, error
---


title: Tagger 404 Page

text:
# Question
Title: Tagger 404 Page
We've used Tagger on a website and it works just fine, but the client would like a 404 error to display if someone manually typed in

Example: http://www.example.com/projects/tags/education/

manually changed to http://www.example.com/products/tags/not-a-tag

results in a blank page vs. a 404.

```
{exp:tagger:entries_quick tag="{segment_3}"}
          <h1>Press Room: <span style="text-transform: capitalize;">{segment_3}</span></h1>
          {/exp:tagger:entries_quick}
          {exp:tagger:entries_quick tag="{segment_3}"}
          {exp:channel:entries channel="press_post" limit="5" dynamic="yes" entry_id="{tagger:entry_ids}" paginate="bottom"}
                    <div class="blogpost">
                        <div class="fourty">
                        {press_images limit="1"}
                            <img src="{image:url:small}" alt="" class="siteimage" />
                          {/press_images}
                        </div><!--fourty-->
                        <div class="sixty">
                            <h2>{title}</h2>
                            <p class="tags">

                {entry_date format="%M %j, %Y"} | Tags:
          {exp:tagger:tags entry_id="{entry_id}" limit="1" dynamic="yes"}
          <a href="{site_url}index.php/press-room/tags/{tagger:tag_name}/" class="taglink">{tagger:tag_name}</a>
          {/exp:tagger:tags}

```

I tried the below, but it doesn't forward off. {exp:channel:entries channel="press\_post" limit="5" dynamic="yes" entry\_id="{tagger:entry\_ids}" paginate="bottom"} {if no\_results}{redirect="404"}{/if}

Live Site: http://goo.gl/Dlsj2G

# Answer
I tried to understand your code, but I couldn't find any reason to split `exp:tagger:entries_quick` into two parts or where you're closing the second one, but I gonna try to help you.

You code doesn't work because the `exp:channel:entries` will never run if there is no results on `exp:tagger:entries_quick`.

Inside `{exp:tagger:entries}`, you can set a conditional `{if tagger:no_entries}`:

```
{exp:tagger:entries tag="{segment_2}" custom_fields="press_images"}

    {if tagger:no_entries}
        {redirect=""}
    {/if}
    <h1>Press Room: <span style="text-transform: capitalize;">{segment_3}</span></h1>

    [...]

{/exp:tagger:entries}

```

You can get more info on Tagger docs.
> 0 votes

---
Tags: devdemon-tagger
---


# Question
Title: Structure nav to show only specified entry ids?
Is it possible to have a structure:nav tag that only brings in the entry ids that are specified? I've tried the other way round and excluding all other ids but it seems a bit overkill and doesn't actually work.

Any help would be awesome.

Thank you.

# Answer
> 1 votes
Yes, you sure can by using the structure entries plugin.

devot-ee.com/add-ons/structure-entries

---
Tags: structure
---


# Question
Title: Trying to find a more efficient way of plotting lots of markers onto a Google Map
I've got a directory channel, and each entry has been manually geocoded onto a map with the Google Maps for ExpressionEngine fieldtype. I now want to plot these 1,000 entries onto a single map in the most efficient way, and each category of entry has a different marker (6 categories in total).

Here's the code I'm using with Google Maps for EE:

```
{exp:gmap:init id="map1" class="gmap" scrollwheel="false" style="width:940px;height:500px" latitude="35.0000" longitude="25.0000"}

{exp:channel:entries channel="directory" status="open" disable="category_fields|member_data|pagination" limit="1000" dynamic="no" sort="asc" search:cf_directory_map_latitude="not IS_EMPTY"}

  {categories show_group="2" limit="1"}

    {cf_directory_map_location id="map1" show_one_window="true" icon="{category_image}" infobox="true" offsetY="-35" offsetX="15" closeBoxMargin="5px" class="ui-infobox-dark" closeBoxURL="/themes/third_party/gmap/css/images/white-close-button.png" style="width: '300px'" alignBottom="false" clearanceX="10" show_one_window="true" extend_bounds="false"}

      <h3>{title}</h3>
      <p><strong>City: </strong>{cf_directory_city}<br />
        <strong>Type: </strong>{category_name}</p>
      <p><a href="{cf_directory_website}" target="_blank">Visit Website »</a></p>

    {/cf_directory_map_location}

  {/categories}

{/exp:channel:entries}

```

The above works, but I feel that the code it's outputting is bloated when outputting so many entries. Every marker on the map is outputting its own script tag that is 45 lines long. So multiply this by 1,000 entries, and you end up with 1,000 sets of script tags, and 45,000 lines of code, which means that the page can be a few megabytes in size and slow to load, even when using caching.

Is there a more efficient way of plotting entries onto a map with this add-on? Or if not, is there an easy alternative that I can use which makes use of the data I already have for each entry (the Google Maps for EE field, or else the standard latitude/longitude fields)? Thanks for any advice.

# Answer
> 2 votes
The basic concept behind what you need to do is generate a JSON response of your markers, and loop through them with JS and add them to the map manually. That's really the only want around the procedural JS that is injected into your page. You could load the JSON feed asynchronously too.

# Answer
> 1 votes
You might want to consider a custom query. I don't know much about exp:gmap:init but the channel entries tag can be a bit of an overkill sometimes when it comes to simple output.

# Answer
> -2 votes
use clustering .make group of markers as cluster.one cluster will present many markers inside.

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


# Question
Title: GWcode CatMenu: Do Not Show Empty Children
How do I set GWcode CatMenu to not show child categories that have no entries assigned to them? The `show_empty="no"` parameter only seems to work for parent categories.

Here's my code:

```
{exp:gwcode_catmenu style="linear" cat_id="5" active_branch_only="yes"}
    {if cat_id != 5}
        <li><a href="{path='home/products_grid/category/{cat_url_title}'}">{cat_name}</a></li>
    {/if}
{/exp:gwcode_catmenu}

```

# Answer
Did you enable the `entry_count` parameter?

```
{exp:gwcode_catmenu
    style="linear"
    cat_id="5"
    active_branch_only="yes"
    entry_count="yes"
    show_empty="no"
}
    {if cat_id != 5}
        <li><a href="{path='home/products_grid/category/{cat_url_title}'}">{cat_name}</a></li>
    {/if}
{/exp:gwcode_catmenu}

```
> 1 votes

---
Tags: gwcode-categories
---


title: Request: Disabled image size inline css

text:
# Question
Title: Request: Disabled image size inline css
The last few years we have been working for most of the time on responsive designed websites, and every time we are using ExpressionEngine and Wygwam module, we get complains from our clients regarding the automatic adding the inline css of the width + height when they add an image.

I've looked at this: Stopping WYGWAM from assigning dimensions to images

and this: https://stackoverflow.com/questions/2051896/ckeditor-prevent-adding-image-dimensions-as-a-css-style

But have not had any success to implemented with the latest Wygwam and it is annoying to doing hacks and have to renew it every time we update the module.

In one of the articles I've read, it says that I can add some code to config.js (where ever that is on the latest Wygwam):

```
config.disallowedContent = 'img{width,height}';

```

and that would solve the problem.

Can this be added as a default feature on future Wygwam releases, or a feature when we install Wygwam?

Thanks

# Answer
Here is the code I use to automatically resize images in Wygwam fields and remove the dimensions. It also stops them adding stupidly large images. It requires CE Image, but why wouldn't you have that installed anyway? The Bulk tag info is here, you just wrap it around your Wgwam field.

```
{exp:ce_img:bulk max="300" crop="no" allow_scale_larger="no" add_dims="no" attributes='style="float: right; margin-left:2%;"'}
{wygwam_field name}
{/exp:ce_img:bulk}

```
> 1 votes

---
Tags: pixelandtonic, wygwam
---


# Question
Title: Which version of MSM is compatible with EE 2.8.1?
I recently updated my EE installation to **EE 2.8.1**. All is well except I cannot get Multi Site Manager to work. I'm currently using **MSM Version: 2.1.7 Build: 20140715** and when attempting to switch to a different site's control panel using the site dropdown within the control panel, I'm presented with the following error:

```
Fatal error: Call to undefined method Cp::switch_site() in /system/expressionengine/controllers/cp/sites.php on line 57.

```

Within each of my site's main admin.php file, I've set `site_name` and `cp_url` within the `$assign_to_config` array but the settings are not working.

I'm wondering if the version of MSM that I have is not usable with EE 2.8.1. Can anyone confirm this or does anyone have any insight as to why I'm receiving this error?

# Answer
Each release of the Multi-site Manager module is *only* compatible with the release of ExpressionEngine it accompanied. So in your case, MSM 2.1.7, was released alongside EE 2.9.0, so it won't run with 2.8.1.

If you can't upgrade to EE 2.90 for some reason, I'd contact EllisLab to see if they can provide a compatible version of the MSM module.
> 1 votes

---
Tags: control-panel, multi-site-manager
---


title: Register user without password

text:
# Question
Title: Register user without password
We're looking for a way to register a user without requiring that they specify a password and instead mail them the password as part of the account verification process.

Is this even remotely possible with EE or a module like Expresso FreeMember?

# Answer
> 0 votes
FWIW Simple Registration has support for disabling passwords in the signup form, auto-generating a password and emailing that password to the user.

http://devot-ee.com/add-ons/simple-registration

# Answer
> 0 votes
On your form, you could set the password field as "hidden" and give it a value. (Either hardcode in a value or - better yet - have some randomly-generated string as that field value.) Then, as part of the account verification process, they're shown a link to retrieve their "lost" password and reset it.

The downside there is that the password - whether randomly-generated or hardcoded - would be visible in the page source. This could net you a lot of spam signups, which is never fun.

Is there a reason you're doing this? If you're trying to cut down on spam signups, and force a multi-step account verification procedure, couldn't you route everyone into a certain member group, and have all new members perform some minor task (entering some data into a form that's visible only to members in that group, for example) - and then everyone who doesn't perform that task in five days, their membership is either deleted, or they're moved to the Banned members group?

---
Tags: registration, password
---


# Question
Title: Plugin to show download only after the form has been fielded out?
Is there a plugin that will only show the Download path after a form has been filled out eg: after the email address has been filled out and the user clicks on submit the download url will be returned?

# Answer
> 1 votes
Link Vault is a good one.

Alternatively you could always display the link on the forms result page and utilise Freeform to control validation of the results page and saving of the form data.

---
Tags: forms
---


# Question
Title: Solspace tag incorrect number of entries returned
I'm using tags as a filter example here: http:// devsite2 . desworkdev . co . uk/selector (Test site). The number of products with a specific tag is show next to each tag name.

On certain tags, when I click through the number of products shown doesn't match. E.g. semi sweet (6) should have 6 products with that tag, however when I click through only 5 products are showing.

Could someone please let me know what could be causing this?

**UPDATE:**

* ExpressionEngine v2.9.0
* Tag 4.2.7

Code on the tag list page

```
{exp:tag:cloud channel="products" tag_group_name="default" limit="100"}
    <li><input type="checkbox" name="filter[]" value="{websafe_tag}"> <a href="{path='selector/tag'}/{websafe_tag}">{tag} ({total_entries})</a></li>
{/exp:tag:cloud}

```

Code on the tag entry page

```
{exp:tag:entries inclusive="yes" sort="asc"}
<div class="box3col">
     {if no_tag_results}
        <h2>No products match your tag selection</h2>
     {/if}

     <a href="{url_title_path='products/detail'}">
     {if new_product !=""}
         <span class="new"><img src="{site_url}images/interface/new.png" alt="New product" /></span>
     {/if}
     {if image_1 !=""}
            <img src="{image_1}" alt="" />
     {if:else}
            <img src="{site_url}images/uploads/default.jpg" alt="" />
     {/if}
     </a>
     <div class="copare-code-wrapper">
           <div class="prod-code"><p>Product code</p>{if recipe_code !=""}{recipe_code}{if:else}N/A{/if}</div>
     </div>
     <div class="info light">
         <h2>{title}</h2><p><a href="{url_title_path='products/detail'}">More info</a></p>
     </div>
</div>
{/exp:tag:entries}

```

URL: http://devsite2.desworkdev.co.uk/selector/tag/semi+sweet

# Answer
I realised some products have a highlight status so I needed to add the status parameter to {exp:tag:entries inclusive="yes" status="highlight|open" sort="asc"}
> 0 votes

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


# Question
Title: Pass variables through playa loop to use in an embed?
Currently I have a a channel page entry that then goes through a playa of secondary entries. I'd like to pass some of the parent's data like page title and description to the embdeds.

My code looks similar to this:

```
{exp:channel:entries}
    {exp:playa:children field="content"}
            {embed="some_widget" entry_id="{entry_id}" variable="{title}" description="{description}"}
    {/exp:playa:children}
{/exp:channel:entries}

```

I'd like to pass my embed:

```
{exp:channel:entries entry_id="{embed:entry_id}"  title="{title}" description="{description}"}
    <!--test-->
    {title}
    <br>
    {description}
{/exp:channel:entries}

```

Right now, it does embed the widget. But none of the information is passed along.

# Answer
> 2 votes
You don't have the embed syntax quite right. Passing `{embed:entry_id}` is correct, as that tells the `channel:entries` tag which entry to load. But there are no `channel:entries` parameters called `title` or `description`.

Instead, simply use them in the same way you used `{embed:entry_id}`.

Also - in your example, `{title}` will actually be the title of the *child* entry, not the parent. To use the parent's title inside of the Playa tag, use a `var_prefix` on `playa:children` \- this will prevent `{title}` from being replaced by Playa.

So your ending code:

```
{exp:channel:entries channel="foo"}
    {exp:playa:children field="content" var_prefix="widget"}
            {embed="some_widget" entry_id="{widget:entry_id}" title="{title}" description="{description}"}
    {/exp:playa:children}
{/exp:channel:entries}

```

Then in your embed:

```
{exp:channel:entries entry_id="{embed:entry_id}" dynamic="no"}
    <!--test-->
    {embed:title}
    <br>
    {embed:description}
{/exp:channel:entries}

```

---
Tags: playa, embeds
---


# Question
Title: problem with succes and error messages Message module 'Friends'
We have a problem with the way Messages to friends returns errors and succes message through the EE system. We call the form in an iframe. *(And solved form input errors with Jquery validation.)*

But the succes redirect still comes through EE. This makes the iframe collaps. Is there a way to avoid the EE success page?

EDIT

We solved the collapsing of the iFrame by changing the errorpage. But the wish to avoid that standard EE success page still stands. Is there a way to bypass it?

# Answer
Sorry, at this time the EE success page can't be avoided when submitting the {exp:friends:message\_form} form. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) http://support.solspace.com/support/discussions

Although it depends on your setup, you could perhaps try to submit the form in the background through ajax instead of moving away from the form to the success page after submission.
> 0 votes

---
Tags: solspace, solspace-friends
---


# Question
Title: How to offer visitors a "view all with tag X" option?
After wrestling with categories for too long as a way of organising a gallery, I've ditched that and gone to tags instead (using the Solspace module). But I am stuck on one point of presentation on the gallery index page: is there a good way of offering visitors an easy way to view all images tagged with X without having a massive tag cloud of all available tags displayed? Can tags be tied into a simple search so that they can just input the tag they want to look at?

The gallery uses a one image = one entry setup.

# Answer
I think you're looking for the **`{exp:tag:entries}`** tag to do this:

http://www.solspace.com/docs/tag/entries/

This will allow you to display a list of channel entries associated with a particular tag.
> 0 votes

# Answer
You could use the normal {exp:tag:cloud} tag. But list the results in a javascript array/object instead of the usual html output.

Using one of many autocomplete javascript plugins, you could make a simple search.
> -1 votes

---
Tags: solspace, search, tags
---


title: Safecracker File: Rename on Upload

text:
# Question
Title: Safecracker File: Rename on Upload
How can I rename files uploaded via Safecracker?

More specifically, I would like to prefix the file name with the logged in user's username, convert to lower case & replace spaces with hyphens.

I was using safecracker\_file\_add\_prefix

However, it no longer works since I upgraded from 2.4.0 to 2.5.3

Thanks!

# Answer
> 5 votes
I believe this is due to a new change in the safecracker/libraries/safecracker\_lib.php file for 2.5.3. It seems to be causing a lot of issues (like preventing the use of Safecracker in a Matrix field). Here's a forum link: http://ellislab.com/forums/viewthread/224822/P18/#1040436

Go to line 230 in safecracker\_lib.php and you'll see the following:

```
        if (isset($_FILES[$field['field_name']]['name']))
        {
            $_POST[$field['field_name']] = $_FILES[$field['field_name']];
        }

```

Comment out **$\_POST\[$field\['field\_name'\]\] = $\_FILES\[$field\['field\_name'\]\];**

```
        if (isset($_FILES[$field['field_name']]['name']))
        {
            /* HACK ppohler 11/13/2012, fix issue with Safecracker inside of Matrix */
            //$_POST[$field['field_name']] = $_FILES[$field['field_name']]['name'];
            /* HACK */
        }

```

Now safecracker\_add\_prefix should work (as well as Matrix). Keep in mind you'll want to log that you've made this change in core somewhere in case you need to update EE.

# Answer
> 0 votes
Rob has an updated version for Channel Form here: https://github.com/rsanchez/channel\_form\_file\_add\_prefix/

---
Tags: safecracker, file-uploads
---


title: Invalid "segment_2" to return 404

text:
# Question
Title: Invalid "segment_2" to return 404
Hi can anyone please help.

I have a template group called "blog", in that template group i have the following:

```
index.html
view.html

```

"index.html" holds all the blog items getting pulled through with channel entry tags limited to 9 with pagination.

```
<a href="{page_uri}">view page</a>

```

The "view.html" naturally holds the indivudal item.

Lets say

```
"http://www.domain.com/blog/news-item-one"

```

is an exisiting url HOWEVER

If it was miss-spelt or someone made up a fake url eg:

```
 "http://www.domain.com/blog/news-blah-sdf-d-twenty"

```

Basically what happens at the moment is the page constantly loads. I have strict\_urls enabled and have a set my own 404 page which is in a template group called "site" and its name is "404.html". This works fine when there is just one incorrect segment eg: /fake/

How can i get any not genuine segment\_2's to redirect to the 404 page.

Thankyou.

# Answer
> 1 votes
Like mark says, require entry in combination with the no\_results conditional
(i generally use dynamic=no and point the tag to the segment myself)

```
{exp:channel:entries channel="blog"
  require_entry="yes" url_title="{segment_2}"
  dynamic="no"}

  <h2>{title}</h2>

  {if no_results}
    {redirect="404"}
  {/if}
{/exp:channel:entries}

```

---

## Handle list and detail: With a single catch-all template

At a later stage you can use add-ons and sophisticated tools, but a basic way to clean up things is a couple of ***simple***(1) conditionals, for when you actually mean 404. e.g. when segment\_2 is empty you want to show the list, but when no entries are found just show a message, not the 404. When an invalid url\_title is provided (e.g. segment\_2 not empty) only then redirect to 404

```
{exp:channel:entries channel="blog"
    {if segment_2==""}limit="9"{/if}
    {if segment_2!=""}require_entry="yes" url_title="{segment_2}"{/if}
    dynamic="no"}

    {if segment_2==""} (listview) {title} {/if}
    {if segment_2!=""} (detailview) {title} {body} etc.{/if}

    {if no_results}
      {if segment_2==""}Sorry no entries we're found{/if}
      {if segment_2!=""}{redirect="404"}{/if}
    {/if}
{/exp:channel:entries}

```

---

## Handle list and detail: With Sub-templates

Or split up in the `index` template and have two templates to handle things separately:

```
{if segment_2==""}{embed="blog/listview"}{/if}
{if segment_2!=""}{embed="blog/detailview"}{/if}

```

---

## Other thoughts

This gets ugly and sophisticated soon if you also want to catch archives (`2014/10`), and categories (`category/bada55`). At which point you can decide to use dedicated templates for each:
`blog/` (list),`blog/entry/...` (detail), `blog/archive/...`, etc. and then you have to decide if `blog/entry/` (empty segment\_3) should 404 or redirect to `/blog/`

or ... go with some add-on solution (switchee, conditionals, template partials with stash etc. or resource-router (tip, for, if you're into PHP and like to catch stuff early!)) Anyway, whichever you choose, you'll probably regret it later on also, for maintainability sake. So, in the end, it is all a matter of taste, tools and practice that you need to grow onto and into.

Happy coding...

(1) Simple conditionals has/had to do with parse order. The simple {if segment\_x} conditional is parsed early. This is a topic by itself, which i leave to the reader to lookup.

---
Tags: 404
---


# Question
Title: How to code in notification mail a link to page with automatic login
Is there a way to code links in notification mails (to a potential logged out user) in such a way that the user goes directly to the message page, without the login procedure?

(In my case, Solspace Friends module generates a notification link to a page only visible for logged in members.)

# Answer
I solved the problem by using Logmein http://devot-ee.com/add-ons/logmein. In my notification template:

```
{path="registreren/return/"}/{friends_message_id}/{friends_recipient_username}

```

In template 'return' I grab the username wrapped in a condition if they are logged out:

```
{if logged_out}
    {exp:logmein:now username="{segment_4}"}
{/if}

{redirect= '/vrienden/mijn_berichten/message/{segment_3}/'}

```

and lead the user (now logged in) further to the desired template where he/she can see the message. Works like a charm. Thanks for making this plugin!
> 0 votes

---
Tags: email, login, solspace-friends
---


# Question
Title: Add data attributes to Cartthrob form tags
Is it possible - without an extension or hack - to add `data-` attributes to CartThrob's form tags?

```
{exp:cartthrob:save_customer_info_form data-foo="bar"}

```

# Answer
> 1 votes
Looking at the source code, I'd say not. In the form builder CartThrob uses, these are the only permitted form attributes:

```
protected $attributes = array('id', 'class', 'name', 'onsubmit', 'enctype');

```

# Answer
> 1 votes
Just ran into this same situation, instead of hacking cartthrob to accomplish, just modify the element after the form is created with some javascript to add the data-\* attribute:

```
<script>
    var checkout_form=document.getElementById('checkout');
    checkout_form.setAttribute("data-somekey", "someval");
</script>

```

Not beautiful but simple and it works!

---
Tags: cartthrob
---


title: 404 not working as expected

text:
# Question
Title: 404 not working as expected
I'm having trouble getting 404 pages to work. In Global Template Preferences I've set strict urls to yes (tried No as well) and have selected my 404 template.

My code on a single entry page is as follows.

```
{exp:channel:entries channel="services" disable="member_data|pagination|category_fields" limit="1" require_entry="yes"}

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

more code here
{/exp:channel:entries}

```

As far as I can tell this should go to a 404 page if I change the url to a non-existing url\_title in the final segment. What happens instead is the page displays including header, footer and sidebar, but the content is empty.

any ideas?

--UPDATE-- full template code is in a pastie here.

# Answer
> 3 votes
You'll need `{if switchee_no_results}{redirect="404"}{/if}` if nested inside switchee, due to switchee's `parse="inward"`

# Answer
> 1 votes
If you remove the {redirect="404"} from the conditional, and instead put something like 'no content' - does it show that?

whats the template group/page structure look like? I'm assuming you've got a 'services.group' and then servicing this code from an index.html (which is as I understand strict urls should work).

# Answer
> 1 votes
I had this problem and was getting a blank white page in some but not all instances. My 404 uses an entry so the client can modify the 404 message - so my 404 consisted of an entries tag pulling in a specific `entry_id`. Because the 404 might be invoked from anywhere else on the site, its entries tag was being confused by unexpected URL segments, so it needed the `dynamic="off"` parameter.

---
Tags: 404
---


# Question
Title: FreeForm Pro Composer State and Country field type how to show unselected?
I am using FreeForm Pro (4.2.0) with EE2 (2.9.0).

We are using the "Composer" method of creating forms to generate the select input Country and State field types.

I am seeing "Afghanistan" and "Alabama" being selected by default (by virtue of them being listed first in the alphabet).

Is there a way to add a *blank* leading option something like:

```
 <option value="" selected>Please select...</option>

```

Having the first value in the list selected is not working well versus form validation.

# Answer
> 1 votes
Sorry, that is currently not available. I recommend submitting this as a Feature Request under the specific add-on category. It'll also give other users the option to vote up the feature request, and help us prioritize features to add in upcoming versions of this add-on. :) http://support.solspace.com/support/discussions

In the meantime, if you feel adventurous, you can add an empty "Please select..." option by going into /system/expressionengine/third\_party/freeform/default\_fields/freeform\_ft.country\_select.php, and finding the display\_field() method (near line 94). In that general area you will find this line:

```
$countries = $this->get_countries();

```

Change that line to this:

```
$country_select_one[''] = 'Please select...';
$countries = $this->get_countries();
$countries = array_merge($country_select_one, $countries);

```

This will add an option with an empty value at the beginning of the country dropdown list.

---
Tags: solspace-freeform, solspace
---


# Question
Title: How to implement AJAX "add to cart" with Expresso Store?
I looked everywhere and i cant seem to find anyone talking about how they have done it... im sure i could write something custom to do it but wanted to see if anyone else out there had already solved the problem?

# Answer
It's fairly easy to create an AJAX add to cart button using Store. It's no different from any other AJAX form submission. This used to be in our user guide, but SE is a much better place for "how to" questions so I'll summarize here:

**The general process is:**

1. Create your sidebar cart as a separate template
2. Embed your sidebar cart inside a known div element in your main template
3. Add an id to your add to cart button
4. When the add to cart button is clicked, use javascript to post the form data via AJAX instead
5. When the AJAX request finishes, reload your sidebar cart div

**The javascript is fairly simple (assuming you have jQuery installed):**

```
<script type="text/javascript">
$(document).ready(function() {
    $('#add_to_cart_button').click(function() {
        var url = $(this.form).attr('action');
        var data = $(this.form).serialize();
        $.post(url, data, function() {
            $('#sidebar_cart').load('/store/cart');
        });
        return false;
    });
});
</script>

```

**Let’s step through this one line at a time.**

```
$(document).ready(function() {

```

This line should be fairly familiar if you have used jQuery before. It ensures the contained code won’t run until your page has finished loading.

```
$('#add_to_cart_button').click(function() {

```

Add a click handler to your add to cart button. Make sure your add to cart button has a matching `id=""` parameter.

```
var url = $(this.form).attr('action');
var data = $(this.form).serialize();

```

Get the url the form should be submitted to, and all the form data which would usually be submitted.

```
$.post(url, data, function() {
    $('#sidebar_cart').load('/store/cart');

```

Submit the form AJAX-style (in the background). When it’s finished, request “/store/cart”, and replace the contents of our with it.

```
return false;

```

This is important, to prevent the browser from doing whatever it would usually do next (which in this case is submit the form itself, and redirect to the checkout, which we no longer need).

You may also wish to add some javascript effects such as jQuery UI Transfer and a scroll-to-top.
> 9 votes

# Answer
In order to make this work with Store 2.0 / EE 2.7 you need to make an extra template with a form so a new XID is generated.
After the ajax request to the cart, make a new ajax request to the template with the form.
Get the xid from that template and update the xid on your orignal template

jquery / ajax:

```
url = 'ajaxform'
$.get(url, function(returnData) {
    var newXID = $(returnData).find('input[name="XID"]').val();
    $('input[name="XID"]').val(newXID);
});

```
> 3 votes

# Answer
As there is no action element on the add to cart form I need to get the URL using the following js

```
var url = $(this.form).find('input[name="return_url"]').val();

```
> 0 votes

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


# Question
Title: ExpressionEngine Automatic Category if not one set
I have a channel called blog, and i have just created a category group with some categories. I have assigned the group to the the channel "blog", as it stands each entry has no category assigned, is it possible to use a default category for the exisiting and new entries created until another is selected.

For example:

Categories:

```
General
Another category
Another category
Another category

```

Basically all the entries to automatically have General as a category unless i go into the entry and chance to a different category.

Or do i have to go into every entry and set a category?

# Answer
You can set a default category for all entries in a channel within the preferences for that channel.

Admin-\>Channels-\>Edit preferences

However if you mean that you want a category set *unless* another category is selected then you would need to use some kind of conditional statement in your template to pull entries that are not in any category.

I'd think about doing this using the category="not 1" parameter.
> 1 votes

---
Tags: categories
---


title: Linking entries with playa

text:
# Question
Title: Linking entries with playa
Basically i have a a channel called "testimonials", this channel has all the testimonial entries.

I have another channel called "franchise" this has all the entires for the franchises.

Basically i want to create a testimonial and with a playa field select what franchise entry this is associated with, and then on the franchise "view" page bring through any testimonials that is related to that entry.

Does anyone know how to do this? or know of another way?

EG:

Testimonial One \> Conwy Franchise

Then on the Conwy franchise view page bring through

Testimonial One.

Thanks Wes.

# Answer
1. Create Playa fields.
2. Add them to franchises. Actually what you illustrated is what you have to do opposite. Instead Testimonial \> Franchise, from Franchise Channel entry find playa relation field, which should contain list of testimonials and choose which to to relate with

Few notes: This is very simple relation - you can consider using built in EE relation field. If you are on latest EE.2.9 and Playa note they changed the syntax. !! Consider playa documentation

in template you can visualize relation like so

```
{testimonials}
  {testimonials:author}
  {testimonials:quote}
{/testimonials}

```

This is just an example. *testimonials* is the name of the playa filed.
> 1 votes

---
Tags: playa
---


# Question
Title: Resizing and cropping an image that is smaller than the desired/specified dimensions
I am pulling in images / video thumbs using Channel Video (so have no control over source size). If the video doesn't have an HD thumb, the image is much smaller.

I want the image to be resized (stretched) up the way and cropped in these instances. So, no matter what the image size is, it ends up with the dimensions below...

{exp:ce\_img:single src='{video:img\_url\_hd}' width='480' height='308' crop='yes|center,center' output='{made}' quality='68'}

This works correctly for images larger than the above dimensions. But smaller images stay the same.

I guess I am asking:

1) Would I be right in saying the resize and crop has no effect on images smaller than the desired/specified dimensions?

2) Is there a way for force the resizing and cropping on these smaller images?

# Answer
> 3 votes
I haven't used CE Image, but looking at the documentation it seems you need a parameter "allow\_scale\_larger" http://www.causingeffect.com/software/expressionengine/ce-image/user-guide/parameters#allow\_scale\_larger

And here's how you can achieve the cropping effect with CSS: http://jsfiddle.net/s552453s/ Unfortunately you are limited to cropping from the top instead of center without using Javascript to calculate image heights dynamically and use the padding/margin hack to center it within the div.

---
Tags: ce-image
---


# Question
Title: Splitting search results into tabs with no results messages
We're building a search that has a tabbed results page, we have a tab for each channel, works great apart from when there's no results for a particular channel and we're struggling to find the correct way to hide the tab or display a no result message for each individual tab.

Here's the code we currently have:

```
<nav class="tabs">
  <ul>
    <li><a href="#first">Tab 1</a></li>
    <li><a href="#second">Tab 2</a></li>
  </ul>
</nav>
<div>
    <ul>
 {exp:search:search_results switch="even|odd" limit="2000"}
      {if channel_short_name == "channel_name_1"}
         <li class="{switch}">
             content here
         </li>
       {/if}
 {/exp:search:search_results}
    </ul>
</div>
<div>
    <ul>
 {exp:search:search_results switch="even|odd" limit="2000"}
      {if channel_short_name == "channel_name_2"}
         <li class="{switch}">
             content here
         </li>
       {/if}
 {/exp:search:search_results}
    </ul>
</div>

```

We've tried the following:

no\_results with no joy, because we're using an if channel\_short\_name it won't know if that specific channel has no results.

Using {count} but this again includes all search results, not channel specific ones so doesn't work.

Using a new {exp:search:search\_results} tag for each tab, but seems you can't specify channel in the search tag so this doesn't work either.

Any ideas greatly appreciated!

# Answer
> 3 votes
Maybe there's a better native ee way without enabling php, but I would use Stash or Low Search.

Use Stash (set\_list) to set a list of all your search results and then you could have more control over outputting for each tab/channel (using get\_list). When you set your list set a variable for channel (i.e.: "my\_cached\_channel\_var"), and then when you output your list use 'match' and 'against' parameters on that same stash channel variable.

Use Low Search you could add a channel parameter to the results tag (from the docs: "The Results tag supports all parameters from the native channel:entries tag...").

# Answer
> 1 votes
Maybe a little bit of javascript/jquery to do it on the client-side :-)

**(1) jQuery Move / direct the stuff into the correct tab.**
First set a default \<li\> for each tab with a not-found message,
this can be replaced or removed after the result is set.

```
// all items
{chan:entries}
<li class="item {channel_short_name}">text</li>

// jQuery
$("#list .shortname1").appendTo('#tab_x');
$("#list .shortname2").appendTo('#tab_y');
// if count $(tab_x) > 1 then remove $(tab_x .notice)

```

**(2) jQuery Show/hide items**
Since it's a tab (link or button), you could also just use them as pseudo-tabs, and not move the items at all. e.g. keep the full list below the tabs and use a bit of jQuery to show/hide the items.
Something like `$(#tab1).click(hide(not-shortname1))`.
This also gives you the option of a tab with `show_all()`.
(just some thoughts).

And indeed, stash set\_list is a good server-side option.

---
Tags: search, count, no-results
---


# Question
Title: Control panel: access denied on second site
After updating to Expressionengine 2.9 and MSM 2.1.7 the client admins are not able to switch to the second site anymore (same permissions as on the first site), superadmins have access.

Does anybody know how to solve this problem?

Regards

# Answer
This is a known bug, with a fix: https://support.ellislab.com/bugs/detail/20529/msm-site-switching-not-working-for-non-superadmin
> 2 votes

---
Tags: control-panel, multi-site-manager
---


# Question
Title: Cartthrob report templates: using overall order data while in order items loop
I'm trying to create a custom report. In it, I need a table with rows that would look like this:

```
 # Product   Order id Order date
 1 Partridge 1234567  2014-09-15
 2 Dove      1234567  2014-09-15
12 Drummer   1234567  2014-09-15
 3 Dove      2345678  2014-08-01
 4 Drummer   2345678  2014-08-01

```

Clearly this involves a loop over orders, and an inner loop over the items in the order. However, I haven't been able to access much of the order's data from within the item's loop. While i can see the order ID, I can't seem to access the date the order was entered; instead, `entry_date` gives *the product's creation date*, which is not what I want at all. Other attempts -- starting a second-level `exp:channel:entries` loop with the appropriate order ID, guessing at possible prefixes or containers for order data (like `entry:entry_date` or `order:entry_date`) haven't gotten me anywhere. The following is the code I've written for this so far.

```
<table>
{exp:channel:entries channel="orders"}
    {order_items variable_prefix="item_"}
        <tr>
            <td>{item:quantity}</td>
            <td>{item:title}</td>
            <td>{order_id}</td>
            <td>{entry_date}</td>
        </tr>
    {/order_items}
{/exp:channel:entries}
</table>

```

# Answer
I just got an email from cartthrob support; they offered a solution: embeds. All the following code is from them.

In reports/.order\_date I put:

```
{exp:channel:entries channel="orders" entry_id="{embed:entry_id}" limit="1"}
{entry_date format="%Y-%m-%d"}
{/exp:channel:entries}
```

THen I changed the relevant line in my report to say

```
{embed="reports/.order_date" entry_id="{order_id}"}
```

Inside the embed, the loops and other data from the main template don't exist; all I can see are the globals (like `exp`) and the parameters I pass in (`order_id`). Thus, using a quasi-loop within won't break anything, and I don't have to worry about anything shadowing my variables.
> 0 votes

---
Tags: cartthrob, tags
---


title: Pre-populate DevDemon Form Fields?

text:
# Question
Title: Pre-populate DevDemon Form Fields?
I'd like to be able to pre-populate some DevDemon form fields depending on the URL. Is there a way to accomplish this?

# Answer
You can do it with jQuery. You'll just need to know the id of the field you are pre-populating.

```
   {if segment_1 == "foo"}
    <script type="text/javascript">
    $(function () {
      $('#ddform_21').val("Value 1");
      $('#ddform_46').val("Value 2");
      $('#ddform_87').val("Value 3");
    });
    </script>
    {/if}

```
> 1 votes

---
Tags: forms, devdemon
---


# Question
Title: Dynamically create swiper based on images in wygwam field
I'm using ExpressionEngine and have a wygwam field that takes html formatting, including img tags. I was wondering how I could dynamically create a swiper based on these images? I was thinking that if the field contains more than one image, it should be turned into a slideshow.

I could do this with some jQuery, check the text for img tags and edit the markup, then initialize the swiper instance. But could this be done using perhaps embedded templates, or even snippets? Or perhaps there's a plugin out there for this need?

# Answer
You could use another field type for the images in the post. Grid would be one that would work without going to a third-party resource. Channel Images is a solid commercial addon that handles multiple images in an entry really well.
> 1 votes

# Answer
I'm pretty sure there is an option to add a div in a wygwam field (check in the module settings, you may need to enable it).

With that option, add your images, highlight them, and add the wrapping div/s. You're also given a dialog box to give the div(s) attributes, like class and ID, etc. I noticed swiper is like most slideshows in its set up:

```
<div class="container">
<div class="wrapper">
<div class="slide"> <img src="img/image1.png"> </div>
<div class="slide"> <img src="img/image2.png"> </div>
</div><!-- /.wrapper -->
</div><!-- /.container -->

```

Doing this with Wygwam can be a little fiddly but it should be possible.

There is also the option to add a 'Source' button to edit the html directly. You can also get pretty advance with Wygwam and create your own formatting buttons, but that's a bit much to go in to here...

Agreed, if this is something you plan to use often in a pre determined space, a grid field would be a better option.
> 0 votes

---
Tags: channel-entries, javascript, embeds, snippets
---


# Question
Title: how to print shipping options in cartthrob
I am using the flat rates shipping plugin in cartthrob. I need to add a description for the shipping product, so I managed to get this far:

I added the following in cartthrob\_shipping\_flat\_rates.php

```
            array(
                'name' => 'shipping_product_description',
                'short_name' => 'product_description',
                'type' => 'text'
            ),

```

This code added the fields I need to input a description to each shipping product i.e.(arrives within 7-14 days, arrives within 3 days etc.).

https://dl.dropboxusercontent.com/u/1348309/shipping.png

My question is, how do I make use of that content. In my template tags I am using the following:

```
<h3>{rate_title} Shipping</h3>
<h5>{product_description}</h5>

```

and this is outputting this:

USPS Priority Shipping {product\_description}

https://dl.dropboxusercontent.com/u/1348309/shipping-template.png

# Answer
You'd need to return this extra information back to the template through a tag. Creating the new settings array as you have done will only store the information against your plugin, not automatically return it to the template.

I haven't tested this, but here's what I *think* you'd need to add to the plugin.

In the `initialize()` function, around line 59 you should see:

```
$this->rate_titles[$rate['short_name']] = $rate['title'];

```

Add:

```
$this->product_description[$rate['short_name']] = $rate['product_description'];

```

You should then be able to create a new tag variable in the `plugin_shipping_options()` function towards the end of the plugin.

```
public function plugin_shipping_options()
{
    $options = array();

    foreach ($this->rates as $rate_short_name => $price)
    {
        $options[] = array(
            'rate_short_name' => $rate_short_name,
            'price' => $price,
            'rate_price' => $price,
            'rate_title' => $this->rate_titles[$rate_short_name],
            'product_description' => $this->rate_titles[$product_description]
        );
    }

    return $options;
}

```

You should then have access to the tag `{product_description}` in your template. As I said, not tested this so can't be sure it would work.

Also, I'd recommend changing your tag to something like `shipping_rate_description` to avoid any potential confusion with any channel entries tags that might be of a similar name.
> 0 votes

---
Tags: cartthrob, shipping
---


title: Filter categories by AND and OR

text:
# Question
Title: Filter categories by AND and OR
This is a bit of a complex one, and a bit tricky to explain - but here it goes.

I'm trying to build an advanced filter system for an eCommerce website. Hypothetically, it would look like this (with \[ \] symbolising a checkbox)

**BRANDS**

\[ \] Brand 1 \[cat id=1\]

\[ \] Brand 2 \[cat id=2\]

\[ \] Brand 3 \[cat id=3\]

**SIZE**

\[ \] Small \[cat id=4\]

\[ \] Medium \[cat id=5\]

\[ \] Large \[cat id=6\]

---

Currently I have built a prototype using dynamic\_parameter that allows me to filter by those categories.

But if I were to check Brand 1, Brand 2 and Small (which would in English mean "Show me small products by either Brand 1 or Brand 2) it of course is still effectively running

`category="1&2&4"`

Which instead is "Show me all small products by ***both*** Brand 1 ***and*** Brand 2" - which isn't so useful for filtering purposes.

For this website, combinations within a category *group* (Brand, Size, among others) should be OR and outside of the groups should be AND.

In a perfect world, this would work...

```
category="(1|2)&(4)"

```

So, is there a workaround to this?

Thanks in advanced, it's quite a complex one and I may be completely over complicating this!

# Answer
> 1 votes
Assuming, that your pulling all your data from one or more channels, have you considered just using Javascript filters, like Isotope. I've linked to the Isotope: Combination Filters Because, they're closer to what you want.

But here's an example of EE with Isotope, on a project still in development, Getting Started Guide: Madisonium. I haven't optimize images or javascript yet, since its still in active development, so it a tad slower than I like, but here's sample code of what I'm doing

**The Filters**: I'm just using basic filters, not combination, in the true sense. They are combined with categories, but not with other tags.

```
<!-- BREADCRUMB FILTERS -->

<section id="options" class="clearfix">
    <ul id="filters" class="option-set clearfix breadcrumbs" data-option-key="filter">
        <li><span><b>Filters</b></span></li>
        <li><span><a href="#filter" data-option-value="*" class="selected">show all</a></span></li>
        {exp:tag:cloud limit="6" orderby="total_entries" sort="desc"}
        <li><span><a href="#filter" data-option-value=".{tag}">{tag}</a></span></li>{/exp:tag:cloud}
    </ul>
</section>

<!-- // END BREADCRUMB FILTERS-->

```

**The Entries**: The entries are primarily just images with an overlay to provide more info.

```
<div id="filterable-profiles" class="clearfix">

{exp:channel:entries site="guide" channel="people" limit="30" orderby="title" sort="asc"}

    <div class="clearfix profile four columns{exp:tag:tags entry_id='{entry_id}' limit='5' orderby='total_entries' sort='desc'} {tag}{/exp:tag:tags}">
        <div class="profile-meta">
            <h3><a href="/{profile_type}/profile/{url_title}/">{title}</a></h3>
            <h4><a href="/{profile_type}/profile/{url_title}/">{if profile_position !=""}{profile_position}{/if}{if profile_organization !="" AND profile_position !=""}, {profile_organization}{if:else}{profile_organization}{/if}</a></h4>
            <p>{profile_summary}</p>
        </div>
    <img src="/images/profiles/{profile_image}" alt="{title}" />
    </div>

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

```

**The Javascript**: This is just straight from Isotope, with minor modifications. Our item selector is our profile class, and the container is `id="filterable-profiles"`. We use CloudFlare as a CDN for client projects, so that's the `rocketscript` reference you'll see.

```
<script type="text/rocketscript" data-rocketsrc="http://gettingstartedguide.org/scripts/isotope/jquery.isotope.min.js"></script>
<script type="text/rocketscript">
    $(function(){

      var $container = $('#filterable-profiles');

      $container.isotope({
        itemSelector : '.profile'
      });

      var $optionSets = $('#options .option-set'),
          $optionLinks = $optionSets.find('a');

      $optionLinks.click(function(){
        var $this = $(this);
        // don't proceed if already selected
        if ( $this.hasClass('selected') ) {
          return false;
        }
        var $optionSet = $this.parents('.option-set');
        $optionSet.find('.selected').removeClass('selected');
        $this.addClass('selected');

        // make option object dynamically, i.e. { filter: '.my-filter-class' }
        var options = {},
            key = $optionSet.attr('data-option-key'),
            value = $this.attr('data-option-value');
        // parse 'false' as false boolean
        value = value === 'false' ? false : value;
        options[ key ] = value;
        if ( key === 'layoutMode' && typeof changeLayoutMode === 'function' ) {
          // changes in layout modes need extra logic
          changeLayoutMode( $this, options )
        } else {
          // otherwise, apply new options
          $container.isotope( options );
        }

        return false;
      });

    });
    </script>

```

Basically though, as long as you can add the categories or other parameters as part of the `<div class="brand1 size1 color1">` component, Isotope can filter, singularly or in combination. My example, is the singular. But it would work with combinations as well. No search required.

# Answer
> 3 votes
If you can't find a solution with existing EE search addons, you could build a plugin to grab the entries that match your criteria.

The plugin could perform a custom query capable of doing the advanced conditionals you need. It could ultimately return a piped list of all the entries that match the category assignments desired:

```
323|122|321|116|990

```

You could then use your plugin tag as the entry\_id parameter in a standard EE entries tag (with parse="inward" and dynamic="no"):

```
entry_id="{exp:your_addon:get_filtered_ids}"

```

or

```
entry_id="{exp:your_addon:get_filtered_ids categories='1|2&4' channel_id='2'}"

```

You could pass your category IDs to the plugin as a parameter or maybe even access as POST vars if desired. You would need to parse the strings in a way that makes sense to you in order to get your MySQL WHERE statements setup accurately.

It's not the most elegant solution, and it would add an extra database query, but it could accomplish what you're looking for with a relatively simple plugin.

# Answer
> 0 votes
The Dandy Cat module does exactly what you're looking for.

# Answer
> -1 votes
You should try to use **Super Search module**. Which seems be better for it.

---
Tags: channel-entries, categories, filter, dynamic
---


# Question
Title: XSS vulnerability - malicious cookie value
One of the sites I'm working on was subject to a penetration test and this is one of the items of feedback:

I understand the issue in theory however as I've never had to deal with this sort of thing I haven't the slightest idea where to start and am looking for guidance - settings to change, config files to edit etc. I've added sanitization to other forms on the site, however as the search fields are generated by EE I'm unsure how to sanitize these inputs.

Site can be accessed here

# Answer
> 1 votes
I just tested this (really quickly) on one of my sites running 2.8.1 and couldn't exploit the exp\_csrf cookie in the way described by your report.

However I *could* do it on your site using the exact same method. So perhaps a simple update to 2.8.1 or higher will fix the problem for you.

UPDATE (from my comment) The site I tested on had no search form, although the cookie was present. I just tested on a site running 2.9 with a search form and managed to make the injection. I should add that this is without any input, simply the token being written into the form. I'm not exactly sure how this could be used by an attacker though since it involves manipulating the cookie on your domain - if that happens then you'd probably have bigger problems.

# Answer
> 0 votes
If this is using ExpressionEngine 2.9 then you can file a bug report using HackerOne:

https://hackerone.com/expressionengine

If not, upgrade to the latest version as there were some security fixes included in the 2.9.0 release:

https://ellislab.com/expressionengine/user-guide/about/changelog.html#version-2-9-0

Also, in practice it is difficult to actually exploit an XSS vulnerability through cookies, as the attacker would need to manipulate the user's cookies (which would require another vulnerability). See this question on SSE for more info about it here.

---
Tags: search, 2.8, cookies, xss, csrf
---


# Question
Title: Changing base url of Freeform paginate links
Is it possible to change the base url on Freeform paginate links as it is with channel entries?

https://ellislab.com/expressionengine/user-guide/templates/pagination.html#paginate-base

I have a page that loads some Freeform entries via ajax and I need the links to point to the main page rather than the ajax one.

I can't seem to see it mentioned in the Freeform docs. At the moment I'm using jQuery to dynamically change the links, but it'd be nice to be able to specify it in the tag variables instead.

# Answer
> 0 votes
As of Freeform 4.1.8, it doesn't support changing the paginate base, but we will add it in as a feature request.

---
Tags: solspace-freeform, solspace, pagination, jquery, ajax
---


# Question
Title: Freeform Pro - add required checkbox field to edit form
Now that I thin k of it, is it possible to add attributes (functions or required classes) to the submit button in a freeform:edit form? ...................

I'm using Freeform Pro's both form and edit forms and need a required checkbox field on the edit form. Unfortunately I am not having any success.

The architecture is as follows:

1. user fills in fields and submits form (button is labelled continue)
2. user is taken to a review form (freeform:edit) where they can update their information. On this page I have added an additional required checkbox field that needs to be checked prior to submit.

The problem with freeform is that this field already has a value (n). What I need to do is remove this value on load of the edit form page and make this field required.

It seems as though the only attr available to add a function is onclick. Unfortunately, nothing will be clicked. I need the chaeckbox to be required without anything being clicked.

The reason I set up the form this way is because I want the user to be able to edit their info before the confirmation email is sent. The confirm email is sent once the edit form is sent.

Is this possible? I'm assuming it is and that I'm missing something

Thanks

Peter T

# Answer
You could use the onsubmit parameter of the Form to check and see if the checkbox is still 'n' and alert the user before allowing the submit:

```
<script type="text/javascript">
    function checkboxTicked()
    {
        var checkbox = document.querySelector('#edit_form input[name="myCheckbox"]');

        if (checkbox.value == 'n')
        {
            //force alert to wait until the form submit has resolved.
            setTimeout(function(){
                alert('please check the checkbox before sumbmitting');
            },10);

            return false;
        }
        else
        {
            return true;
        }
    }
</script>

{exp:freeform:edit entry_id="1" form:id="edit_form" form:onsubmit="return checkboxTicked();"}
    //form stuff here
{/exp:freeform:edit}

```
> 1 votes

---
Tags: solspace-freeform
---


# Question
Title: Objective HTML Google maps for ExpressionEngine
Hi wondering if anyone can help.

Using Google maps for expression engine from Objective html.

I have a channel called "franchise"

In each of the entries i will have "one" plot based on their postcode.

```
{exp:channel:entries channel="franchise" status="open" dynamic="on"}
  {exp:gmap:init id="map" scrollwheel="false"  style="width:100%;height:300px"}
  {map_position id="map" zoom="10"}
{/exp:channel:entries}

```

The above code is on the view page of the entry, This all works great for showing that one marker and even if i add another marker using the fieldtype that works great also. Just to check though this is the correct syntax? Obviously it works but if anyone can tell me if it is wrong in any way would be much appreciated.

Anyway...

I am wondering how i can have a main page that pulls through all the plots from every entry that have been added into the fieldtype and the syntax i need to pull that through. I have had a look at the docs but cant quite get my head around it.

When i click the marker i want to be able to show the title of the entry also.

Thanks to anyone that can help.

# Answer
Not quite sure if I understand you, but if you want to return all entries in the channel and plot them, this is similar to what I'm using:

```
{exp:gmap:init id="map" scrollwheel="false"  style="width:100%;height:300px"}
{exp:channel:entries channel="franchise" status="open" dynamic="off"}
{exp:gmap:marker
    id="map"
    latitude="{franchise_latitude}"
    longitude="{franchise_longitude}"
    geocode="false"
    clustering="true"
    icon="{url}images/map-icon-{categories}{category_url_title}{/categories}.png"
    infobox="true"
    offsetY="-55"
    offsetX="30"
    closeBoxMargin="5px"
    class="infobox-{categories}{category_url_title}{/categories}"
    closeBoxURL="{url}images/close-icon-retailer.png"
    open_windows="false"
    style="width: '180px'"
}
    <h3>{title}</h3>
    <p>{franchise_address}</p>
{/exp:gmap:marker}
{/exp:channel:entries}

```

That assumes each entry has been geocoded, though.
> 0 votes

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


title: How to get the import working?

text:
# Question
Title: How to get the import working?
I'm sure this addon was supposed to be making my life easier...

Trying to get the import utility of Google Maps for EE working. I'm only have 9 entries I'm trying to upload at first until I know things are okay, but can't even get anywhere with that. When I run it, nothing happens other than the Total Import Time ticking away. Thirty minutes has passed so far and nothing.

Anyone got any advice for things I can start looking for?

# Answer
> 0 votes
Emptied the exp\_gmap\_import\_stats table and tried again and it worked.

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


# Question
Title: How to display Playa Info inside of Matrix
I am missing something very simple.

I have a Matrix field pulling in content from a Playa field.

Lets say my Matrix cells are called {cell\_1}, {cell\_2} and so on. Each cell is a Playa field and I simply want to dispaly the content of {cell\_1}, which is a Playa field.

How do I get my Playa info to display correctly for each cell? Currently I am able to pull information in from my Playa field but its not showing the specific information I need. {cell\_1} should show me SPEAKER\_A but it shows me SPEAKER\_A, SPEAKER\_B and so on.

I know I am missing something very simple and any help would be appreciated.

I think the answer I was looking for was removed from the docs when the P&T site was recently updated.

Oh yeah using: EE 2.5.2, Matrix 2.4.1, and Playa 4.1.0.3

Thanks in advance!

John

# Answer
> 1 votes
This is basically how you retrieve Playa relationship values within a Matrix cell:

```
{matrix_field_name}

    {!-- Your Playa field inside the Matrix --}
    {playa_field}
        {title} {!-- Desired value to retrieve from the relationship --}
    {/playa_field}

    {!-- Any other Matrix cells can be retrieved in the matrix tag pair --}
    {other_matrix_cell}

{/matrix_field_name}

```

# Answer
> 0 votes
For those who is still struggling or not sure where and what should be my answer is:

```
{exp:channel:entries channel="ONE"}

{matrix}

<!--Playa from channel TWO-->
    {your_playa var_prefix="any_prefix_you_like"}

    <!--Matrix inside playa-->
      {any_prefix_you_like:matrix_name field="PLAYA_FIELD"}

           <!--Playa inside matrix-->

          {any_prefix_you_like:deep_playa}<!--Playa inside playa of matrix from channel THREE-->

            <!--Playa inside matrix-->

      {/any_prefix_you_like:matrix_name}
     <!--Matrix inside playa-->

    {/your_playa}
<!--Playa from channel-->

{/matrix}

{/exp:channel:entries}

```

I have spent whole week figuring out how to pull data from 3 different places and mixing them together in reports for client. Enjoy!

---
Tags: matrix, playa
---


title: Matrix inside Playa inside Matrix

text:
# Question
Title: Matrix inside Playa inside Matrix
I'm just upgrading a site from EE1 to EE2 and this code is no longer working in EE2:

```
{exp:channel:entries}
    {matrix}
        {playa}
            {title}
            {matrix}
                {deep_value}
            {/matrix}
        {/playa}
    {/matrix}
{/exp:channel:entries}

```

{title} displays fine, but the {deep\_value} does not. This used to work in EE1, does anyone know of a work around?

# Answer
It’s actually just sheer luck that that worked for you in EE1 – there are a lot of variables at play with EE’s parse order, and most of the time that kind of thing won’t work.

You can get it working using Matrix and Playa’s `var_prefix` parameters, though:

```
{exp:channel:entries}
    {matrix}
        {playa var_prefix="playafield"}
            {playafield:title}
            {playafield:matrix var_prefix="nested_matrix"}
                {nested_matrix:deep_value}
            {/playafield:matrix}
        {/playa}
    {/matrix}
{/exp:channel:entries}

```

(You’d probably want to choose more semantic var prefixes than “playafield” and “nested\_matrix” but hopefully you get the idea.)
> 5 votes

# Answer
A simple work around would be to use an embed and pass the associated entry id through to that. It's probably not the most efficient method, but it should avoid the issue with nesting a mat

e.g.

=== display.html ===

```
{exp:channel:entries}
    {matrix}
        {playa}
           {embed="embeds/deepinfo" entry_id="{entry_id}"
        {/playa}
    {/matrix}
{/exp:channel:entries}

```

=== embeds/deepinfo.html ===

```
{exp:channel:entries entry_id="{embed:entry_id}"}
    {title}
    {matrix}
        {deep_value}
    {/matrix}
{/exp:channel:entries}

```
> 0 votes

# Answer
I'm sorry for not putting my answer here. I have already posted my answer on similar question. Here is the link to ANSWER
> 0 votes

---
Tags: matrix, playa
---


title: Output to JSON & save

text:
# Question
Title: Output to JSON & save
I've got a directory of locations in a channel, 4500 of them.

I'm using the Google Maps addon but given how many locations we're showing, the performance is terrible.

Right now we're outputting the locations via the Query Module to a JS template formatted as JSON. That JSON file is 1.1Mb

What I'd like to do is some how export that to a static JSON file for say 1 day (rather than run the query each time) and see if the performance improves and have it run a cron to update once a day in the background.

Doable?

# Answer
> 1 votes
Forgive me if I'm misunderstanding, but I think Tag Caching on your query module call does what you're looking for.

I'm sure Stash and CE Cache can be used here, too, if you wrap them around the query module tag.

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


# Question
Title: Structure: change display depth for certain parents
I'm building a site with Structure, and in my overall navigation, I'd like to vary the `show_depth` parameter for particular parts of the site.

The following works for the majority of my site's navigation:

`{exp:structure:nav css_id="none" css_class="menu" show_level_classes="yes" current_class="active" start_from="/" has_children_class="yes" show_depth="4" exclude="142|144|146|148|150|152"}`

However, there are some sections that will have many (hundreds) of entries that are also at the "fourth" level of the hierarchy that I do not want to show in the navigation. For instance: I have a "Press Releases" section, which will have a parent page (called Press Releases), and will list ALL of the site's press releases.

Is there a way to conditionally change the `show_depth` number for certain parts of the site?

# Answer
> 0 votes
You can wrap simple conditionals within the `structure:nav` tag to check the segment first and then set a depth as simple conditionals are parsed before the nav tag:

```
{exp:structure:nav
    css_id="none"
    css_class="menu"
    show_level_classes="yes"
    current_class="active"
    start_from="/"
    has_children_class="yes"
    {if segment_2 == "press-release"}show_depth="3"{/if}
    {if segment_2 != "press-release"}show_depth="4"{/if}
    exclude="142|144|146|148|150|152"
}

```

# Answer
> 0 votes
You're much better off using the `start_from`parameter for each section of your nav that you would like to display on the front-end, like so:

```
{exp:structure:nav
        css_id="none"
        css_class="menu
        show_level_classes="yes"
        current_class="active"
        has_children_class="yes"
        show_depth="XXX"
        max_depth="XXX"
        start_from="/press-releases"
    }
    {exp:structure:nav
        css_id="none"
        css_class="menu
        show_level_classes="yes"
        current_class="active"
        has_children_class="yes"
        show_depth="XXX"
        max_depth="XXX"
        start_from="/SECTION-ONE"
    }
    {exp:structure:nav
        css_id="none"
        css_class="menu
        show_level_classes="yes"
        current_class="active"
        has_children_class="yes"
        show_depth="XXX"
        max_depth="XXX"
        start_from="/SECTION-TWO"
    }

```

Of course for each "SECTION" you'll need to use your own page names to get those to output. This gives a bit more flexibility for how you want your navigation to appear on the site.

I almost forgot that you'll also need to use the `max_depth` parameter as well.

---
Tags: add-on, structure, navigation
---


# Question
Title: Expresso Store and inventory limit message
I ended up selecting an item that had only 1 item in inventory. I selected 2, but it automatically selected 1 because of the inventory level. Is there any way to have displayed a note explaining that? Something like available X in stock?

# Answer
Sure is, see Store's total\_stock tag - https://www.exp-resso.com/docs/product\_tag.html#total\_stock

```
{if total_stock > 0}
    {total_stock} in Stock
{if:else}
    Out of Stock
{/if}

```
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Expresso Store and SKU related product picture
Is there any way to have SKU related product image? My goal is to have changed product image on SKU change (product option change).

It looks like that I need to customize part which is responsible for a dynamic SKU display, but I'm not 100% sure and I want to avoid some overhead in that case.

Thanks for any tips.

# Answer
> 0 votes
Ideally that would be case for a Store extension.

You could do a workaround by using a Grid field to add the image, in the Grid have three fields:

Image, SKU, Description

Upload your images, and add descriptions. You would need to manually type in matching SKU values in the Grid SKU field.

Once you have that set up you could use some conditionals (or perhaps JS) to bind/group the Store SKU and Grid SKU together and outur the corresponding images.

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


# Question
Title: Seeking an alternative to Title Master that is compatible with 2.9
Does anyone know of an add-on that offers the same functionality of Title Master but which is compatible with EE 2.9?

If you aren't familiar with Title Master I need something that will auto populate entry titles with an incremental value, prefixed by the value of another field (in this case an entry-id from a relationship field). This also needs to happen on the front end via a Channel Form.

Big ask, but it was working perfectly with Title Master until I updated the site.

# Answer
> 1 votes
It may not have all the features you need, but just in case, MX Title Control works in EE 2.9.0 if you have the latest version (2.9) and apply the fix in this thread.

---
Tags: safecracker, title-master
---


title: Can I use EE tags in RTE Editor?

text:
# Question
Title: Can I use EE tags in RTE Editor?
I am trying to use EE tags inside RTE Editor. But it is not working. So Can i use EE tags inside RTE Editor? if yes then how can i use? Currently using below in Textarea (Rich Text)

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

## {title}

{/exp:channel:entries}

But it is displaying as it is. So Please how can i use? Looking for quick response

# Answer
> 1 votes
No, you cannot use tags within an RTE field. But depending what you are trying to do, you may find Solspace Preparse useful

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


# Question
Title: Solspace User 3.3.5 compatible with EE 2.9?
I have one website which uses Solspace User version 3.3.5. The website is running ExpressionEngine version 2.2.2. I was wondering if my 3.3.5 version of User will still work if I upgrade my ExpressionEngine webite to 2.9?

# Answer
Solspace have a handy version matrix which will help

http://www.solspace.com/software/compatibility

## update

You could risk it but I wouldn't. EE altered the form submission system pretty extensively in 2.8+. Take a local copy and try.
> 1 votes

---
Tags: solspace
---