title: Simple Search segments

text:
# Question
Title: Simple Search segments
**EE 2.10.1**

OK, so I haven't ever actually used EE's native search functions (always use add-ons or craft my own module to function as a search appliance \[because of stupidly complex ERDs so weird there was no viable way of importing them into EE channels\]).

Using the EE Simple Search, I have a code example like this:

```
{exp:search:simple_form
   channel="product_review"
   result_page="products/search"
   no_result_page="products/search"}

    <p>
        <label for="keywords">Search:</label><br>
            <input type="text" name="keywords" id="keywords" value="" size="18" maxlength="100">
    </p>
    <p>
        <input type="submit" value="submit" class="submit">
    </p>

{/exp:search:simple_form}

```

... which seems fine.

However, the resulting URL, regardless of if there is a result or not, looks like this (third segment seems variable, but always a hash-like string):

```
www.domain.com/products/serach/0568f4f2a81172d816bb05364030a4c4/

```

What the hell is that that third segment? It's not a template annotation.... I rarely have a question to ask, so can anyone provide insight on the native `{exp:search:simple_form}` returns? I'd just like to get ride of it without .htaccess rules. I'm sure I'm missing something in the docs or have something in the config set up wrong.

# Answer
> 0 votes
It took me a while to find an old website that used native searching as I always tend to use Low Search, but eventually found it...

Like low search the URL is a unique identifier to the conducted search, so it can be ~~repeated and is shareable~~ tracked. The third segment is the key reference in the database table, identifying the user, date searched, keywords used, and other information.

So even if there are no results, the information will still exist on what they searched for, meaning there is still a third segment.

The display of the results isn't reliant on POST data, but on the URL, so you can't remove it and can't hide it, otherwise it's not shareable or repeatable.

---
Tags: simple-search
---


# Question
Title: Get member id in ExpressionEngines session hook
How do I get the member id of the current user in my extension when I'm in the session\_start hook?

```
ee()->session->userdata('member_id');

```

Obviously doesn't work; this gives me a server error.

# Answer
> 2 votes
First initial thought is: can you use **sessions\_end** hook instead?

Looking at the Session.php code for where the **session\_start** is fired, this hook kicks in before the user data is set from the cookie/session as the next lines that come after the hook are:

```
// Set the validation type
$this->validation = (REQ == 'CP') ? ee()->config->item('cp_session_type') : ee()->config->item('website_session_type');

```

Get the session type dependant on what is being accessed - the Control Panel or frontend.

```
// default to "cookies and sessions" if validation type doesn't exist or is invalid
if ( ! in_array($this->validation, $this->valid_session_types))
{
    $this->validation = 'cs';
}

```

Copying this into your code won't work due to usage of `valid_session_types`, so you could either replicate the valid types, or just assume 'cs' if the `validation` variable is not set.

```
// Grab the session ID and update browser fingerprint based on the validation type
// we use the same URL key whether it's getting the session ID or the browser fingerprint,
// simplifying URI parsing and complicating session hijacking attempts
switch ($this->validation)
{
    case 's'    :
        $this->sdata['session_id'] = (ee()->input->get('S')) ? ee()->input->get('S') : ee()->uri->session_id;
        break;
    case 'c'    :
        $this->sdata['session_id'] = ee()->input->cookie($this->c_session);
        break;
    case 'cs'   :
    default     :
        $this->sdata['session_id'] = ee()->input->cookie($this->c_session);
        $this->sdata['fingerprint'] = (ee()->input->get('S')) ? ee()->input->get('S') : ee()->uri->session_id;
        break;
}

```

The above is the key chunk, where it will get the session\_id from the URL or from the cookie.

The EE core Session code then calls the `fetch_session_data` function which does the DB query to get the member details...

```
ee()->db->select('member_id, admin_sess, last_activity, fingerprint, sess_start, login_state');
ee()->db->where('session_id', (string) $this->sdata['session_id']);

```

Main part of the query using the Session ID we got above.

```
// We already have a fingerprint to compare if they're running cs sessions
// otherwise we'll do it after fetching their member data, presuming the session ID is valid
if ($this->validation == 'cs')
{
    ee()->db->where('fingerprint', (string) $this->sdata['fingerprint']);
}

```

Not too sure if you'll need this, as it refers to fetching it later, but useful if the user has multiple sessions open in different browsers maybe...?

```
$query = ee()->db->get('sessions');
if ($query->num_rows() == 0 OR $query->row('member_id') == 0) {
    //FAILED TO FIND SESSION
    return false;
}

```

Run the query, do checks on the result and...

```
$memberID = (int) $query->row('member_id');

```

Finally you have the member ID.

---
Tags: hook, sessions
---


# Question
Title: Module not showing in modules list for installing
Am trying to install Flag Master addon.

https://github.com/mithra62/flag-master

Did copy the extracted folder to third\_party folder as per the install instructions.

However the module doesn't show up in the modules list for it to be installed.

Am using EE 2.10..1

Any pointers?

Thanks

# Answer
The files should be located inside system/expressionengine/third\_party/flag\_master/ folder, not directly in third\_party folder. Please check that.
> 1 votes

# Answer
You will need to make sure the folder you place in the third\_party directory matches the package name.

From the Github repo, you can see that the files are called xxx.flag\_master.php, so therefore the directory needs to be named flag\_master. I assume the because the Github repo is called flag-master, the folder is being named that instead.
> 1 votes

---
Tags: module, install
---


title: EE3 core file entry tag

text:
# Question
Title: EE3 core file entry tag
I'm getting an error with simple file entries tag:

> The following tag cannot be processed:
>
> {exp:file:entries}
>
> Please check that the ‘file’ module is installed and that ‘entries’ is an available method of the module

Is file entry tag not supported in EE3 core, or did I miss a step somewhere and did not enable something.

# Answer
> 0 votes
For anyone else wondering EE3 DOES NOT include file tag. There is a bug submitted that is marked as "Fix in Upcoming Release"

https://support.ellislab.com/bugs/detail/file-entry-tage-does-not-work/

They probably just did not get round to implementing it. I wish the documentation indicated it. It's okay to roll out your features slowly, but it does not make sense to have documented feature/behavior missing in your release.

# Answer
> 0 votes
This might be obvious, but did you go to "Add-ons" section in Control Panel and make sure "File" module is installed?

---
Tags: files, core, ee3
---


# Question
Title: Issues with custom module when moving to live server
I have build a custom module for ExpressionEngine. It works perfectly on my local dev environment, but when I move it to my live server it freaks out and gives me errors, most notably: Invalid argument supplied for foreach.

I cant figure out what is going wrong, but have tried on two separate installs of ExpressionEngine, on two different domains and both give the same error. Code below:

```
    public function product_prices() {

    // Build module tags for EE output
    $tagdata = $this->EE->TMPL->tagdata;

    // Create CURL resource
    $service_provider = curl_init();

    // Parse URL to CURL and create connection
    curl_setopt($service_provider, CURLOPT_URL, "https://www.example.com");

    // Return responce as a string
    curl_setopt($service_provider, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the returned string
    $service_provider_output = curl_exec($service_provider);

    // Close curl resource to free up system resources
    curl_close($service_provider);

    // Create Array from JSon array
    $sp_arr = json_decode($service_provider_output, true);

    // Create CURL resource
    $service_details = curl_init();

    // Parse URL to CURL and create connection
    curl_setopt($service_details, CURLOPT_URL, "https://www.example.com");

    // Return responce as a string
    curl_setopt($service_details, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the returned string
    $service_details_output = curl_exec($service_details);

    // Close curl resource to free up system resources
    curl_close($service_details);

    // Create Array from JSon array
    $spdetails_arr = json_decode($service_details_output, true);

    // Create CURL resource
    $price_details = curl_init();

    // Parse URL to CURL and create connection
    curl_setopt($price_details, CURLOPT_URL, "https://www.example.com");

    // Return responce as a string
    curl_setopt($price_details, CURLOPT_RETURNTRANSFER, 1);

    // $output contains the returned string
    $price_details_output = curl_exec($price_details);

    // Close curl resource to free up system resources
    curl_close($price_details);

    // Create Array from JSon array
    $price_details_arr = json_decode($price_details_output, true);

    $detailed_product = array();

    // Insert query results into variables
    foreach ($spdetails_arr["data"] as $val_detail) {
        $detailed_product_name = $val_detail['name'];
        $detailed_product_sp_id = $val_detail['service_provider'];
        $detailed_product_s_discripton = $val_detail['short_description'];
        $detailed_product_s_discripton = $val_detail['description'];
        $detailed_product_id = $val_detail['id'];
        $detailed_service_id = $val_detail['service'];

            // Replace Service Provider ID with Full Name
            foreach ($sp_arr["data"] as $val) {
                $sp_name = $val['name'];
                $sp_id = $val['id'];

                if ($detailed_product_sp_id == $sp_id) {
                    $sp_full_name = $sp_name;
                }
            }

            // Pull Price and associate with service
            foreach ($price_details_arr["data"] as $val_price) {
                $service_id = $val_price['service'];
                $service_price = $val_price['price'];
                $service_type = $val_price['type'];

                if ($detailed_service_id == $service_id && $service_type == "Monthly") {
                    $service_price_monthly = $service_price;

                    if ($service_price_monthly == "0.00") {
                        $service_price_monthly = "No Price Found";
                    }
                }

                if ($detailed_service_id == $service_id && $service_type == "Start") {
                    $service_price_start = $service_price;
                }

            }

        $detailed_product[] = array(
            "service_name" => $detailed_product_name,
            "service_provider" => $sp_full_name,
            "monthly_price" => $service_price_monthly,
            "connection_fee" => $service_price_start,
            "type" => $service_type,
            "service_id" => $detailed_service_id,
            "s_discription" => $detailed_product_s_discripton,
            "l_discription" => $detailed_product_s_discripton
        );
    }

    // Return tag pair
    return $this->EE->TMPL->parse_variables($tagdata, $detailed_product);
}

```

Am I doing something very wrong here? I have a feeling it might be something to do with Codeigniter, but can't be sure as I am still a junior programmer.

Thanks alot

# Answer
> 0 votes
Try outputting the result of CURL request directly into browser. It is probably that one of the requests does not return valid JSON, therefore you don't get valid URL to loop through.

Purely guess though, as you did not mention to what line the error message is pointing.

# Answer
> 0 votes
I managed to figure it out:

Firstly, I enabled debugging by using the `curl_getinfo`

From this I was able to determined that the HTTP response was returning 0. This was due to an issue with the SSL certificate not getting verified on the server side.

To fix, I added a pem certificate and linked to it.

Issue resolved.

---
Tags: php, php-errors, codeigniter, curl
---


title: EE3 Convert Field Type

text:
# Question
Title: EE3 Convert Field Type
Can anyone confirm that in EE3 once a field has been created, you can't change the field type?

Ellis Lab, is this a feature yet to implemented, or data management perspective no longer a good idea?

# Answer
This has already been filed as a bug, and Derek Jones gives some explanation in the comments there: https://support.ellislab.com/bugs/detail/21302/field-type-not-changeable-after-creation
> 1 votes

---
Tags: fieldtype, ee3
---


title: Entry Poster IMdb

text:
# Question
Title: Entry Poster IMdb
I am trying to use entry\_poster\_imdb

https://github.com/intoeetive/entry\_poster\_imdb

Is it possible to create fields automatically in a field group, corresponding to the IMdb fields which are pulled from IMdb?

# Answer
No, that is not possible. You need to create channel fields and map those to IMDB data fields in add-on settings first.

Of course (if you are programmer) feel free to develop such feature and submit pull request, as this add-on is open source.
> 0 votes

---
Tags: channel-fields
---


# Question
Title: Bootstrap navigation mark-up using NavEE
My site is built on Bootstrap 3 framework and I am using NavEE as the navigation plugin. One thing I cannot figure out is how to implement the conditionals required to build out the navigation structure eg. if there are children nav items then display modified mark-up as required in Bootstrap.

Below is the Bootstrap structure I need to create using NavEE:

```
<ul class="nav navbar-nav">
  <li class="active"><a href="/">Home</a></li>
  <li class="dropdown">
    <a href="#" class="dropdown-toggle" data-toggle="dropdown">Options <b class="caret"></b></a>
    <ul class="dropdown-menu">
      <li><a href="#">Option 1</a></li>
      <li><a href="#">Option 2</a></li>
    </ul>
  </li>
  <li><a href="#">Contact Us</a></li>
</ul>

```

I can easily create the top-level navigation using the basic NavEE syntax:

```
{exp:navee:nav nav_title="main" class="nav navbar-nav" selected_class="active"}

```

I have tried using the custom NavEE syntax but have found the documentation limited so have not been able to work out the correct conditionals:

```
{exp:navee:custom nav_title="main" class="nav navbar-nav" selected_class="active"}
   <li class="{class}"><a href="{link}">{text}</a>{kids}</li>
{/exp:navee:custom}

```

I want to be able to say something like this:

```
{exp:navee:custom nav_title="main" class="nav navbar-nav" selected_class="active"}
   <li class="{if kids}dropdown{/if}"><a {if kids}class="dropdown-toggle" data-toggle="dropdown"{/if} href="{link}">{text}{if kids} <b class="caret"></b>{/if}</a>{kids}</li>
{/exp:navee:custom}

```

Even if I could get that to work I still need to target the nested UL.

I have used Taxonomy in the past and have been able to create the required Bootstrap 2 navigation structure:

```
{exp:taxonomy:nav
tree_id="1"
display_root="no"
ul_css_class="nav"
ul_css_class:level_2="dropdown-menu"
entry_id="{entry_id}"
}
<li class="{if node_has_children}dropdown{/if}{if node_active} active{/if}">
    <a{if node_has_children} class="dropdown-toggle" data-toggle="dropdown"{/if} href="{node_url}">
    {if node_has_children}<b class="icon-chevron-down"></b> {/if}{node_title}
    </a>
{children}
</li>

{/exp:taxonomy:nav}

```

Any assistance in allowing me to control NavEE in the same way I have been able to with Taxonomy would be greatly appreciated.

Thanks,
Dan

# Answer
After days or trying to work it out and then finally posting my question on EESO I actually stumbled across the answer (literally minutes after posting my question).

Brandon Richards posted the answer on The Outfit, Inc forum (https://getsatisfaction.com/booyant/topics/twitter\_bootstrap#reply\_14550626).

Below is how you can achieve Bootstrap 3 navigation structure using NavEE:

```
<ul class="nav navbar-nav">
{exp:navee:custom nav_title="main" wrap_type="none" selected_class="active" selected_class_on_parents="true" parent_selected_class="active"}
    {if has_kids}
        <li{if has_kids} class="dropdown"{/if}>
            <a href="{link}" class="dropdown-toggle" data-toggle="dropdown">{text} <b class="caret"></b></a>
            <ul class="dropdown-menu">
                <li>{kids}</li>
            </ul>
        </li>
    {if:else}
        <li{if class != ""} class="{class}"{/if}><a href="{link}" title="{text}">{text}</a></li>
    {/if}
{/exp:navee:custom}
</ul>

```

Thanks Brandon!
> 2 votes

# Answer
Well glad it helps, I haven't tried working in the seperators in the drop down or split navigations (left and right)
> 0 votes

---
Tags: bootstrap, navee
---


title: File names with special characters

text:
# Question
Title: File names with special characters
If a channel entry uses a file that has been uploaded that contains special characters (I've noticed this so far with brackets and commas), it now produces a PHP error saying the file does not exist. The error shows that the file is being searched for with a percent encoded name, so the original file can't be found.

For example, if an image was uploaded called 'image (large).jpg', the PHP error says 'File /var/www/.../image %28large%29.jpg does not exist'.

I think this error was introduced with EE v2.10.0, as these images were used previously with no error. Upgrading to v2.10.1 doesn't change anything.

Has anyone else encountered this error? The only way around it I've found is to download, rename, and reupload any files with special characters in, which is hardly practical.

# Answer
> 1 votes
This is a bug, and a solution from EllisLab can be found at https://support.ellislab.com/bugs/detail/20972

---
Tags: channel-entries, file-uploads, file-manager, files
---


title: Images are gone with membergroup

text:
# Question
Title: Images are gone with membergroup
If i create a new membergroup, based on the users membergroup. All the images from a custom field are not showing. If i switch the user to the default membergroup, it works again. users that are not logged in, can see the images.

So basicly, if i move a user to a new membergroup (based on the default "member" group), all the images from custom fields are not showing.

Do i miss something, or is it a configuration?

# Answer
> 1 votes
Ok, very weird but also understandable. I had to give permissions in the File Upload Perferences.

Its odd because the membergroup "members" is allowed and for a new membergroup that is based on that group need to give permission. Also i was thinking that those permissions where for writing only...

# Answer
> 0 votes
You have to specifically give permissions to the new membergroup in the File Upload Preferences for each upload destination, if these destinations were created before the new membergroup was created.

---
Tags: custom-fields, image
---


title: Embeds not working

text:
# Question
Title: Embeds not working
I building a super simple site on EE 3.0.3. and am having a seemingly weird issue where my embeds are not loading. I'm sure it something simple but I'm not able to see what is going wrong. The live site is at http://vanessareynoldsmd.com and here's the code for the index page

```
{embed="includes/header"}

  <header class="book-page">
    <div class="container">
     <h1>An Apple A Day - 100 Quick Devotionals When Pressed for Tim</h1>

     <p class="tagline-1">Five inspiring testimonials</p>
     <p class="tagline-2">100 Daily Devotions</p>
     <p class="tagline-3">A daily dose of spiritual nutrition</p>
     <p class="tagline-4">A new book written by<br /> <em> Vanessa Reynolds M.D.</em></p>

     <h3 class="button-wrapper">
       <a class="buy-button paperback" href="http://rads.stackoverflow.com/amzn/click/1501073362">Buy The Paperback</a>
       <a class="buy-button ebook" href="http://rads.stackoverflow.com/amzn/click/B00QJ9VBCM">Buy The eBook</a>
     </h3>

     <img src="/assets/media/logo-book.png" class="book" title="An Apple A Day book cover" />
    </div>
  </header>

  <div class="container">

    <section class="description">
      <h2 class="section_title">Thought of the Week</h2>

      {exp:channel:entries channel="articles" limit="1"}
      {article_excerpt}

      <p class="aricle-date"><a class="btn btn-continue pull-right" href="{url_title_path="articles/read"}" role="button">Continue Reading</a></p>
      {/exp:channel:entries}

      {exp:channel:entries channel="general_pages" limit="1"}
      {speaking_engangment}
      <h2 class="section_title top_gap">Next Speaking Appearance</h2>
      <h4 class="speaking-name">{speaking_engangment:location_name}</h4>
      <h4 class="speaking-address">{speaking_engangment:location_address}</h4>
      <h4 class="speaking-date">{speaking_engangment:date_time}</h4>
      {/speaking_engangment}
      {/exp:channel:entries}
    </section>

    {embed="includes/newsletter" color="sidebar-dark"}

{embed="includes/footer"}

```

and here's the header

```
<!DOCTYPE html>

<html lang="en">
<head>

  <title>{if embed:title}{embed:title} /{/if} Vanessa Reynolds, MD</title>

  <!-- Meta Tags -->
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta name="description" content="Just as an apple a day provides the nutrition your body needs, this uplifting daily devotional works to inspire spiritual growth as you reflect on bite-size doses of Christian wisdom and apply the important lessons within to your own life.">

  <!-- Favicon -->
  <link rel="shortcut icon" href="/assets/media/favicon.ico" />

  <!-- CSS -->
  <link href="/assets/styles/build/base.css" media="screen" rel="stylesheet" type="text/css" />

</head>
<body>
  <nav class="navbar navbar-default navbar-fixed-top">
  <div class="container">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        MENU
      </button>
      <a class="navbar-brand" href="/">Vanessa Reynolds, MD</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li {if "{segment_1}" == "about"} class="current"{/if}><a href="{path="about"}">About</a></li>
        <li {if "{segment_1}" == "articles"} class="current"{/if}><a href="{path="articles"}">Articles</a></li>
        <li {if "{segment_1}" == "book"} class="current"{/if}><a href="{path="books"}">The Book</a></li>
        <li {if "{segment_1}" == "messages"} class="current"{/if}><a href="{path="messages"}">Messages</a></li>
        <li {if "{segment_1}" == "contact"} class="current"{/if}><a href="{path="contact"}">Contact</a></li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

```

I can't seem to locate what I'm missing that would cause these not load.

Any help would be greatly appreciated!

# Answer
> 1 votes
When you create a NEW template, all access is set correctly (access for all groups). When you DUPLICATE a template, all access is removed except for Super Admins.

# Answer
> 0 votes
I knew it had to be something simple. It was a permission issue. For some reason none of the member groups were checked. Once I allowed all the member groups things were working as expected.

---
Tags: embeds, ee3
---


# Question
Title: In Expression Engine, I can't "open" entries, they only offer "closed" as an option
I have taken over an old Expression Engine 1.7 site and am trying to create a Member group that offers limited admin privs rather than create a "Superadmin."

The problem is that I want the user to be able to create, edit, publish, unpublish section entries, but when they do, the sections exist only as "closed" (unpublished) and when I try to edit them, "closed" is the only option in the pulldown. I am assuming there's a setting in the Group preferences that is preventing this, but I don't know what setting. I've tried a number of them and nothing seems to work.

Any suggestions would be great. Thank you!

# Answer
> 1 votes
Check these things:

* the weblog has some statuses group assigned to it
* the members group is authorized to publish entries in this weblog
* the members group is authorized to edit entries authored by others

---
Tags: channel-entries, members, ee1, groups
---


title: Channel form : Ajax submisson

text:
# Question
Title: Channel form : Ajax submisson
It's the first time I've used Ajax with Channel Form so this maybe a newbie question.

I'm loading the template containing my form via AJAX and appending it to a DIV. When the form is submitted I want to show messaging in the same DIV so I'm overriding the default form submit in jQuery but I can't prevent the page from refreshing. If I set the form parameter ajax="yes" then it simply redirects to JSON output.

What am I missing?

Static form ID works fine:

```
<form id="comment-form">
          <input type="text">
          <button type="submit">Submit</button>
        </form>

```

Channel Form ID does not work:

```
{exp:channel:form
          channel="logbook"
          include_jquery="no"
          include_assets="no"
          datepicker="no"
          class="logbook-add"
          id="comment-form"
          return="/account/manage-logbook-requests/#comments"
          entry_id="{segment_3}"
        }

```

jQuery code:

```
$("#comment-form").on('submit', function (e) {
            e.preventDefault();
            console.log('submitted');
        });

```

# Answer
> 0 votes
`json="yes"` parameter is merely changing format of data output. You will need to add appropriate Javascript code to handle submission and displaying of results.

See example in the docs. You can use it as the base but change code that is producing alert to code that will show success/error message in same div (e.g. using jQuery's `.html()` function)

---
Tags: safecracker, channel, ajax
---


# Question
Title: How to make an entry with dynamic drop down list?
I'm a newbie to EE & purchased EE 3.0.4!

The scenario is questions have to be grouped into categories:

In the cpanel,

1. A category has to be chosen from drop down of categories of questions and a question & answer has to be entered as an entry

In front end

1. A category has to be chosen then a question has to be selected in the chosen category and answer for the question will be shown.

I learnt about relations and forms but if i choose a field as relation then i see the variable is printed as it is like {variable\_name} but not its value. Creating forms is apparently only for interacting with end user.

Please help me in understanding how to create this in EE way. Can i create category, question and answer tables by myself and write quires with php-mysqli?

**Edit:** Category of questions means set of or group of questions, Its not used to indicated reserved keyword in EE

**Solution**

the pizza store example was explained well. I was trying to create stores & create pizzas under it. where as from example i learned that pizzas has to be created first and then assign them under stores

# Answer
If you are using Relationship field (i.e. relating question/answer entry to "category" entry), then you need to output the variables like this: `{relationship_field:title}`

See the docs for more examples.
> 1 votes

---
Tags: forms, ee3
---


# Question
Title: Menu with sub-items from channel entries
I have a channel called services. The entries from that channel are used to populate a dropdown menu & a sidebar menu.

The problem is that there are some services that have sub-services.

I need to display only the parent services in the dropdown menu but need to display the parents with their children in the sidebar menu.

How can I do this when all services are in the same channel and there are no categories to create a nested list of parents & children services?

# Answer
When I needed to have a certain set of entries available on a dropdown (vs all on the sub-nav), I did this by adding another field to the channel. So say you add a field (P&T Pill?) for "Entry Type" ("cf\_services\_entry\_type"). You have two options: Parent / Child. Then you can filter your entries based on those options. So your main menu would be

```
{exp:channel:entries channel="services" search:cf_services_entry_type="parent" dynamic="no}

```

Creating the sub-menu would be a little trickier because your entries don't know who their parent is (or do you have a field set up for that?) So Yuri's suggestion of using a relationship field would probably be necessary to accomplish this.
> 0 votes

# Answer
Option 1: use Structure add-on.

Option 2: keep submenus within "root level" entries (e.g. using Relationship field)
> 0 votes

---
Tags: channel-entries
---


title: How to get forum for EE v2.10.1

text:
# Question
Title: How to get forum for EE v2.10.1
I am using EE v2.10.1 licence & need to add the forum addon but did not get any option as default. I also have EE v3.0.4.

Pleas advise.

Thanks

# Answer
> 0 votes
Please contact sales@ellislab.com

---
Tags: forum
---


# Question
Title: Possible to spoof last page, or end early in multi-page form?
I have a form with a number of pages and radio buttons, each one has a score attached. If the score is lower than 5 by the 5th page I need to end the form and display the results, else carry on with the rest of the questions.

I've managed to hook into the form with `freeform_module_insert_begin` and inject a bit of code at the correct point but I'm not sure how to 'finish' the multi-page form. *The below code fires at the correct point.*

```
//$step variable grabs the page number from the URL
if ( $step == 5 AND $inputs['total'] < 5 ) {
    //End form
    $obj->last_page = true;
}

```

I tried adding the `$obj->last_page = true;` line to trick the form into thinking it's at the end but unfortunately it didn't work and carried onto the next page.

I also tried playing with `$obj->params['multipage_next_page'];` and `$obj->params['multipage_previous_page']` however if I unset the next\_page (or direct it elsewhere) I'm getting taken to the home page.

In my `freeform_module_insert_end` hook:

I've tried using `ee()->functions->redirect($return);` where `$return` equals the result URL but it doesn't appear to submit properly.

# Answer
> 0 votes
I've finally found a solution for this. In my case it works well however it might not be viable for others. *(see last sentence)*

All that was needed was to set the `multipage_next_page` value to the landing page URL

```
$obj->last_page = 1; //Not sure if needed
$obj->params['multipage_next_page'] = $return_url;

```

This then directs the user to the result page should they meet the specification outlined in the question.

The only issue with this is that the form is left incomplete. This is fine for what I need but worth noting for anyone else.

---
Tags: solspace-freeform, add-on-development, extension
---


title: AJW Feedparser feed stopped working

text:
# Question
Title: AJW Feedparser feed stopped working
I have a site that has been using AJW Feedparser to embed an xml feed for months without problems, but has recently stopped working.

If I open the cache file, the feed info is there, but it is no longer being parsed in my EE template.

I tried setting the item path parameter to channel/item but it didn't make a difference. Is there some other parameter I'm missing?

My template code:

```
{exp:ajw_feedparser
url="feed"
cache_refresh="60"
limit="8"
parse="inward"
debug="true"
}
    <tr>
        <td class="four">
            <p class="meta">{event_start} {if event_end != event_start} - {event_end}{/if}</p>
        </td>
        <td class="eight">
    <h3 class="title zeta"><a href="{link}" title="More Information">{title}</a></h3>
        </td>
    </tr>
{/exp:ajw_feedparser}

```

My feed code:

```
<?xml version="1.0" encoding="US-ASCII" ?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
    <atom:link href="feed url" rel="self" type="application/rss+xml" />
    <title>Events</title>
    <ttl>500</ttl>
    <item>
        <title>Event Title</title>
        <event_start>06/06/15</event_start>
        <event_end>06/06/15</event_end>
        <description>Event Description</description>
        <link>Event URL</link>
    </item>
    ...

```

EDIT: It appears that the plugin is choking on some ascii characters in the feed. I don't have access to change the feed's encoding. Is there a way to get the plugin to handle the ascii characters?

# Answer
> 0 votes
I've had this problem too. The 'proper' solution is to ensure that the feed's fields are wrapped with CDATA markers, but that might not be possible in all circumstances.

---
Tags: plugin, xml, rss
---


# Question
Title: Stash variable in channel entries tag not working
I’m having trouble getting a stash variable to work as a parameter in a channel entries loop. I have not had this problem before so I wonder if it may have something to do with the nature of the variable. It is coming from javascript code and it is called by the code . This produces the result of a city selected elsewhere on the page (for example, Portland). Since that code can’t be used in the channel entries tag I am using the following stash code:

```
{exp:stash:set
    name="city1"
    parse_tags="yes"
    process="end"
    trim="yes"}

    <label class="city"></label>

{/exp:stash:set}

```

This seems to work correctly and both {exp:stash:city1} and {exp:stash:get:blah name='city1’} produce the result of the selected city (for example, Portland). But it doesn’t work in the following expressionengine code:

```
{exp:channel:entries
    channel="place"
    search:city="{exp:stash:get:blah name='city1'}"
    parse="inward"
    dynamic="no"}

    {title}
    <br />

    {if no_results}
        No results
    {/if}

{/exp:channel:entries}

```

I’ve tried as many variants as I can think of using additional stash parameters but I need help.

Thanks, Geoff

# Answer
Unfortunately the `parse="inward"` trick doesn't work with the `search:` parameters. You need to pass the variable as a placeholder to the channel entries tag instead. For example:

```
{exp:stash:parse unprefix="nested"}
   {exp:channel:entries
       channel="place"
       search:city="{stash:city1}"
       dynamic="no"}

       {title}
       <br />

       {if nested:no_results}
           No results
       {/if}

   {/exp:channel:entries}
{/exp:stash:parse}

```
> 0 votes

---
Tags: stash
---


title: DetourPro Redirect Home Page

text:
# Question
Title: DetourPro Redirect Home Page
I have a client that was purchased by another company, and they've asked to have several pages redirect to analogous destinations on the new parent company's site, but they want to maintain access to their current Control Panel.

I'm using DetourPro to manage most of the redirects, but can't figure out how to get it to redirect the home page.

Thoughts?

# Answer
> 0 votes
Looks like you can't! See this support post.

Just tried it and entered "/" for the string to match and it does work, but then locks you out of the Control Panel, as the /admin.php gets re-written also. :( You might not be affected by the control panel logout if your control panel access isn't in the root.

Otherwise you'll have to do it in .htaccess:

```
Redirect 301 /  http://parentcompany.com/wherever/you/want/to/go

```

Alternatively you could add a template tag redirect on the homepage that goes to a different URL that then catches in Detour Pro (bit of poor approach though as bad for SEO to have multiple redirects).

---
Tags: redirects, detour-pro
---


title: Wygwam for EE3?

text:
# Question
Title: Wygwam for EE3?
Are there plans to upgrade Wygwam for the new EE3? We use this plugin in all our work, so the lack of support for EE3 is a big issue for our firm and we are anxious to move to EE3, but not without Wygwam!

# Answer
> 1 votes
According to this tweet, it's on it's way! So hopefully sometime in December..?

Personally I'm waiting before jumping onto EE3, I've heard a mixed bag of comments, but heard good things so far regarding EE3.1, so hopefully that's far more solid with all the main snags sorted, it'll also give more time for add-on developers to catchup.

A good list of add-ons being worked on for EE3 here and good old Devot-ee listing those already released.

---
Tags: ee3
---


# Question
Title: Error: The requested module is not installed: filepicker
I'm using EE version 3.0.2. I created a channel but when I try to upload a file it gives the following error: **"Error: The requested module is not installed: filepicker"**.

I am unable to find any solution to resolve this as I'm very new at using expression engine. Any help would really be appreciated.

# Answer
It is solved in the latest release `3.0.4`
> 0 votes

# Answer
I just wanted to drop a quick update, this is a confirmed bug and the EE devs are currently working on a fix.
> 0 votes

---
Tags: ee2, file-uploads
---


title: recipient_email_user

text:
# Question
Title: recipient_email_user
I have created a tell a friend form, I am using recipient\_email\_user to let the user add their friends email address.

In the free form docs it says this data will be posted to the database and be available for viewing in the Freeform CP Found here, I have tested it and the user gets the email, however, nothing is stored in the free form entries?

In there example they have a field named friend\_email, don't know why that is a required field in the form when there is not an input with that name?

Do i have to create a field called recipient\_email\_user in order to store it? or should it store automatically to the form?

# Answer
> 0 votes
This is considered a special form by Freeform, so it will work while it is not technically a field that exists. If you wish to store the email address in a regular Freeform field so you can view it later, then you will need to create a Freeform field with the short name of **recipient\_email\_user**. :)

You're right about the documentation saying it does this automatically. It doesn't, and I will have the documentation updated. :)

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


title: Assign Authorship Channel Form

text:
# Question
Title: Assign Authorship Channel Form
i have a Channel Form that will allow users to apply for a job post, users are registered and logged in when applying, how can i assign the authorship of that entry to the author of the job post (recruiter)? Right now the form works and reflects the author as the job seeker.

Code:

```
{exp:channel:entries
channel="recruiter_job"
status="open|featured|draft"
require_entry="yes"
limit="1"
dynamic="no"
entry_id="{segment_3}"
disable="trackbacks|pagination"
}

<h3>Applying for : {title} </h3>
<hr>

{exp:channel:form
channel="application"
return="/jobs/apply/ENTRY_ID/application"
include_jquery="yes"
include_assets="yes"
error_handling="inline"
preserve_checkboxes="yes"
class='custom'
datepicker="no"
logged_out_member_id="{author_id}"
}

 {if global_errors}<ul><li>{global_errors}{error}{/global_errors}</li></ul>{/if}

 {embed="includes/title_job" author_id="{author_id}" } {!-- /EMBED AUTHOR ID OF THE RECRUITER--}

 {field:job_application}
{if error:job_application}{error:job_application}{/if}

{/exp:channel:form}
{/exp:channel:entries}

```

# Answer
> 1 votes
So your seeker user is logged in? The `logged_out_member_id` parameter will not work then.

Try setting author\_id with a hidden input, e.g.

`<input type="hidden" name="author_id" value="{author_id}" />`

If that also does not work, consider having instead a custom field containing member\_id of recruiter.

---
Tags: safecracker
---


# Question
Title: Channel Form with Grid and File - "There was a problem with one or more Grid fields"
I have a standard channel form in a template with a number of fields that work fine.

I'm using a grid field that contains one file fieldtype.

No matter what I try I get "There was a problem with one or more Grid fields". I've checked upload location permissions, posting permissions and anything else that's a common problem. Console isn't showing any errors or missing assets and template and php debugging similarly.

Any advice would be greatly appreciated!

PS. The grid and file fields are working fine from the admin interface.

# Answer
I ran into a similar problem. Come to find out, it wasn't grid that was the culprit even though it was flagging grid as the error. EE just changed some code and that really effects how some add-ons function.

One of the big issues with using Add-ons is when the developer forgets to use "remove\_package\_path()" when they are finished with it. Forgetting this not only causes the following fieldtypes to use the same path which is, in turn incorrect, but makes debugging a nightmare.

I haven't had any issues with my DevDemon addons, but others have caused random issues.

If you know enough to crawl through the source files, you can correct it yourself until the developer decides to update.

You could start eliminating them one by one to find out which one is causing the issue.
> 1 votes

# Answer
I know this is old, but is it also what google gave me for this issue, and it doesn't have an answer yet but I just fixed my problem with 2 possible things that may have been giving this error. Seems obvious now, but it's often the obvious things that trip you up.

I was using Grid field with a file field (both native EE)

1. I was trying to upload a file type that wasn't allowed in the particular directory I had assigned to the file field

AND

2. The user group of the user I was logged in as didn't have permission to access the directory assigned to the file field. Both of these corrected the error has stopped.
> 0 votes

---
Tags: channel-form, grid
---


title: Channel Field sort order in EE3

text:
# Question
Title: Channel Field sort order in EE3
In EE2 there was a mechanism whereby the user/admin could move the channel fields about on a channel entry edit page and change their width to wrap short ones next to each other etc This allowed the page to be much more compact and let the field creator create fields in any arbitrary order as they could be reordered later.

Is this still available in EE3? At present it appears as though the fields are displayed in 'natural' order and no reordering is present which results in some *very* long channel entry pages

# Answer
This feature has moved to the "Layouts" section of the Channel Manager. (See docs.)
> 5 votes

---
Tags: control-panel, ee3
---


title: Slashes in CSS path

text:
# Question
Title: Slashes in CSS path
I have a strange problem with CSS path in source code. Everything works actually well but when I open the source code in browser I can see this:

```
<link href="https://testdomain.com/////////////////////////////////////?css=CSS/thumbss.v.1447957170" rel="stylesheet">

```

My code in CMS looks like that:

```
<link href="{stylesheet='CSS/thumbs'}" rel="stylesheet">

```

Why there is so many slashes and how to remove them? Website works well and I do not have any issues but I'd like to clean the code.

I work with EE 3.0.4 and Transcribe module.

Thanks for your help.

**UPDATE:** I found something else. I have 3 languages, English as default. And the problem exists with English only. If I change the language the source code is as should be. Hmmm......

# Answer
Finally I found the reason and solution. English was set up as a default language and I switched off prefix for this language in Transcribe settings. Other languages have been set up with prefixes. When I switched on the prefix for English problem gone. However that's strange an looks like a bug in Transcribe.
> 0 votes

---
Tags: css, path
---


# Question
Title: Gmap - You must enter a location in the field
I'm using EE 2.8.1 and Gmap 3.2.7. I'm suddenly getting a message "You must enter a location in the "custom field" field" when I try and save an entry. This is happening even though we have entered a location;

# Answer
There seems to have been a recent change in the gmap API. See if this thread can shed some light on your issue.

Apparently changing

```
$this->EE->theme_loader->javascript('https://maps.google.com/maps/api/js?sensor=true');

```

to

```
$this->EE->theme_loader->javascript('https://maps.google.com/maps/api/js?v=3.22&sensor=true');

```

in `gmap/ft.gmap.php` might help.
> 3 votes

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


title: Freeform styling elements

text:
# Question
Title: Freeform styling elements
Is it possible to add placeholder text (i.e. placeholder="Your Name") in a Freeform (not Pro) field? And how to style the submit button?

# Answer
The `{exp:freeform:form}` tag is a convenient way to render the form's markup - but because you're dealing with `{freeform:field:name}` instead of raw HTML it doesn't give you that much control over the markup.

However there's a trick so that you can add additional attributes to a field in FreeForm. Simply change your field to this `{freeform:field:name attr:placeholder="Your name"}`

To style your submit button you should use CSS. You can easily target it by adding `form:class="submit-form"` to your opening `{exp:freeform:form}` form and targeting the submit button using `.submit-form input[type="submit"] {}` in CSS.

See https://stackoverflow.com/questions/17042201/how-to-style-input-and-submit-button-with-css for more help with the styling.
> 4 votes

# Answer
You can style the submit button by adding a class:

```
{freeform:submit attr:class="button"}

```

(at least, as of 4.2.4)
> 1 votes

---
Tags: solspace-freeform
---


title: Channel Images import hangs

text:
# Question
Title: Channel Images import hangs
I have a site where Channel Images' Upload works and images are displayed but Import simply hangs.

Also, Channel Images is generating long randomly-named directories in the site's home directory and saving images there.

All the settings seem correct and everything passes with Test Location in Upload Location Settings.

Anybody seen this before?

# Answer
> 0 votes
It was a while back but I think it was a permissions issue on this instance of the site -- the /htdocs folder itself had permissions that were too strict.

---
Tags: channel-images
---


# Question
Title: How can I get the template name in the template?
I am trying to pass the template name in my tag and wanted to do something like this:

```
<html id="template-{template_name}">

```

Any idea how to get the name of the template? Thinking aloud it'd be cool to also maybe suffix the template group as well. So a template embeds/\_foo would return "embeds-\_foo" ideally?

# Answer
Are you looking for something as straightforward as this?

```
<html id="template-{segment_1}-{if segment_2 != ''}{segment_2}{if:else}index{/if}">

```

Ah, I see you are wanting embeds as well. Here is a very simple plugin that will output some metadata for the template that is currently being processed.

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

/*
Copyright (C) 2014 EllisLab, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
ELLISLAB, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Except as contained in this notice, the name of EllisLab, Inc. shall not be
used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from EllisLab, Inc.
*/

$plugin_info = array(
                        'pi_name'           => 'Template Info',
                        'pi_version'        => '1.0',
                        'pi_author'         => 'Derek Jones',
                        'pi_author_url'     => 'http://ellislab.com/',
                        'pi_description'    => 'Outputs info for the currently processed template',
                        'pi_usage'          => Template_info::usage()
                    );

/**
 * Template_info Class
 *
 * @package         ExpressionEngine
 * @category        Plugin
 * @author          EllisLab Dev Team
 * @copyright       Copyright (c) 2014, EllisLab, Inc.
 * @link            http://ellislab.com/
 */

class Template_info {

    public $return_data;

    /**
     * Constructor
     *
     */
    public function __construct()
    {
        $vars = array(
            'template_name' => ee()->TMPL->template_name,
            'template_group' => ee()->TMPL->group_name,
            'template_id' => ee()->TMPL->template_id,
            'template_type' => (ee()->TMPL->embed_type) ? ee()->TMPL->embed_type : ee()->TMPL->template_type
        );

        $this->return_data = ee()->TMPL->parse_variables(ee()->TMPL->tagdata, array($vars));
    }

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

    /**
     * Usage
     *
     * Plugin Usage
     *
     * @access  public
     * @return  string
     */
    public function usage()
    {
        return <<<YODA
        Parses a few metadata variables about the template currently being processed.

        {exp:template_info}
            This is the {template_name} template from the {template_group} group.
            Its ID is {template_id} and its type is {template_type}.
        {/exp:template_info}
YODA;
    }

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

}
// END CLASS

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

```
> 5 votes

# Answer
Well if you're not using embeds for the template then you could use segment\_1 and segment\_2. However I do not believe what you want to do is possible.
> 2 votes

# Answer
It looks like Leevi Graham did something like this for EE1. I'm not sure how well it would work with Structure or other custom URL structures. I suppose you could look into doing something similar for EE2.

However, I'd recommend considering an alternative approach. I'm not sure why you're needing to set the html ID to the template name, but maybe you can use something else here. If you're including the header via an embed or a Stash template partial, you could specify this per template as you're including it (like you would the page title). I believe there would even be a way to trick it when using snippets, as well.
> 2 votes

# Answer
I understand there has been a variable {template\_name} for some time.
> 0 votes

---
Tags: templates
---


# Question
Title: Uninstalling add-ons Subscriptions causing DB error
I'm trying to uninstall two add-ons that we have no intention of using on the production version of this project (Store and Subscriptions). Unfortunately, every time I go to uninstall I get this message when I try to view the fields in a channel field group:

If I'm reading that right, it's telling me that the table for the add-on I just uninstalled doesn't exist. Um, duh?

Since the error **seems** to only occur when I try to view custom fields, I assumed it was because one of my fields was still set to the field type for this add-on (Subscriptions). I've double- and triple-checked (including looking at the database directly, in the `exp_channel_fields` table) and not a single custom field is set to use the Subscriptions field type. I also checked Matrix since we're using it quite a bit and none of the columns are set to use that field type.

Truly stuck. :/

---

EDIT: This is NOT limited to just the Subscriptions add-on. It also happens when trying to uninstall Expresso Store.

# Answer
When you go to Add Ons -\> Fieldtypes in the Admin, it shows fieldtypes that are not installed to give the option of installing. So it will read the file ft.subs\_plan\_selector.php even if its not installed.

Unfortunately the file ft.subs\_plan\_selector.php is calling subs/autoload.php right at the top, which will go onto calling the AddOns other methods and functions which will include reading the table, which doesn't exist of course as its uninstalled.

Moving the uninstalled subs folder out of third\_party (delete from server) fixed this for me.

Although it should be addressed by DevDemon of course. The expected behaviour is the subs folder can sit in third\_party uninstalled and not affect the site.
> 0 votes

---
Tags: custom-fields, module, addons, devdemon-subscriptions
---


title: Problem with Expresso Store and PayPal

text:
# Question
Title: Problem with Expresso Store and PayPal
My client is using version 1.6.5 of Store with the PayPal Express gateway and 2.5.5 of ExpressionEngine for a site we built a couple of years ago. Suddenly, over the last couple of weeks, there have been many incomplete transactions. Users are complaining that they are either unable to get onto the PayPal site at all after putting in their details, or those that can get onto PayPal can't click to complete the purchase. Other orders are getting through fine. I have been unable to replicate the problem on my end despite ordering several items. Still, there are several incomplete transactions every day and my client is getting upset.

It is very costly and time consuming to upgrade Store and EE (the current version of Store won't work with my version of EE according to the website) and my client isn't really in the position to authorise this kind of cost.

Does anyone know what's causing the sudden problem? I checked with the web host and they haven't done anything to the server. Does anyone know of a fix for this?

Any help appreciated. Thank you!

# Answer
We found exactly the same problem with EE 2.5.5, Expresso Store 1.6.5 and PayPal Express with a client website. I believe something changed at PayPal which has affected the ability of Expresso Store to communicate with PayPal in the way that it always has. We were warned about the IPN changes but this should not affect the workings on Store.

You may find it useful to know that for us it only seemed to affect 'Guest Checkout' transactions. I.e. transactions where a customer wanted to pay with a credit/debit card at PayPal. Its unlikely you will replicate the issue if you simply log in to a registered PayPal account and try to pay. These transactions seemed to be going through without a problem.

There appear to have been changes on the PayPal Express Checkout page that makes it harder for the user to pay with a credit/debit card. At the point where the customer opts to pay with a card, fills in their card details and then has to agree to Guest Checkout terms that transactions would not proceed forward.

**Our solution was to integrate Stripe for card processing.** I had already started the developing the checkout process for inclusion of Stripe as my client wasn't happy about how PayPal was pushing their customers to register. When the problem you describe was spotted we decided to complete the Stripe integration as this was going to be quicker to implement than troubleshooting further the PayPal changes.

Following successful Stripe integration we switched off PayPal Guest Checkout with PayPal now being 'Account Required'.

The checkout review details page now has Stripe card payment as default with an option for the customer to switch to PayPal.

I should say there is an annoying bug in Expresso Store 1.6.5 that may cause you problems if you decide on a similar solution for your client. It affects the use of radio buttons for selecting payment gateways: https://expressionengine.stackexchange.com/a/15106/1019

Once I identified this I implemented gateway selection using a select dropdown instead.

If you find a fix for the PayPal card processing instead please do post back here. I do intend to investigate this further but with Stripe working the pressure is off.

Good luck,

Steve
> 2 votes

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


title: Entry Search - Spinning Wheel of Death

text:
# Question
Title: Entry Search - Spinning Wheel of Death
Noticed this particular issue with a site. I am currently using EE 2.7.3 and whenever I try doing a search under the "EDIT" section in the search field, I get a spinning wheel of death. Nothing happens.

# Answer
> 1 votes
This is a bug in 2.7.3, documented here. There's a fix in the bug report as well.

---
Tags: search
---


# Question
Title: How does CartThrob limit coupon code usage?
When you set up a coupon code, you can specify how many times it can be used per customer (via the "Per User Limit" field). However, how does CartThrob keep track of this? I assume by member ID, if the user is logged in. But what if they're not logged in? Is it by IP address, by the billing/shipping info they enter for their order, or some other method?

# Answer
> 0 votes
Looking at the code, CartThrob can only use this feature for logged-in members. It cannot track coupon code usage by guests.

---
Tags: cartthrob, coupon-code
---


# Question
Title: How do you conditionally embed a template based on template name?
I have created a .header template that goes in all of the content templates on a site. However, there are only two templates that require additional jQuery code inside the .header template. I don't want to include the secondary code in all template. I have reviewed the documentation here and know that it is possible to conditionally embed the extra code. I just can't find where that information is.

Here is the normal embed code for including the .header template:

```
{embed="inc/.header"}

```

Here is what I am trying to accomplish in English:

> embed .header template, if the template is page\_visit embed .map\_code in .header template.

My attempt - which doesn't work:

```
{embed="inc/.header" {if template="page_visit"} embed="inc/.map-code"{/if}}

```

What is the correct way to do this?

# Answer
> 0 votes
Ingmar's answer will work, but my preferred way to do this (if you're not using Template Layouts that is - which you really should be!) would be to actually declare what you want to do via your embed parameters. e.g.,

```
{embed="inc/.header" include_map="y"}

```

Then in your embedded template you can use:

```
{if embed:include_map == "y"}
     // Your map code.
{/if}

```

This code will make much more sense down the road when you or someone else revisits it, and it's easier to enable that same extra code in your header in other templates as well.

Lastly, I'd also suggest you *not* place an embed *inside of* another embed, as it's not very performant. (Just put your actual javascript there in this example.)

# Answer
> 1 votes
You will need to determine which template you are on. You should be able to use `{template_name}` for this. Then a simple conditional will do it:

```
{embed="inc/.header"}

{if "{template_name}" == "page_visit"}
    {embed="inc/.map-code"}
{/if}

```

You could also pass the template name on to .header, like so:

```
{embed="inc/.header" my_template_name = "{template_name}"}

```

And then in .header use a conditional like this:

```
{if "{embed:my_template_name}" == "page_visit"}

    {!-- calling template is page_visit, embed code for it --}

{/if}

{!-- here goes the rest of your code common to all templates --}

```

---
Tags: templates, embeds, advanced-conditionals
---


# Question
Title: Alternative to price_inc_tax in expresso store 2
I need to show product prices including applicable tax in product form. I have tags like {price} {regular\_price} but none of them can show price inclusive tax. I see that {price\_inc\_tax} was available in store 1 but deprecated in store 2. Is there any alternative available for it on store 2.

Thanks for your help.

# Answer
> 1 votes
There is not, because you are now expected to include the tax in your product price if you are using tax-inclusive pricing. From the upgrade notes:

> In Store 2, prices are entered in the control panel exactly as you want them to be displayed. Taxes may be configured as "included in price", which indicates that the tax should not be added to the order total. For example, say you create a product which sells for $20.00, and a tax of 10% which is included in the price. In the checkout, when the customer purchases this item, they will see the item price as $20.00, a tax of $1.82, and an order total of $20.00.

# Answer
> 1 votes
For the same reason (upgrading from EE1 to EE2 with all prices entered without tax), I wrote a tax plugin which could display it however I wanted.

The documentation is non-existent, but this should get you going...

**Only** Returns just the tax.

```
{exp:tax:only price="<price from store>"}

```

**Price** Returns the total price (with tax)

```
{exp:tax:price price="<price from store>" included="no"}

```

**None** Return the price without tax - assumes tax is included in price

```
{exp:tax:none price="<price from store>"}

```

Looks like it works as a tag pair too:

```
{exp:tax:only rate="5"}{price}{/exp:tax:only}

```

Additional parameters

* rate="5"
* show\_currency="yes"
* currency="$"
* position="before" (currency symbol position, options: before, after)
* decimals="yes" (decimal places set through config only)
* thousands="yes" (show thousand separator - character set through config, defaults to ",")
* rounding="up" (valid options: up, down, nearest)
* included="no"

You can set any defaults in EE Config:

* tax\_rate
* tax\_included
* tax\_currency
* tax\_position
* tax\_decimals
* tax\_thousands
* tax\_show\_currency
* tax\_rounding
* tax\_decimal\_places
* tax\_thousand\_symbol
* tax\_decimal\_symbol

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


title: Responsive mobile plugins going nowhere

text:
# Question
Title: Responsive mobile plugins going nowhere
I have spent many hours testing several of the popular mobile detect plugins and get mostly errors.

When I look at their support options, they seem to have shut down many months ago. I'm starting to wonder if they aren't compatible with more recent versions of Expression Engine, and the developers gave up on them.

Are any of you having luck with them? If so, which plugins do you use and what version of EE are you using?

When I follow the documentation for MX Mobile Device Detect, I get the following:

```
{exp:mobile_detect:device}
{if "{exp:mobile_detect:device}" == "mobile"}
Greetings mobile visitor!
{/if}
{if "{exp:mobile_detect:device}" == "not_mobile"}
Greetings desktop/laptop visitor!
{/if}
{/exp:mobile_detect:device}

```

Produces the response "not mobile" on my desktop and a blank on my phone.

The following code produces a blank instead of Hello Bill.

```
{exp:mobile_detect}
    {if device == "ipad"}
        Hello Steve
    {/if}
    {if device == "android" }
        Hello Bender
    {/if}
    {if not_mobile}
        Hello ... Bill ???
    {/if}
{/exp:mobile_detect}

```

The following code also produces a blank:

```
{exp:mobile_detect:screen_detect}
{if {screen_width} > 1024}You have desktop{/if}
{/exp:mobile_detect:screen_detect}

```

# Answer
> 0 votes
**EDIT**: Even after I tried my method out, I still returned inconsistent results. I'd strongly recommend using Gareth Davies' Detect Mobile plugin, since it's CMS-agnostic and will likely not break simply because Expression Engine is updated.

https://github.com/garethtdavies/detect-mobile

After installing it and implementing the following logic, it worked flawlessly:

```
{if "{exp:detect_mobile:ismobile}"}
    <script type="text/javascript" src="{path="scripts/mobile"}"></script>
{if:else}
    <script type="text/javascript" src="{path="scripts/desktop"}"></script>
{/if}

```

---

I've been having trouble with MX Mobile Detect as well, running EE 2.8.

If you're fed up with that plugin, you might also try Gareth Davies's version:

https://github.com/garethtdavies/detect-mobile

I'll share my solution with you, as it's the best one I could figure out given poor documentation and upkeep. What they fail to emphasize is that the pair tags are specified using `exp:mobile_detect:pair` for **server-side** user agent detection and that the conditional variables are **custom**, not prebuilt. When I tried the `{screen_width}` specified in their example, it did not return a value. Therefore, it's probably safe to assume this was an example variable they created in their MX Mobile Detect settings.

I create a variable with the name "responsive" and specify the criteria for returning various string values. In my template, I create

```
{exp:mobile_detect:pair}
    {if "{responsive}" == "mobile"}
        <script type="text/javascript" src="{path="scripts/mobile"}"></script>
    {if:else}
        <script type="text/javascript" src="{path="scripts/desktop"}"></script>
    {/if}
{/exp:mobile_detect:pair}

```

Based on what my experience with the plugin, it seems like it detects **device width**, not **browser/window** width. If you're using a 1024px wide display, it'll still return the conditional value for 1024px, even if your browser window is less than that.

If you need more information on how to debug, try out this page for information. But you should test the output yourself.

http://www.eec.ms/user\_guide/mobile-device-detect/tags.html#lv19

# Answer
> -2 votes
You can always use a core php class for detecting a mobile device. I've worked with this class before (no EE site) http://www.phpclasses.org/package/7277-PHP-Detect-mobile-devices-from-request-headers.html.

You would also be able to use this inside a EE template by enabling php on input.

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


title: Playa in a matrix column P&T example

text:
# Question
Title: Playa in a matrix column P&T example
I've been trying to use the sample code from Pixel and Tonic for accessing playa data in a matrix field (ee2.10, playa 4.5.2, matrix 2.6.1). They provide a very clear example which I cannot get to work. Here's their example which is exactly what I want to accomplish:

---

```
{my_matrix_field var_prefix="spkr"}
    {spkr:favorite_bands} {!-- a Playa column --}
        {albums var_prefix="albm"} {!-- a Matrix field inside the band channel --}
            {spkr:row_count}.{albm:row_count} - {albm:album_title}
        {/albums}
    {/spkr:favorite_bands}
{/my_matrix_field}

```

---

However, using this as I guide I get no results. I've had to modify the above code and instead of accessing the playa column as suggested above, I've had to resort to a playa children tag which seem less efficient. Here's my code using the above as a guide that results in no output from the playa column. I'm wondering if other's have tried using P&Ts example with or without success.

---

```
{neighborhood_plans var_prefix="npd" search:neighborhood_plan_availability="not hide"}{!-- Matrix field in neighborhood channel --}
    {neighborhood_plan var_prefix="pd"}{!-- Playa column in matrix field in neighborhood channel --}
        {pd:title}
    {/neighborhood_plan}
{/neighborhood_plans}

```

---

# Answer
> 1 votes
Looks like our Playa field tag (`{neighborhood_plan}`) is missing the prefix - it needs that since it's inside of your prefixed Matrix field:

```
{neighborhood_plans var_prefix="npd" search:neighborhood_plan_availability="not hide"}{!-- Matrix field in neighborhood channel --}
    {npd:neighborhood_plan var_prefix="pd"}{!-- Playa column in matrix field in neighborhood channel --}
        {pd:title}
    {/npd:neighborhood_plan}
{/neighborhood_plans}

```

---
Tags: matrix, playa
---


title: Cannot delete channel image

text:
# Question
Title: Cannot delete channel image
I have a channel image field set in one of my channels. Curiously this field allows me to delete an image from one channel entry but on another channel entry it allows me to unlink the image instead.

I can't find out why. Can anyone explain?

# Answer
You can only delete images if that was the place it was originally uploaded. Once an image is uploaded it can be "linked" from other entries. Since that is not the original entry where the image exists you can only "unlink" it and you must delete from the original.
> 1 votes

---
Tags: devdemon, channel-images
---


# Question
Title: Channel Images: "success":"no","body":"No file was uploaded or file is not allowed by EE.(See EE Mime-type settings)."}
I am getting a error every time I try and upload an image using channel images.

There's no file size or dimension restrictions in upload preferences, its a simple .jpg about 50kb. Max upload is set to 8mb. tried .png too.

Error: "success":"no","body":"No file was uploaded or file is not allowed by EE.(See EE Mime-type settings)."}

ExpressionEngine 2.9 Channel Images 5.4.19

Any Ideas?

# Answer
I deleted that entry and published the page again. (it was in a home channel, so only one entry luckily.)
> 0 votes

# Answer
Is this happening locally or on a host? Can you upload that file via the EE File manager? When I got a similar error (for a larger file) using Channel Images, the fix was to tweak my settings. Here is what I am using:

```
max_execution_time = 600
max_input_time = 600
memory_limit = 256M
post_max_size = 200M
upload_max_filesize = 200M

```

or via .htaccess (if your host allows)

```
php_value upload_max_filesize 200M
php_value post_max_size 200M
php_value max_execution_time 600
php_value max_input_time 600
php_value memory_limit 256M

```
> 0 votes

---
Tags: channel-images
---


# Question
Title: SalesForce integration with Expression Engine has anyone integrated this?
Here is a brief background on the issue. Client has force.com CRM and posts and manages all its ticket orders for upcoming events in Salesforce. What I would like to do is integrate EE to manage and display all the events. Is it possible to be able to pull those events from object tags within Salesforce such as date, images and descriptions, and display that data in EE channels. So basically a nice responsive front end website in EE with Salesforce data. We have looked at site.com but is too expensive. Would I need a plugin for accomplish this?

# Answer
> 0 votes
I have never used SalesForce, but here's the breakdown. Use their API's:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/

Then simply write a module triggered by a cron job (curl the ACTion ID):

https://ellislab.com/expressionengine/user-guide/development/module\_tutorial.html

That pulls in the data from SalesForce, and uses the Channel Entries API:

https://ellislab.com/expressionengine/user-guide/development/api/api\_channel\_entries.html

To dump the data in a channel. And Tada! Wish I could give you an experience with this, but I kinda avoid SalesForce like it is the plague. (Maybe it's not so bad?)

# Answer
> 0 votes
The Solspace Team built a SalesForce integration module (not commercial), you can contact them. Blog post : ExpressionEngine + Salesforce

---
Tags: salesforce
---


# Question
Title: Entry titles that start with X,Y, or Z do not show up on page
Hey everyone this is a weird issue I hope I can get some clarification.

Firstly, this is EE 2.2.0.

One of our pages cannot show entries that have a title that starts with X,Y,or Z. All other letters work. There is nothing complex in the code to exclude any letters or anything like that.

```
{exp:channel:entries channel="add-job" orderby="title" sort="asc"}
{if job-type == "Full-Time"}

<h4><a href="{title_permalink='/employment/job-detail/'}">{title}</a></h4>
<ul>
{related_entries id="Willson"}<li> Camp Willson</li>{/related_entries}
{related_entries id="delawarey-staff-contact222"}<li>Delaware Community Center </li>{/related_entries}
{related_entries id="Downtown"}<li>Downtown </li>{/related_entries}
{related_entries id="ELC"}<li> Early Learning Center</li>{/related_entries}
{related_entries id="ECRN"}<li>ECRN+</li>{/related_entries}
{related_entries id="Ward"}<li>Eldon & Elsie Ward Family </li>{/related_entries}
{related_entries id="gahanna-staff-contact"}<li>Gahanna </li>{/related_entries}
{related_entries id="grovecity-branch-contact"}<li>Grove City </li>{/related_entries}
{related_entries id="hilliard-branch-contact"}<li>Hilliard </li>{/related_entries}
{related_entries id="hilltop-branch-contact"}<li>Hilltop </li>{/related_entries}
{related_entries id="hilltopeducare-branch-contact"}<li> Hilltop Educare</li>{/related_entries}
{related_entries id="cherrycreek-branch-contact"}<li>Hilltop /Cherry Creek</li>{/related_entries}
{related_entries id="hoover-branch-contact"}<li>Hoover Y Park</li>{/related_entries}
{related_entries id="garver-branch-contact"}<li>Jerry L. Garver </li>{/related_entries}
{related_entries id="liberty-branch-contact"}<li>Liberty Township/Powell </li>{/related_entries}
{related_entries id="metro-contact"}<li>Metropolitan Offices</li>{/related_entries}
{related_entries id="north-branch-contact"}<li>North </li>{/related_entries}
{related_entries id="pals-contact"}<li>PALS/Juvenile Justice</li>{/related_entries}
{related_entries id="pickaway-branch-contact"}<li>Pickaway County Family </li>{/related_entries}
{related_entries id="stanns-branch-contact"}<li> St. Ann's Educare</li>{/related_entries}
{related_entries id="sunshine-branch-contact"}<li>Franklin Station</li>{/related_entries}
{related_entries id="vaughn-branch-contact"}<li>Vaughn E. Hairston </li>{/related_entries}
{related_entries id="van-buren-center-contact"}<li>Van Buren Center</li>{/related_entries}
</ul>

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

```

I can take an entry that doesn't work, change the title to "T" or really any other letter, and it will work. When I make test entries that just say X,Y, or Z, nothing works.

# Answer
> 0 votes
Thanks guys! This is the second time the default entry limit got me. I need to remember this.

The solution was, in fact, setting the entry limit to a higher number.

---
Tags: channel-entries, entries, title
---


# Question
Title: How do I automatically switch to a user's language upon first visit while still being able to switch to other languages?
I'm currently working on a project where the website has two languages, Dutch and English. I've set up my root `index.php` to have Dutch set as default language and an `index.php` in `/en/` is pointing it to the English website.

My ExpressionEngine version is v2.10.1.

I'm not sure where to start from here. My main questions are:

* How do I determine the user's location to be outside The Netherlands?
* How do I keep the language switcher intact (preventing endless redirects).

Thanks in advance.

# Answer
> 0 votes
Depends how you're managing languages in your EE build (e.g. Transcribe, Publisher, hand-rolled).

Either way, it will be cookie or session based, dropping a variable that states you've automatically taken them somewhere and not to do it again. Best method is using the Session add-on.

Detecting the users location via IP will probably require GeoIP or IPGeo.

**But fundamentally** please consider your users!!! It's very bad for you to assume that you know what they want. I'm English and and work in Holland, I follow a link to the English website but you're going to force me to the Dutch website - WTF?!? The Googlebot, is happy to crawl and index your website, but everytime it tries to start it's crawl from the Dutch homepage it gets forced to the English website because it's based in the US! This does have massive implications to SEO performance. Here's a slideshow from a presentation regarding the SEO issues of internationalization that may help (alas there wasn't a video of it).

A couple of other posts on Stack Exchange that may help:

Redirect multi language site based on IP address

how can I redirect a homepage depending on the browser language settings

---
Tags: multi-language, cookies, index.php
---


title: Setting expiry length of login cookie

text:
# Question
Title: Setting expiry length of login cookie
Is there a way to set the expiry time of the login cookie for users on the front end of an EE site?

I know there are hidden config variables for user\_session\_ttl but they don't seem to work if the Website session type is set to "Cookies only". With Sessions enabled the login system doesn't work properly.

This is on a 2.9.2 site.

# Answer
Yes, there is. I had to ask EllisLabs to find it.

The config files aren't only `config.php` and `database.php`. On `system/expressionengine/config`, you can find `remember.php`. Edit the `$config['remember_me_ttl']` variable;

It's safe to edit all config files. Just remind of them when updating EECMS.
> 0 votes

---
Tags: login, sessions, cookies
---


# Question
Title: Mamp Pro .htaccess issues for 'index.php' removal on local domain
Using MAMP Pro I have an offline/local EE site setup. An htaccess file is set up in the root of the local domain site with the standard remove index.php script implemented (as shown in the offical ExpressionEngine documentation).

I know the htaccess is being picked up because I can get a 500 server error page to execute if I put random code in in the file.

However if I put the official EE index.php removal code in the htaccess and go to local.sitename/sitepage I get the following error:

**Not Found The requested URL /sitepage was not found on this server.**

Just to confirm I have the following in the .htaccess:

```
<IfModule mod_rewrite.c>
        RewriteEngine On
        RewriteBase /

        # Removes index.php from ExpressionEngine URLs
        RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
        RewriteCond %{REQUEST_URI} !/systemfoldername/.* [NC]
        RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

        # Directs all EE web requests through the site index file
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>

```

In terms of MAMP set up:

1. I have Mamp Pro installed with Set ports Apache and MySQL to 80,443 and 3306.
2. A local custom domain set up via HOSTS panel ' ie. local.sitename '.
3. Under HOSTS \> Extended TAB \> 'Options All'. is selected to include all options.
4. PHP Version set to Default: (5.5.26) for local domain.

In terms of EE Control Panel:

1. 'index.php' is removed from: Admin \> General Configuration \> Name of your site's index page (field).

In terms of htaccess variations of I have tried:

1. Removing `<IfModule mod_rewrite.c>` tag pair.
2. Adding a local path for RewriteBase / (ie. RewriteBase /username/sites/sitename/ etc).
3. Removing the slash '/' from before index.php on line: `RewriteRule ^(.*)$ /index.php/$1 [L]`

# Answer
This fixed it:

The actual formatting of the .htaccess file was incorrect.

It needed to be as per attached PNG snapshots:

Once I refomatted the file as shown above the issue was resolved!
> 1 votes

---
Tags: htaccess
---


title: Last Wiki version for EE 2

text:
# Question
Title: Last Wiki version for EE 2
Wiki version 2.3.

Anyone know what the last available version of the first-party Wiki module is for EE2? I have some old wiki living somewhere on a site, and it's pulling this crap:

```
Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 9

SELECT r.*, m.member_id, m.screen_name, m.email, m.url, p.page_namespace, p.page_name AS topic FROM exp_wiki_revisions r, exp_members m, exp_wiki_page p WHERE p.last_updated = r.revision_date AND m.member_id = r.revision_author AND r.page_id = p.page_id AND r.revision_status = 'open' AND r.wiki_id = '1' ORDER BY p.last_updated DESC LIMIT

Filename: modules/wiki/mod.wiki.php

Line Number: 1518

```

at this address `/Special:Recentchanges_Atom`. I honestly don't have time to debug something that's pretty damn underused, but it shows up as broken links with our web governance tool, and I just wish to be rid of it. I'm hoping we just missed a sub-version upgrade or something.

# Answer
I get the same error with Wiki 2.3 and EE 2.10.1. That SQL query should specify a number for the limit e.g. LIMIT 10.

The easiest way to fix it is to change the template code for wiki\_special\_atom.html. Change the line (I'm using the default theme):

> {wiki:recent\_changes}

to

> {wiki:recent\_changes limit="10"}

The best way is to fix mod.wiki.php but I don't have time for that either. :)
> 1 votes

---
Tags: ee2, wiki
---


title: Single entry per member

text:
# Question
Title: Single entry per member
I am looking to set up a site where certain channels can only have one entry per member, whether it be through expressionengine settings or through an add on. Does anyone has any experience of setting up anything similar?

Thank you

# Answer
You could do this with template tags, literally limiting access to channel entries they have authored to '1' - therefore they could only view/edit the same one entry? OR you could use something like zoo visitor, which stores member data as channel data, and then set up a single entry relationship between the member entry and their designated entry? But I think the first option would do it...
> 0 votes

# Answer
We actually just accomplished a similar setup with the Solspace User module. Zoo Admin gave us some trouble once we started to deal with MSM (disclaimer before you buy). We're using it in a profile setting where we needed to use channel fields to get all of the functionality we wanted. Once assigned as author, that member has full access to edit their member and/or channel entry fields. Pretty pleased with the outcome. Let me know if this would help for your -- happy to share our work.
> 0 votes

# Answer
I've built something kind of similar where I have a field to store that members member\_id and then, within the template for viewing the entry, I use the search param to find only entries with their member\_id in that field. although there was a plugin I needed to affect the parse order of the member\_id global variable as it parses quite late and is otherwise not usable inside the channel entries tag.

This is a manual process but within the context I required it was perfect as member assigning was a required step of the system we put together.
> 0 votes

# Answer
This should be possible with out-of-the box functionality, using custom member fields. This is not a channel entry, of course, but can be displayed anywhere you want.
> 0 votes

---
Tags: channel-entries, members
---


# Question
Title: Store: Evaluating {order_subtotal} minimum amount in Checkout
How can we easy check if the {order\_subtotal} has a minimum of 50.00 on the first checkout page in Store. {order\_subtotal} holds the amount together with the currency indicator and can therefor not be used for evaluating the amount with a simple if conditional.

Is there another tag with the only the value of the sub\_total? Or do we need to manipulate with PHP here?

We want to deactivate the Continue button in the checkout process if the sub\_total is not 50.00 (or whatever amount) and show a message.

# Answer
> 0 votes
You can add `_val` to any price variables to get the unformatted version in any of the store tags (orders, product, checkout, cart) to use in conditionals.

> All price variables are pre-formatted according to your currency formatting settings. If you want the unformatted amount, simply append \_val to the variable.

It is mentioned in the docs in passing here.

So in your checkout template you will want to have something along the lines of:

```
{if order_subtotal_val > 50}
 Your Subtotal is over $50.00 logic
{if:else}
 Lets add some more items to the cart your subtotal isn't $50.00
{/if}

```

---
Tags: expresso-store
---


title: .htacess not forcing www

text:
# Question
Title: .htacess not forcing www
Cannot get my site to force www. keeps showing a 404 (https urls) or 403 (http urls) server error.

```
<IfModule mod_rewrite.c>

    # Force HTTPS
        RewriteEngine On
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

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

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

  # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>

```

# Answer
> 1 votes
Try to combine your redirects, so you minimise the amount of jumps as it's bad SEO to have too many. Your first chunk goes to https, but your second jump (forcing www) doesn't - which may explain your different server errors.

Redirect your incorrect domain first (to the correct https version), then the https, therefore if someone isn't accessing the URL with the www and without the https, they'll be put right by the first redirect.

```
# redirect to www version
# RewriteCond %{HTTP_HOST} ^www.yourdomain.co.uk [OR] - Example for multiple domains
RewriteCond %{HTTP_HOST} ^www.yourdomain.com [NC]
RewriteRule ^(.*)$ https://yourdomain.com/$1 [L,R=301]

```

After the above, add the https detection...

```
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

```

If you want to only secure certain URLs, add the following to the beginning of the code above:

```
RewriteCond %{REQUEST_URI} (checkout|account)

```

Depending on the server, the `%{HTTPS}` detection may not work and you have to check for port instead:

```
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,NC,L]

```

---
Tags: htaccess
---


title: Trash tags in variables

text:
# Question
Title: Trash tags in variables
While using the EE 3.0.2, I got this trash inside a variables, when using for example {exp:channel:categories} or {exp:channel:category\_heading}

Ex:

```
{exp:channel:category_heading}
<h1> my free text here  {my_category_field} </h1>
{/exp:channel:category_heading}

```

But when I'm viewing my result, I see this:

```
<h1> my free text here <p>category field value</p> </h1>

```

There is a format field option in adding new field for categories, when I'm creating a field, I'm choosing no format at all, but when I'm going to edit the options of created field, I see the "XHTML" selected option there, which I can't change to something else. I think this trash "p" tag is going from here. What should I do to destroy this bug?

# Answer
It's a bug (#21272) that's been fixed in EE 3.03.
> 0 votes

# Answer
> What should I do to destroy this bug?

... start by verifying it's a bug, and then report it to EllisLab. This is a common issue with EE (people finding the `<p>` tag inserts in formatted fields) but usually setting the field format to `None` fixes that. Did you edit the field and verify its setting?

Head on over to your

```
system/index.php?/cp/channels/fields/edit/XXX

```

page (`XXX` is your field\_id) and verify that it's `Text formatting` is set to `None`.
> 0 votes

# Answer
So, until it's a bug, we need a common decision for it. I made this:

```
<h1>My custom text <?=strip_tags('{my_category_field}')?></h1>

```

and turned on PHP-parsing on closing for that template. Dumb, but this works for now.
> 0 votes

---
Tags: categories, fields
---


title: Wanting to filter results in EE tags

text:
# Question
Title: Wanting to filter results in EE tags
Busy developing some custom modules for EE. Everything is going swimmingly, except I can't seem to find any documentation on how to filter results in my modules tags.

What I am looking to achieve is something like:

```
{exp:my_mod:my_func month="June"}
    ...
{/exp:my_mod:my_func}

```

My hope is to filter results here and only show results for the month of June, rather than doing this filtering in the .mod file. Is this a simple thing to achieve of should I just do it manually on the back end (which would mean creating 12 separate modules)

# Answer
> 1 votes
It's a common function functionality of addons to use parameters, so there's an EE function for that:

```
ee()->TMPL->fetch_param('param_name');

```

Check out the docs if you need an example and more info.

---
Tags: ee2, php, tags, codeigniter
---


title: EE3 and Playa - do they work together

text:
# Question
Title: EE3 and Playa - do they work together
I don't see anything in the change log or mentioned on the Pixel and Tonic website. Does Playa work with ExpressionEngine 3?

# Answer
Brandon Kelly would definitely list it in a change log if it were released for EE3. I don't think he's actually published a road map for EE3 as of yet, but has tweeted that he is working on EE3-izing his add-ons. You can take a look at EE3 compatible add-ons on the https://www.devot-ee.com. Probably not 100% complete, but it'll be 99% of released EE3 add-ons.

https://devot-ee.com/add-ons/filter?&f=ee3
> 2 votes

---
Tags: playa
---


# Question
Title: ERR_CONTENT_DECODING_FAILED when creating template route for specific entry
I have 3 templates in a template group

Template Group

```
/customer-service
/customer-service/expert-tip
/customer-service/expert-tips

```

I want to use the second template to display specific channel entries like so, with the third segment being an entry ID:

```
/customer-service/expert-tip/{tip:alpha_dash}

```

However, when I do this, I can't access **any** of these templates. They all return an `ERR_CONTENT_DECODING_FAILED` error in Chrome.

Templates Routes are enabled in my global settings and I also have this expert-tip template set to require all 3 segments.

Any idea what is causing this?

**EDIT** I've tested the URLs in Firefox, Safari, and Chrome and the template routes work for everything except normal Chrome. Even Incognito Mode works for Chrome.

**EDIT2**

```
Message:  preg_match_all(): Compilation failed: group name must start with a non-digit at offset 35
Filename: libraries/Template_router.php
Line Number: 56

```

# Answer
> 0 votes
The first problem was that my output settings had GZIP encoding enabled. After disabling GZIP encoding, the page rendered with the error I mentioned in **EDIT2**.

After seeing this error, I found this thread on Ellis Lab's website: https://support.ellislab.com/bugs/detail/20493/custom-route-manager-rule-throwing-preg\_match\_all-warning

I followed the instructions in that solution, re-submitted my custom template routes and the problem pages loaded with no errors thrown.

# Answer
> 0 votes
It usually happens when your HTTP request's headers claim that the content is gzip encoded when it really isn't. Turn off the gzip encoding setting (or make sure the content is in fact encoded).

---
Tags: ee2, template-routes
---


title: Search Form Help

text:
# Question
Title: Search Form Help
Is there an option I can put in the advanced\_form search form to get the results to load into the top window? I'm using the advanced form in an iframe, and I need the results to load into the "\_top" layer.

As an alternative, I've taken the rendered search form and adjusted it to work, so if there's no option in the standard code, I'm ok. I can get everything working except one thing. I can't get this value to autogenerate:

`<input type="hidden" name="meta" value="Y1q3nU/3/C6nkc+TMjbxHkfdkE77...." />`

Is there a variable I can use here?

EE2.10.1

# Answer
> 1 votes
Thanks AllInOne! That sparked a solution. You can do this with some jQuery to add missing the target attribute. After the search form code, put:

```
<script type="text/javascript">
$('#searchform').attr('target', '_top');
</script>

```

---
Tags: search, forms
---


# Question
Title: Relationships tag outputs nothing as tag pair
I'm stumped on this one.

I'm trying to out put related entries but nothing is being output if I use the relationship tag as a pair

```
{exp:channel:entries channel="clients"
        url_title="{last_segment}"
        status="not closed"
        disable="categories|pagination|trackbacks"}
    {title}<br />
    {cli_honorific} {cli_first_name} {cli_last_name}<br />
    {cli_company}<br />
    <hr />

    <ul>
        <li>
            [{cli_enquiries:count}/{cli_enquiries:total_results}]<br />
            {cli_enquiries:title}
            <hr />
            <br />

            <!-- Nothing ============================================== -->
            {cli_enquiries}
                {cli_enquiries:title}
            {/cli_enquiries}
            <!-- /Nothing ============================================= -->
        </li>

    </ul>
    <hr />
{/exp:channel:entries}

```

This is what I am using at the moment. the data is output where the related data is not within the tag pair, but nothing outputs inside the tag pair.

Any ideas?

I'm using EE 2.8.1

# Answer
> 0 votes
Just to update, I found the solution to this.

The related channel in this instance has number of statuses other than 'Open' and 'Closed'.

Turns out the tag pair will only return 'Open' entries in it's loop and all of my entries are created via Channel form with a custom Status of 'New'.

You can actually use some of EE's channel entry tag parameters inside the related tag pair, so the fix was to add the status parameter to the tag pair.

```
{cli_enquiries status="My|Custom|Statuses|Here"}
   {cli_enquiries:title}
{/cli_enquiries}

```

et viola; It works.

**\[EDIT\]** Just got caught out by this *again*. If you use custom statuses you MUST declare what those are. for example: Using:

```
status="not Closed"

```

Will NOT work. It must be:

```
status="My|Actual|Custom|Status|Names"

```

---
Tags: relationships
---


# Question
Title: Emails not sending - where are email configuration details saved?
Emails are not getting sent from my EE site. It doesn't work for password reset, order confirmations from Expr-esso store, or when I use Communicate.

I have enabled email debugging and set protocol to Mail, then tried to send an email via Communicate. I didn't see any debugging info.

I am trying to use Mandril and have set protocol to SMTP and set server/port/username/password. Emails still not sent -- and I don't see any evidence of an attempt in Mandrill API logs.

Oddly - I can't seem to change the SMTP username and password under email configuration. When I edit those two fields along with other fields, everything else gets saved properly except username & password. They retain the original values. The password is not correct and needs to be fixed.

**Where are the details for email configuration saved?** I have been looking in the database and files, but not really finding anything.

Also, any suggestions on how to troubleshoot this problem?

# Answer
> 1 votes
I can't speak for your Mandril setup, but make sure your server is set up correctly first. I'm assuming some Linux flavor. In an SSH terminal, run this command:

```
echo "Test email content" | mail -s "Test email subject" -a "From: fromaddress@mydomain.com" "destinationaddress@myemail.com"

```

and make sure to check your spam folder as well. If you don't receive anything from that email, your server may need re-configuring. Try installing `sendmail`:

http://pc-freak.net/blog/install-sendmail-debian-gnu-linux/

But before you even do that; make sure your IP isn't listed on spamhaus:

https://www.spamhaus.org/lookup/

Again, not sure about Mandril, but make sure your server can fire out emails first, then move forward with debugging.

**Edit** Again, no clue about Mandril. For EE, the SMTP settings are stored in a serialized PHP array in the database, which is base64 encoded. Query it:

```
SELECT `site_system_preferences`
    FROM `my_schema`.`exp_sites`
    WHERE site_id = "1";

```

... assuming your `site_id` is 1. Take that value, and use an online base64 decoder to get your PHP serialized array. However, there really isn't any reason why just changing those settings in `Your Site -> CP Home -> Administration -> Email Configuration` would not update those values. Did you try my first debugging steps to make sure your server is firing off emails?

Do you want all email coming from this server to go through a relay host (SMTP)? In that case, you'll need to install and configure `postfix`. It would help if you would clarify your question a little, but hopefully this info is useful.

---
Tags: email
---