title: EE DB Class question

text:
# Question
Title: EE DB Class question
I've got this code:

```
$res = $this->EE->db->where(array('EventCode' =>$r["eventcode"]))
       ->limit(1)
       ->get('exp_course_events');
$course_date = $res->row('FormalDate');

```

but when I try to `echo $course_date;`, all I get is `Array`

Isn't this how to use the DB class to return a single row and get it's field values?

# Answer
I had it inside loop for another Query

The reason it was doing this is because it was a `foreach` from another call like this:

```
$results = $this->EE->db->get_where('exp_willis_rosters', array('status' => 'I'));
$registered = array();
if($results->num_rows() > 0) {
    foreach($results->result_array() as $row) {
        // get the corresponding event for the user in the roster row
        $res = $this->EE->db->where(array('EventCode' =>$r["eventcode"]))
               ->limit(1)
               ->get('exp_course_events');
        $course_date = $res->row('FormalDate');
    }
}

```

I moved the code to another place that works.
> 0 votes

# Answer
That is because that's what you're probably getting!

If you want to see what's going on, do this:

```
$res = $this->EE->db->where(array('EventCode' =>$r["eventcode"]))
                    ->limit(1)
                    ->get('exp_course_events');

$course_date = $res->row('FormalDate');

var_dump($course_date);

```

And update your answer with the output of that var\_dump command.
> 0 votes

---
Tags: database, query, classes
---


title: Error Number: 1054

text:
# Question
Title: Error Number: 1054
Just moved my current EE 2.9.2 website to another host and I am getting the following error on the admin.php and the index.php.

```
A Database Error Occurred
Error Number: 1054

Unknown column ‘sess_start’ in ‘field list’

INSERT INTO `exp_sessions` (`admin_sess`, `session_id`, `ip_address`, `user_agent`, `member_id`, `last_activity`, `sess_start`, `fingerprint`) VALUES (1, ‘2050e961294359515d6732a160850dcb2491a826’, ‘81.xxx.xxx.xxx’, ‘Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.130 Safari/537.36’, 1, 1435579185, 1435579185, ‘b89d80a5323e17c04cc0bfec10a1b2fa’)

Filename: libraries/Session.php

Line Number: 409

```

Any ideas how this could be resolved?

# Answer
Sounds like your database migration failed somehow. With conditions like that, I usually re-attempt the data migration. Yes, you can just create that column, but you might run into other malformed migrated tables. Make sure you look at your original database server, and that you create a column with identical properties to the original that didn't get created on migration. Let me know what happens.
> 1 votes

---
Tags: error
---


# Question
Title: Sending JSON from Plugin to template in a redirect?
I have a plugin that loops through some code and builds an array of results then redirects the user to a results page. How can I pass the results to the redirected page without using the URL segment? The results can be converted to JSON if needed.

# Answer
> 0 votes
Parse those variables! Then just dump them out in template tags.

https://ellislab.com/expressionengine/user-guide/development/usage/template.html#parsing-variables

You use the template class to pass your variables through the EE template engine, then you can just make a loop out of your results in your template:

```
{exp:my_plugin parameterone="666"}
    A result:
    {result_array}
        {result_variable_one}
        {result_variable_two}
    {/result_array}
{/exp:my_plugin}

```

---
Tags: templates, plugin, json, redirection
---


# Question
Title: Expresso Store, State Field Label instead of Code
Is it possible to map the actual state instead of state code to the native member fields.

At the moment i get, CON instead of CONWY.

# Answer
You can edit the states.php file inside Store \> data on your third\_party directory. It returns a key / value array. Just make sure it complies with your Shipping & Payment Gateway required fields.
> 0 votes

---
Tags: expresso-store
---


# Question
Title: {auto_path} linking to category-url instead of page-entry-url?
Is it possible to modify the {auto\_path} variable to return the category-url instead of the page-title-url?

for example:

if the search results url, set in channel -\> preferences, is:

```
    http://example.com/template/

```

can the {auto\_path} return:

```
    http://example.com/template/category/category-url/

```

This is using "exp:search:simple\_form". I have the results displayed in a template using the following:

```
    {exp:search:search_results}
    <a href="{auto_path}">{title}</a>
    {/exp.search.search_results}

```

If I use the {path} variable, would the correct format be:

```
    <a href="{path="site_url/template/category(?)/category_url}">{title}</a>

```

How would I get the "/category/" url indicator inserted in the url?

Am I close?

```
    {!--more stuff--}

```

I made a mistake above, which I corrected; the fist segment of the url isn't the channel, it's the template.

I created the site with six template groups - just using the index page for each group; a conditional for "{segment\_1}" - the template which selects the channel & "{segment\_3}" - the category - which loads sidebar snippets based on the result of the conditional.

The {path} variable should return:

```
    http://example.com/template/category/category-url/

```

# Answer
auto\_path will always append the URL title:

```
This parameter is replaced with the URL to the entry with the URL Title appended to the end. Unlike other “path” variables, this variable does not require the Template_Group/Template to be specified. Instead, the path will automatically be determined by the Search Results URL setting for the channel in Channel Management.

```

If you want to link somewhere specifically then use the `{path}` variables and follow the template\_group/template pattern.

It looks like you're using the Search module but I'm not exactly clear on what you're trying to do. If you care to elaborate a little more than I may be able to offer a suggestion if the `{path}` variable doesn't do what you need it to.
> 2 votes

# Answer
I used the following to pull back the channel and the category name if one existed.

```
{path="{channel_url}/{categories}{category_url_title}{/categories}/{url_title}"}

```
> 0 votes

---
Tags: category-name, configuration-variables
---


title: Matrix, Drag and Drop Upload

text:
# Question
Title: Matrix, Drag and Drop Upload
i'd like to combine Channel Images with Matrix, or at least a Drag and Drop File upload for a Matrix Field. I couldn't find anything like that, so maybe someone here can help

1. Is it possible to upload files/images to a matrix file field ?

If 1. is not possible, is it possible to drag and drop upload a file/image to a matrix file field ?

thanks for any help !!

# Answer
> 0 votes
There is Matrix Multi-Upload which would allow you to upload multiple images but I don't think it allows drag and drop functionality.

If you want drop and drag functionality I think you are limited to Channel Images or Photo Frame

---
Tags: matrix, channel-images
---


# Question
Title: How to get NON - logged in users to the site to see the freeform:edit tag?
I am submitting a form and that form will email a client at the supplied email address. However, in the email that is sent to the client a URL is included to edit their response. On this page I am using the freeform:edit tag but they can not see it because they are not logged in.

Example URL: sitegoeshere.com/refferal/mma/26/1-23456789

Segment 3 would be the freeform entry id but if they are not logged in the client can not see this.

**So any ideas on how to make a non-logged in user edit an entry?**

I know the security risk of anyone can see any entry but none of the data is worth anything to someone else.

* Eric

# Answer
Just add `restrict_edit_to_author="no"` to your `freeform:edit` tag. From the docs:

> Specifying a value of no to this parameter will mean that anyone, including logged out users / guests can edit the entry.
> 2 votes

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


# Question
Title: How to custom rewrite rule in expression engine?
I want to make a custom url like this http://example.com/entertainment/celebrity/call\_me\_caitlyn\_breaks\_the\_internet

And i wrote the rewrite rule as follows

RewriteRule ^entertainment/celebrity/(.\*?)$ index.php?/news\_article/$1 \[L\]

As well as

RewriteRule ^entertainment/celebrity/(.\*?)$ index.php?/news\_article/celebrity/$1 \[L\]

Does not work both of them. How to fix this.

# Answer
> 0 votes
Here ya go, bruva:

```
RewriteRule ^entertainment/celebrity/(.+)$ news_article/celebrity/$1 [L,R=301]

```

That should do the trick. Please report back if it works.

**Edit**

Add QSA to the rule flags if you have query strings!

---
Tags: regular-expressions
---


title: Cannot log-in to CP

text:
# Question
Title: Cannot log-in to CP
Yes, it's the dreaded unable to log-in issue. Been working fine - latest version EE - for a few weeks (new install) and suddenly today cannot log in. Stays on same page and gives error: **Invalid username or password.**.

Have tried resetting password. Nada. Tried the usual fixes in the config file and also clearing cookies etc. No joy anywhere.

One thing I think *might* be relevant - this is a development site, the real site exists elsewhere under the intended domain. So obviously this one uses a temp domain/IP address and when is completed the idea is to just update the nameservers.

I suspect, but am not sure, that this is somehow coming into play.

Anyone encountered this before?

***Note***: Also in the days prior to this manifesting there was a different issue where after first login attempt nothing would happen, just refresh of page and clearing of fields. But on the second attempt it would allow login. Now it does not allow on any attempt. This has to be related no?

# Answer
It may be that you have your EE installation set up to disallow simultaneous log ins. This means that if you are logged into the site from one location/machine then you cannot log in using the same account on a different machine until the other one logs out.

To 'fix' this so you can log in, take a look in the exp\_sessions table and remove any sessions that match your member id.

If you are then able to log in, that was the problem.

To turn this off go to Admin-\>Security and Privacy-\>Security and Sessions and turn on the option marked "Allow multiple log-ins from a single account?"
> 1 votes

# Answer
You mention this is a dev site, and I assume from your OP that you have a stage/live server set up too? As you mention your namespace switch-er-oo technique for deployments (btw, Ree-locate is awesome if simulating domains on your local machines is too much).

Is it possible that you logged into the Live/Stage site (ergo gainign the session cookies) then logged into your dev site and because the dev site is configured with the same domain it inherits your live cookies?

Can you still log into/ out of your stage and live enviroments.
> 0 votes

---
Tags: control-panel, login
---


title: SQL Query Not Displaying All Results

text:
# Question
Title: SQL Query Not Displaying All Results
I am setting up a search by author section on the blog for my website. I have all the code set up correct, and people are showing up! However, not everyone is showing up. When I run the SQL Query below, I am short a couple of results. When I move a member from Group 6 to Group 1, she shows up.

Am I missing something here?

```
<h1 style="font-size:24px;font-weight:normal;color:#72736F;border-bottom: 1px dotted #999;">Search by Author</h1>

{exp:query sql="SELECT*
  FROM exp_members
  WHERE group_id = '1' OR group_id = '6'
  AND total_entries != 0
  AND in_authorlist = 'y'
"}
  <a href="{site_url}wcrealtors_blogs/author/{member_id}" class="blogimg">
    <img src="{site_url}/images/avatars/{avatar_filename}" class="imgblogauthorbar"/>
  </a>
{/exp:query}

```

Thank you in advance for your help!

# Answer
There should be a space between your select statement and your all field list term:

```
SELECT *

```

but past that, this is definitely a correctly structured query. When you visit the

```
CP Home -> Members -> Member Groups -> Edit Member Group

```

page of your Super Admin group, are Super Admins set to yes for this option?

```
Include Members in PUBLISH page multi-author list?

```
> 0 votes

---
Tags: ee2, sql
---


# Question
Title: Can Solspace calendar have multiple times each day for an event?
Can Solspace calendar be setup to have multiple times a day per event? I am looking at using it for movie listings where each movie will be shown for a different number of days and each day the movie might be shown a different number of times and at different times of the day from day to day.

Does anyone know if Solspace calendar can be setup to do this?

# Answer
> 1 votes
Yes, you can do that. When you create an event, add a rule for each time of the day that the event is going to occur as well as what day of the week its happening on at said time. You can have multiple, inclusive days and times of day for an event:

https://solspace.com/documentation/calendar/images/calendar\_cppublish\_1.jpg

\[Edited to make this into a proper answer setup\]

# Answer
> 0 votes
I am lead to believe it is absolutely doable. I'm eyeing that occurrences section on this page:

https://solspace.com/docs/calendar/getting\_started/

Just send them an email and they'll tell you for sure.

---
Tags: solspace, solspace-calendar, calendar, events
---


title: Low Search Secure Action

text:
# Question
Title: Low Search Secure Action
I'm using Low Search 2.1.2 on a Shop page. The search works fine, but the padlock for the SSL cert is coming up as broken. Inspecting it in Chrome gives the following error: The page at example.com was loaded over a secure connection, but contains a form which targets an insecure endpoint 'example.com'. This endpoint should be made available over a secure connection.

It seems to be Low Search form, which is creating the following HTML:

```
<form id="main_search" method="post" action="http://example.com/index.php">

```

I've used the following tag to generate the form:

```
{exp:low_search:form form_id="main_search" collection="products" search_mode="all" result_page="/shop/results" force_protocol="https"}

```

Is there a way to make Low Search generate a secure action URL?

# Answer
> 1 votes
The following is true for **any form generated by EE**, including the Low Search form:

If you want the `action` url to be https, make sure the **URL to the root directory of your site** setting under Admin \> General Configuration (aka the `site_url` config item) also starts with https.

---
Tags: low-search, secure, secureforms
---


# Question
Title: How to get Expresso Store to trigger stripe email receipts?
How is it possible to get orders from Expresso Store 2 to get Stripe to send email receipts as well as eh ones generated from Expresso?

There is no option to enable them as far as I can tell in Expresso. Is there a way to pass the parameter from the form to get email receipts as per the stripe docs?

https://support.stripe.com/questions/email-receipts

Many thanks,

Tom

# Answer
> 1 votes
There is not a setting in Store you would need to log into your Stripe account to enable their email to be sent for different actions. To do this you would need to do the following:

1. Go to https://dashboard.stripe.com/account this should bring up the account modal if not click on your account name in the upper right corner.
2. Click emails from the modal window on the right side.
3. Check the boxes next to the emails you want Stripe to send to you and/or the customer on a completed order or refund.
4. Save by clicking Done

After that Stripe will send out emails based upon your selection anytime an order is processed in Store.

Store has the ability to send out emails based upon order status, the benefit of sending the emails through Store over Stripe is that you have full control of the markup and you are able to use any and all EE custom fields, snippets, and most other add-ons. You can see more information about the email templates in the docs and you would want to use the orders tag pair to build you templates.

# Answer
> 0 votes
You could use the hook: **store\_transaction\_update\_end** (shown here: https://www.exp-resso.com/docs/extension\_hooks.html)

Once that hook is triggered, check if it was successful, if so, then supply the email and transaction ID as a request to the proper API call.

Also, I see that stripe uses JS to send the info to their form using the store module, maybe creating a **hidden field receipt\_email** in the form that the JS gets the info from to send to Stripe will work as well.

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


# Question
Title: No input file specified on staging server
My site works fine locally and works fine at a dev installation. When loading it onto a network solutions hosting account, I get "No input file specified." on every page but the home page. Both dev and staging are running php as a cgi script so not sure why the error there.

Feel free to take a peek at staging.imagenational.com

# Answer
> 10 votes
Take a look at my comment on this post:

"no input file specified" - .htaccess

Might be the same issue: if so, you need to add a ? to the RewriteRule (to index.php) in your htaccess, for example:

From

```
 RewriteRule ^(.*)$ /index.php/$1 [L,QSA]

```

To

```
RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]

```

# Answer
> 4 votes
I have ran into the same issue on MediaTemple and have fixed it by modifying the .htaccess file. For me, my old base .htaccess references index.php and was missing a '?' after it. First place I would check is .htaccess and go from there.

# Answer
> 0 votes
For further clarity and thoroughness, I had to engineer another approach-based solution. As an added bonus, the shared hosting environment we had to use was forced to use FastCGI, and on top of that wouldn't allow us to modify any CGI or PHP configurations. Really unhelpful I know.

As has been made clear by other answers and discussions, the problem seems to be that when using a CGI-based implementation of PHP, the `$_SERVER['PATH_INFO']` variable is not available, but it is unfortunately required by ExpressionEngine when trying to route requests, specifically when trying to navigate without the pesky `index.php` string being present in the URL.

So in the end, what worked for me was this 3 step 'custom' approach:

1. First, in `ExpressionEngine > CP Home > Admin > System Administration > Output And Debugging`, I set **Force URL query strings** to **No**.
2. Next, as mentioned in previous answers, I changed the `.htaccess` directive from `RewriteRule ^(.*)$ /index.php/$1 [L,QSA]` **to** `RewriteRule ^(.*)$ /index.php?/$1 [L,QSA]` (extra ? after index.php).
3. Finally, I added this piece of custom PHP code to the top of site root's `index.php` file to "force" the `$_SERVER['PATH_INFO']` variable into accurate existence:

```
<?php

    $path = $_SERVER['REQUEST_URI'];
    $pos = strpos($path, '?');
    if ($pos !== false)
        $path = substr($path, 0, $pos);
    $_SERVER['PATH_INFO'] = $path;

    /**
     * ExpressionEngine - by EllisLab
       ...
       ...

```

I hope this helps someone! I really pulled my hair out trying to find somewhat more elegant solutions!

---
Tags: error
---


# Question
Title: Hook to add a new column in control panel
For an extension I would like to add an extra column in the cp's entries overview. I have searched for a hook I could use for this, but could not find anything.

I could use Zenbu, but that is a bit too much for what I want. In EE1 there was a hook available. Have I missed the hook for EE2 or is there another way to accomplish this?

# Answer
> 0 votes
I decided to go with the hook cp\_js\_end. I linked it with this function:

```
function addJs(){
        $js = "
             if(window.location.href.indexOf('content_edit') > -1)
             {
                var colNr = 2;

                $('.mainTable').find('tr').each(function(){
                    $(this).find('th').eq(colNr).after('<th data-table_column=\'your-colomn-name\'>Your column name</th>');
                    $(this).find('td').eq(colNr).after('<td>Your content for this cell</td>');
               });
            }
        ";

        return $this->EE->extensions->last_call . $js;
    }

```

# Answer
> 0 votes
Which page, specifically? Have you looked at the **tab** documentation?

https://ellislab.com/expressionengine/user-guide/development/modules.html#the-tab-file-tab-module-name-php

Expand on your answer I can probably help you.

---
Tags: control-panel, add-on-development, extension
---


# Question
Title: Possible to use count conditional to change channel entry display?
Is it possible to use a count conditional (or equivalent conditional) to change the display of an entry tag depending on how many entries there are?

For example, I have a grid field which I am using for a simple image gallery. I would like to add a condition so that if there is only one entry the image will display as a hero banner, but if there is more than one entry it will change to a gallery.

I wasn't sure if the following (or similar) was possible:

```
{if count > 1}
   <!-- Gallery -->
{if:else}
   <!-- Hero Image -->
{/if}

```

Thanks for any help.

# Answer
> 0 votes
Certainly, what you want to do is this :

```
{grid_field}
  {if total_rows < 2}
    {!-- Hero Banner goes here --}
  {if:else}
    {!-- Each Gallery Image displayed here --}
  {/if}
{/grid_field}

```

Note that for what you're asking (if more than one do X else do Y) on a **grid** field you will need to use the `{total_rows}` parameter (or for channel entries its `{absolute_results}`).

Also, note the parse order. Simple conditionals are parsed before module tags, advanced ones after. I don't think it makes a different but if you're not getting the right results change the `{if total_rows < 2}{if:else}{/if}` to a `{if total_rows < 2}{/if}{if total_rows > 1}{/if}`

---
Tags: entries, count
---


title: Render embed tags Shine pdf

text:
# Question
Title: Render embed tags Shine pdf
I want to use the module Shine pdf to generate pdf's. Only problem is it doesn't render embed tags in the template.

I would like to change the code in the module so it would render embed tags. This option would save me tons of time. Could someone push me in the right direction into what EE function I should use for this?

# Answer
> 2 votes
What you're looking to do is far from trivial, however....

Lets simplify first. Forget the pdf module, I assume you want to render your embed (and any other) tags and push the result into your pdf document (or anywhere else). In short you want EE Template in, Html Out.

We can actually achieve this prior to the PDF creation, and avoid heavy modification of the module, after all you don't know how they could be parsing in the module, in the best case it'll be a normal tag renderer but as the parse order shows the Shine PDF tag will be processed long before your embed.

So, with some clever PHP you can re-use the EE Template engine, we can render the EE template using the Template engine and output it onto the template **before** the module tags, like so :

PHP **on** parsed on **input**

```
<?php
  //this is the template code you wish to parse early into the pdf
  $str = "{embed='group/template' embedvar='true'}";
  ee()->TMPL->parse($str);
?>
{exp:shine_pdf:make}
  <?php echo $str; ?>
{/exp:shine_pdf:make}

```

This should parse the `$str` as if it was part of the template you are on at the moment (so your globals, variables etc should be available).

This is untested please note, so you may have to debug, however the concept is sound (used it before). Also note I've never used Shine PDF before but I'm assuming its a case of 'put your content between the tags', so I've put `{exp:shine_pdf:make}` tags in for example.

---
Tags: add-on-development, module, embeds, shine-pdf
---


# Question
Title: Custom error messages with Freeform Pro ajax form
I'm using the AJAX form example for Freeform Pro as described here; https://solspace.com/docs/freeform/form/#ajax\_validation

However, the error messages are not very useful and simply say "Required field missing input". Does anyone know if there is a simple way to customise these for each field?

I'm thinking this is perhaps more something in javascript than the module itself.

I also have prevent duplicates switched on for the email address, so I would need to ensure there is still an error for the duplicate along with email errors such as "Please enter your email address" or "Please enter a valid email address".

Thanks, Neil

# Answer
Becaus its late in the day processing wise (AJAX and all). It's not exactly fluid, for me I've previously had to do this by passing the error strings through a function that does a stripos for known messages (you know the field and the message) and swaps them around...

```
function reformat_errors(i, items){
  var outErr = "";
  //field switch, add more fields in the switch below
  //and add a function to rewrite the messages
  switch (i) {
    case 'emailField':
    case 'emailConfirmField':
      if ( $.isArray(items) ) {
        for ( var c = 0; c < item.count; c++ ) {
          outErr += reformat_errors_emailField(items[c]);
        }
      } else {
        outErr += reformat_errors_emailField(items);
      }
      break;
  }
  return outErr;
}

function reformat_errors_emailField(item){
  var test = item.toLowerCase();
  //add an elseif condition for each message to catch
  if ( test.indexOf("required field missing input") >= 0 ) {
    return "Please enter an Email Address";
  } else if (test.indexOf("does not match") >= 0 ) {
    return "This email address does not match the previous email address"
  } else {
    return item;
  }
}

```

---

```
if (data.success == false)
{
  //data.errors
  $.each(data.errors, function(i, item){
    var $errorHolder = $('[name="' + i + '"]').
    parent().find('.error_message');
    //instead of this, lets reformat errors outself
    //var error = ($.isArray(item) ? item.join('<br/>') : item);
    reformat_errors(item);

    //does the error holder field exist?
    if ($errorHolder.length > 0)
    {
      $errorHolder.append('<p>' + error + '</p>').show();
    }
    //lets add it to general errors
    else
    {
       $generalErrors.append('<p>' + error + '</p>').show();
    }
  });
}
else if (data.success)
{
  window.location.href = data['return_url'];
}

```

*from the example on SolSpace*

I've deliberately written the javascript out in quite a long handed fashion so its clearer whats going on and becuase its untested, you can probably optimise this somewhat!

Perhaps someone has a better answer...
> 0 votes

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


title: Pair variables on Custom Field Type

text:
# Question
Title: Pair variables on Custom Field Type
In the Custom Field Type, I've made separate table to store other information. So it means single field value contain many values in array. I want to use this array as pair tags on expressionengine.

like:-

```
{playlist}
    {playlist:videos}
    {playlist:titles}
{/playlist}

```

As playlist has multiple videos and titles.

http://postimg.org/image/60spnlykt/

http://postimg.org/image/c63h56cb9/

# Answer
I'm really not sure what you're looking for, since your question isn't very clear, but I'm taking a shot in the dark.

I think you're looking for a way to output your custom field type as EE template tags, as you say:

```
{playlist}
    {videos}
    {titles}
{/playlist}

```

To do something like this, you probably need to parse those variables using the template class. Use these references to refresh your knowledge of EE custom add-ons:

https://ellislab.com/expressionengine/user-guide/development/fieldtypes.html#development-reference

https://ellislab.com/expressionengine/user-guide/development/usage/template.html#parsing-variables
> 0 votes

---
Tags: custom-fields, tags
---


# Question
Title: How to filter a session based on category rather than product field?
My company website is setup as such:

```
Product Categories
    -Chairs
        -Armchairs
        -Dining Chairs
    -Tables
        -Dining Tables
        -Coffee Tables

```

I am trying to adjust how I filter the products on a page. So far, I am only able to filter them based on the product fields, using the code below. (\*Note - here I am filtering products by the manufacturer product field.)

```
{embed="linea/display-products" paginate_base="{segment_1}/page" search="search:manufacturer='Viccarbe'" limit="12" order-by="title"}

```

However, I need to be able to filter products based on the product **categories** rather. I am using the Low Seg2Cat addon, and have tried using the code below, as suggested in an alternate post.

```
{embed="linea/display-products" paginate_base="{segment_1}/page" search="search:manufacturer='Viccarbe' search:{segment_3_category_name}='coffee-tables'" limit="10" order-by="title"}

```

This also did not work. Any help is much appreciated!

Resources: How do I display a category name based on a segment?

\*Edit - This is the embedded channel entries tag - `{exp:channel:entries channel="product" {embed:search} category="{segment_3_category_id}" limit="{embed:limit}" paginate="bottom" paginate_base="{embed:paginate_base}" orderby="{embed:order-by}|title" sort="asc|asc"}`

# Answer
I'll take a stab, first your embed, don't pass the category stuff in the search string, so :

```
{embed="linea/display-products"
  paginate_base="{segment_1}/page"
  search="search:manufacturer='Viccarbe'"
  limit="10"
  order-by="title"
}

```

Ok, we don't need to pass the segment category ID / Name into the embedded template, its available there too, so first I'll simplfy the channel tag to reflect a working (but without category) mode :

```
{exp:channel:entries
  channel="product"
  limit="{embed:limit}"
  paginate="bottom"
  paginate_base="{embed:paginate_base}"
  orderby="{embed:order-by}|title"
  sort="asc|asc"
  {embed:search}
}
  {!-- ... --}
{/exp:channel:entries}

```

Ok, so now hopefully GNDesign can confirm this works without category filtering, obvisouly if not please post back withwwhat you did to correct this. Now we refer to the documents as you have https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#category

So, we need the Category ID for the categoy parameter of the channel:entriees tag. Again OP can you confirm that `{segment_3_category_id}` is putting the correct number out?? (Print it out in the embed, outside the channel entries loop to confirm).

ok, so we could add it back into the paramters like you implied by your edit code. Wait a cotton picken minute! What if the channel:entries tag is parsed **before** the seg2cat tag?? Parse Order strikes again! Ok, so we review our embed tag, we'll parse this is as a seperate embed parameter, embeds are passed very late o this should be populated by now :

```
{embed="linea/display-products"
  paginate_base="{segment_1}/page"
  search="search:manufacturer='Viccarbe'"
  limit="10"
  order-by="title"
  category-id="{segment_3_category_id}"
}

```

So, this should guarantee that the `{segment_3_category_id}` is parsed before the embed, and it's passed in as a seperate parameter. Now we just need to plug it into the embed...

```
{exp:channel:entries
  channel="product"
  limit="{embed:limit}"
  paginate="bottom"
  paginate_base="{embed:paginate_base}"
  orderby="{embed:order-by}|title"
  sort="asc|asc"
  category="{embed:category-id}"
  {embed:search}
}
  {!-- ... --}
{/exp:channel:entries}

```

That should do it. Let us know how you fare! Of course if you still have issues I'd recommend dropping the limit, paginate, paginate\_base, order\_by and sort parameters from your channel entries tag and paginate\_base, limit and order-by from your embed tag, this cleans up the stuff so its easier to debug, you can add it back later.

Please let us know how you fare!
> 0 votes

---
Tags: categories, low-seg2cat, category-group
---


# Question
Title: How do I change <b> to <strong> in default richtext editor field
How do I change to in default richtext editor field. I have looked at the default HTML buttons - but this does not seem to update TextArea (rich text), but maybe (I haven't checked) updates TextArea.

How can I change to as is deprecated.

The version we are using is ExpressionEngine Core Core v2.10.1 - Build Date: 20150501.

Help appreciated.

# Answer
> 1 votes
Mate, you've got your work curt out!

I just spend a half hour of my time trawling through the compressed JS to find a solution, it's not coming easy!

The problem is the formatting seems to be applied via JS when your editing the field, this is courtisy of a plugin called Wysihat, but not just that, Wysihat has been modified to work with jQuery, then modified again to work with EE (closed source) and minified.

A much MUCH simplier solution would be to use a simple PHP snippet like so :

**\_PHP On** parse on **output**

```
{exp:channel:entries ...}
  <?php
    //because PHP is on output, rte_text_field will be replaced
    //with HTML before the PHP is evaluated
    $str = '{rte_text_field}';
    //now we simple do the old switch-er-oo, lets do i for em too!
    $needles = array('<b>','</b>','<i>',</i>');
    $replace = array('<strong>','</strong>','<em>','</em>');
    echo str_replace($needles, $replace, $str);
  ?>
{/exp:channel:entries}

```

There ya go, this took 5 minutes to write whereas decompiling and trying to work out what the heck is going on in the minified EE version of Wysihat will take an age. Heck just writing the previous senrtance took me longer than the snippet above!!!!

---
Tags: editor, html
---


title: Structure removed and

text:
# Question
Title: Structure removed and
Updating a site I want to get rid of Structure and move to NavEE. I have set all channels to 'unmanaged' and than disabled and removed Structure. Now I'm getting an error after editing and submitting an existing entry:

The requested module is not installed: structure

Any ideas what to do about this? I can go back to a earlier version and do things different. But how?

# Answer
Have you checked that all of Structure is removed?? This includes the sections under `Add Ons` for Modules, Accessories, Extensions, Fieldtypes and Plugins...

Also, did you disable the Structure components via the Admin CP? or did you just delete the files???

It seems like EE thinks that some part of structure is still present...
> 0 votes

# Answer
Sounds like it's lingering. I would check your extension database table, I'm betting you still have some remnant hook rows pointing towards the Structure class!

What are the results of this query? (Note, I'm on mobile so I can't double check the table and column name, it might need adjusting)

```
SELECT * FROM exp_extensions WHERE method LIKE "%structure%";

```

The table name might actually be exp\_hooks, and the column name might be class, can't remember.

**Edit**

This is definitely the query:

```
SELECT * FROM exp_extensions WHERE class LIKE "%structure%";

```

If you get any rows, Structure was almost certainly removed incorrectly (or their upd.structer.php file has bugs!).
> 0 votes

---
Tags: structure, navee
---


title: Multi-site manager Channel Images

text:
# Question
Title: Multi-site manager Channel Images
I'm having a Multi-site manager setup and am using Channel Images as image upload.

On the first site, everything goes well. Let's call it www.firstwebsite.com

The images are uploaded to `/server/firstwebsite/uploads/`.

The other one, www.secondwebsite.com, doesn't work that well. Via the admin, I can not upload images in channel images.

Console tells me this: `http://www.secondwebsite.be/?ACT=44&ajax_method=upload_file&field_id=96&key=1434980450 Failed to load resource: net::ERR_NAME_NOT_RESOLVED`

Channel images keeps spinning and says: `NaN%`.

Although, when I go to firstwebsite via the link in the top right (so I'm editing website two with firstwebsite.com/admin.php, the uploading works BUT it's uploaded to the wrong folder. So `/server/firstwebsite/uploads/` rather then `/server/secondwebsite/uploads/`.

Someone has experience with this? If so, please help. It's an urgent matter.

# Answer
Stupidly, nothing was wrong with my settings, but with how the subdomain was linked to the url on the server. It had been linked to second-website, rather than secondwebsite. I overlooked that, as everything else worked, expect upload destinations.
> 0 votes

---
Tags: multi-site-manager, error, channel-images, act
---


title: low-reorder first or last page

text:
# Question
Title: low-reorder first or last page
I have a channel that is using {exp:low\_reorder:next\_entry} and {exp:low\_reorder:prev\_entry}

If I am on the first entries page I need to link to the last entry, then if I am on the last entry link back to the first.

So effectively allowing the user to continuously navigate and loop through all entries.

Is this possible?

# Answer
To answer my own question (helps if you fully read the docs). The answer is simply

```
loop="yes"

```
> 2 votes

---
Tags: low-reorder
---


title: 'is a guest' message on home page

text:
# Question
Title: 'is a guest' message on home page
I have inherited a newly designed web site that was built with EE and we recently migrated to a Dedicated Virtual Server and upon moving the site, all of the pages are accessible and log in to EE appears to be fine.

However, any attempt to get to to the home page comes up with a blank page that has a message on line 3 that says 'is a guest'. There is no splash page or message that I can find in the code at all that would cause this message and apparently some type of a redirect...or at least not allowing view of the main page.

As if the EE is expecting someone to sign in...but I can get to the admin page fine.

Anyone have any clue why I am seeing this and what I can do to fix it?

Thanks for any assistance.

# Answer
> 0 votes
Sounds like possible broken index.php, and since you just migrated, I'd bet the farm on an ill file transfer. Have you tried re-migration? If your templates are stored in the DB and not as files, it's possible you have a failed database migration (the template table may be corrupt), or if you save templates as files, your file could be corrupt.

Head on over to your

```
/var/www/system/expressionengine/templates/your.default.template.group/

```

and look at index.html file. Can you paste it's template contents (you can remove most of the HTML elements or use pastebin to present it).

**Edit**

After checking out your template... It's behaving exactly like it's supposed to. If you're not logged in, all you should see is "is a guest". My first guess is that somehow your default template group got changed (do you have more than one template group?). If someone else did this migration for you, they screwed you on set up. From your pastebin, I would at least fix this line:

```
{exp:member_categories:categories username={logged_in_username}}

```

becomes

```
{exp:member_categories:categories username="{logged_in_username}"}

```

I'll be honest, this looks like somebody's test template, and not at all like the index page of any production website. You should really go back to your third party migration team and ask them what the hell they did, because that template is not the homepage of a production site. Is it possible your template folder originally lived as a git repo, and somehow a very old commit was checked out?

Member Group 3 is the Guests group. Have you tried logging (the Control Panel) and returning to your index page tosee if that page gives your channel entry loop?

---
Tags: server-migration
---


# Question
Title: Stash with timestamps and custom written module
I'm having a difficult time figuring this out.

There's a section in a website with events. Visitors can vote for these events, 24 hours before and after it happens. Longer before that, it has a 'attend'-button. Afterwards, it shows the average score.

As I always do, I use Croxton's stash plugin. This section, ofcourse, shouldn't be stashed.

So, at first, I had this:

`

 {if {current_time format="%U"} - {event_time format="%U"} < -86400}
 {facebook_link}
 {/if}
 {if {current_time format="%U"} - {event_time format="%U"} < 86400 && {current_time format="%U"} - {event_time format="%U"} > -86400}

Voting open

 {/if}
 {if {current_time format="%U"} - {event_time format="%U"} > 86400}

{exp:bol_voting:stats entry="{event_id}"}

 {/if}

`

Now, ofcourse, because these sections get stashed, the time-checks don't matter. If we reach the time-frame in which people can vote, nothing will happen. Also, the eventual average score returned by bol\_voting will be stashed.

I didn't want that, so I wrapped it in a `{stash:nocache}` wrapper. All my variables, as well as my custom bol\_voting module, don't get parsed anymore (event\_time and facebook\_link).

Anyone can save me here?

Thanks!

# Answer
> 2 votes
Carefully "unescape" the variables you want to be cached, so e.g.

```
{stash:nocache}
<div>
  {if {current_time format="%U"} - {/stash:nocache}{event_time format="%U"}{stash:nocache} < -86400}
    {/stash:nocache}{facebook_link}{stash:nocache}
  {/if}
  {if {current_time format="%U"} - {/stash:nocache}{event_time format="%U"}{stash:nocache} < 86400 && {current_time format="%U"} - {/stash:nocache}{event_time format="%U"}{stash:nocache} > -86400}
    <p>Voting open</p>
  {/if}
  {if {current_time format="%U"} - {/stash:nocache}{event_time format="%U"}{stash:nocache} > 86400}
    <p style="color: black;">{exp:bol_voting:stats entry="{/stash:nocache}{event_id}{stash:nocache}"}</p>
  {/if}
</div>
{/stash:nocache}

```

---
Tags: stash, module, time, mustash
---


# Question
Title: Using conditional for displaying special content to specific entry
Trying to display different link for one entry (`thing1`) inside channel entries loop.

```
{exp:channel:entries channel=“things”}

     <h2>{title}</h2>
     <p>{description}</p>

     {if url_title == ’thing1’}
     <a href=“somecustomlink.html”>Read more</a>
     {if:else}
     <a href=“{path=’things’}/{url_title}”>Read more</a>
     {/if}

{/exp:channel:entries}

```

Problem is, that EE uses to compare `{url_title}` with current template, not with “things” channel entrie's.

How to write this conditional?

# Answer
> 0 votes
If this exp:channel:entries code block is appearing on a page that is used for displaying a specific entry (e.g. a specific news article page) then try adding a dynamic="no" parameter to the channel:entries tag. Otherwise, I would double-check that Robson hasn't already hit the nail on the head with his 'nested channel:entries' hypothesis.

# Answer
> 0 votes
Solved the problem with using `{title}` instead of `{url_title}` in conditional.

# Answer
> 0 votes
Although not as flexible, I'm adding suggestion to write the conditional using `{if segment_x == 'thing1'}` as another viable option.

---
Tags: channel-entries, conditionals, loop
---


title: Word-wrap when viewing source in WYGWAM

text:
# Question
Title: Word-wrap when viewing source in WYGWAM
I don't recall this previously being the case, but lately I've been accosted by horrendous long lines and the need to use a scroll bar when viewing raw source in a WYGWAM field. Is there any way to make this go away and have things soft-wrapped into a normal viewing port window?

Many thanks,

Andy

# Answer
Looks like this is a bug with the latest CKEditor and Firefox. I can reproduce it on their demo site http://ckeditor.com/demo, but only with Firefox. Chrome and Safari seem to both work fine.
> 0 votes

# Answer
Not really a clean solution, but a functional work-around which I stumbled across in another forum... Edit the file editor\_gecko.css and look for a definition for .cke\_source

Change the value from **white-space:pre;** to **white-space:pre-wrap!important;** and wygwam will wrap content in the source view in Firefox as well.
> 0 votes

---
Tags: wygwam
---


# Question
Title: Cannot find 'Design' tab in the main menu
I'm new to the ExpressionEngine but I cannot find 'Design' tab in the main menu. Does anyone know how to add it or the provide the sample URL so that I can reach Design page on my site?

# Answer
> 1 votes
First, just to check, you are logged into the Control Panel (where the menu is)? Are you logged in as the super user or another user? Is the user a member of the same group as user 1?

If not, this will indicate user group permissions. The "Can Access Control Panel" permission only allows you in, in the same section there is a "Can access DESIGN section" permission, make sure this is set to yes.

Other permissions to check are in the "Control Panel Administration" section, "Can administrate template groups and templates" and "Can administrate design preferences", Test with these set to yes (these should control what is available in menu).

Finally, check the "Template Editing Privileges" section, this shouldn't stop the menu appearing but again might remove links and if a menu has no links it may not show.

If its not Group Permissions, check your "Main Menu Manager" Settings in "My Account" (Click your name in the top right). See if there's anything going on here.

Finally, check you have no extensions or otherwise 'mucking about' wit hthe menu.

Please check the above, and report back if you don't get any results and we'll investigate further. There's no chance of any tom foolary in the database or core files is there?

---
Tags: ee2, ee2.9.2
---


# Question
Title: Can the annotation class be deactivated?
I've just upgraded my site from 2.8.1 to 2.9.3 and now certain bits of it are failing. It seems that a new "Template Runtime Annotation Class" introduced in 2.9.0 is randomly dumping comment markers into rendered templates (for reasons I still don't truly fathom) and it's causing all the parts of my site which are expecting good json to fail. Is there any way I can turn this "feature" off, even if it's only conditionally?

And help here is much appreciated.

Andy

# Answer
> 0 votes
I don't think it can I'm afraid.

Those comments are placeholder markers. With the new Layout template system it's necessary to pre-parse or extrract parts of templates for later substitusion, these markers are what you're seeing I belive, do they look somethnig like this : `{!-- rsa9234458637 --}`??

You might have got an `exit` or `end` in your JSON handler (I call this the endpoint, the URL that if called in the AJAX call), after its finished writing output, if your using PHP, if this is the case you'll have to get rid of that as it stops the template evaluation 'mid flow' and those placeholders wont get parsed out.

I would guess the problem is somewhere like this, in the JSON Endpoint. if you can supply code/examples we can perhaps help out more specifically. Or you could always debug this with the hello world technique, replace your endpoint with a simple JSON string \`{'test':'hello world'} and test that you get that reponse, then add your logic back in until you find the bit thats causing the template engine to fail early.

---
Tags: upgrade, json
---


title: User not logged out when browser closed

text:
# Question
Title: User not logged out when browser closed
This is on EE 2.10.1.

Website Sessions are set to Cookie Only.

```
$config['sess_expiration']  = 1440;
$config['sess_expire_on_close'] = TRUE;

```

`phpinfo()` reports `session.gc_maxlifetime` of `1440`;

User logs in, cookie is set. User closes browser and opens again and finds that the cookie has not been cleared and so they are still logged in.

How can we enforce session cookies to expire when the session ends?

# Answer
> 0 votes
According to the code, (File /system/expressionengine/libraries/Session.php, Line 1406), ifthe boolean config item ccalled `expire_session_on_browser_close` is true, the session lifetime is returned as 0, which indicates a session cookie.

I would set the lifetime to 0, see if that gets it. However the real issue is...

I notice the config item called does not match your config item name in the code, this is further confirmed with the docs here : https://ellislab.com/expressionengine/user-guide/general/system\_configuration\_overrides.html#expire-session-on-browser-close

Use this :

```
$config['sess_expiration']  = 0;
$config['expire_session_on_browser_close'] = TRUE;

```

And you should be good as gravy :D

---
Tags: members, sessions, cookies
---


title: 404 when accessing channel content

text:
# Question
Title: 404 when accessing channel content
When I try and access channels in Expressionengin I get 404 pages...

A URL like http://www.nameofsite/news/index.php tells me 'The requested URL /news/index.php was not found on this server."

However when I set the template for the channel to be the homepage it works.

What would be the best way to figure out what the issue might be?

Does Expresssionengine use URL rewriting?

**Update 1:**

When I enter the following it works: nameofsite.com/index.php/news.index.php

Is there anyway to clean up the structure so it is: nameofsite.com/news

**Update 2:** I turned of the "template as home" option and nameofsite.com/index.php/news.index.php no longer worked. Still stumped.

The .htaccess code

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

    # 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
I think you're not fully understanding how EE URL's work. Here's the gist.

**If you do *not* use an .htaccess file:**
The URL to view the template group NEWS and template file **INDEX.HTML** will be:
*example.com/index.php/news/*

**If you do use an .htaccess file to remove the index.php part of the URL:**
The URL to view the template group NEWS and template file **INDEX.HTML** will be:
*example.com/news/*

Note that the template file, if it is INDEX.HTML, does not need to be added to the URL.

*However...*

**If you do *not* use an .htaccess file:**
The URL to view the template group NEWS and template file **VIEW.HTML** will be:
*example.com/index.php/news/view/*

**If you do use an .htaccess file to remove the index.php part of the URL:**
The URL to view the template group NEWS and template file **VIEW.HTML** will be:
*example.com/news/view/*

There are plenty of questions and answers here about how to setup an .htaccess file to remove index.php. When you have that file ready, put it in the root directory of your site's domain.

BONUS: As Jonathan Waters noted above in the comments, the Site's Index Page under General Configurations is best left blank if you are using an .htaccess file to remove index.php.

# Answer
> 1 votes
First, to remove the first index, refer to the documentation here

Second, to access the index page of the template group, it is not index.php, you would simply go to http://www.nameofsite/news/ .

I do not know if you changed the name of your index template but it does not need the .php extension. Expressionengine templates are .html files (if they are synced ) even though they can have php in them.

# Answer
> -1 votes
Did you remember to activate the rewrite module on Apache?

```
$ a2enmod rewrite

```

---
Tags: channel, 404
---


# Question
Title: Config.php file permission changed to 666 but installation won't run
I set permissions via SFTP to 666 on config.php and database.php but am getting this in the installation wizard:

```
Your config.php file does not appear to have the proper file permissions. Please set the file permissions to 666 (or the equivalent write permissions for your server) on the following file: expressionengine/config/config.php

```

Running ls -l on the command line I can see the permissions are assigned to me as a user. Could the problem be that the permissions need to be set in a different way for the server to access the files? Or something else?

# Answer
OK that makes sense. But how can I determine which user/group is running (in this case) Apache?

Web root path is /var/www/

I'm somewhat comfortable on the command line, but for sure not a sysadmin. Right now the permissions for config.php read:

```
-rw-rw-rw-. 1 jack.brighton jack.brighton     0 Jun 30 17:56 config.php

```

Also, changing permissions on config.php to 777 did not fix the issue.

Thanks for your help! There's got to be a simple cure I know...

*Resolved*

This turned out to be caused by the restrictions imposed at the server by SELinux type.

See:

https://ellislab.com/forums/viewthread/234552/
> 1 votes

# Answer
Well, every file that EE needs to edit need to be owned by the same user/group that is running your PHP agent (Apache, Nginx, etc...), not your user. Also, just bump that sucker to 777 and see if it works.

Please also post an example of your particular web root path setup (you just running /var/www/ ?).

**edit**

That file needs to be writable by your agent's user, not owned. 777 should work, but I would make sure your agent and your entire web root are owned by the same user group (get recursive!).

**edit**

In your command line, run this sucker:

```
ps -Aef | grep "apache"

```

The first column result is the user running your agent. Report back. Also, stupid ass question, but you are sure the file

```
/var/www/system/expressionengine/config/config.php

```

exists? For some reason I'm betting your SFTP client somehow took ownership of those files since your output of file listing shows they are owned by

```
jack.brighton

```

and usually

```
www-data

```

or

```
root

```

is running Apache.
> 0 votes

# Answer
After running:

```
ps -Aef | grep "apache"

```

I get this:

```
apache   30572 21798  0 07:18 ?  00:00:00 /usr/sbin/httpd -DFOREGROUND

```

So apache is the agent. The config.php file definitely exists in the path, as I can see it via both sFTP and via command line.

Update: I checked with the server admin about the user agent and group. Apache is the agent and the group is named web. I can verify that all the relevant EE files are owned by apache:web, with permissions set to 777. Should be 666 for config.php I know, but even with the above the EE Installer says config.php is not accessible. I've never run into anything like this.

Other ideas?

Thanks, Jack
> 0 votes

# Answer
777 is unsafe (public write on config files, nice), especially on a shared enviroment.

I recommend 775.

The web user needs write permissions to set config values.
> 0 votes

---
Tags: config, permissions
---


title: Plugin code doesn't working on ajax?

text:
# Question
Title: Plugin code doesn't working on ajax?
I have the site http://staging.cwtest.co.uk/entertainment/celebrity and i wrote the code for ajax loadmore in the button of the page. When click the load more button the ajax load the data that's is fine but i have use the plugin code inside the ajax which doesn't work properly. I have set the php parsing yes and output set the "output". So what is solution.

And ajax response code is like this

```
<?php
$i = "{segment_4}";
?>

<section class="subsection ajax">
    <div class="row">
        {exp:channel:entries channel="news" category="{segment_3}" limit="2" dynamic="off" offset="`<?php echo $i;?>`" orderby="date" sort="desc" disable="categories|category_fields"}
        <div class="col-md-4 col-sm-4">
            <div class="post-wrap">
                {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img src="{image}"></a></div>
                {/if}
                <div class="post-content">
                    <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a>
                    </h3>
                    <p>
                        {exp:word_limit total="15"}
                        {body}
                        {/exp:word_limit}
                    </p>
                </div>
            </div>
        </div>
        {/exp:channel:entries}
        <div class="col-md-4 col-sm-4">
            {exp:channel:entries channel="news" category="{segment_3}" limit="2" dynamic="off" offset="`<?=($i+2);?>`" orderby="date" sort="desc" disable="categories|category_fields"}
            <div class="wrap-content clearfix">
                <div class="post-wrap">
                    {if {count} == 1}
                        {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                        <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                        src="{image}"></a></div>
                        {/if}
                        <div class="post-content">
                            <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                            <p>{exp:word_limit total="15"}{body}{/exp:word_limit}</p>
                        </div>
                    {if:else}
                        <div class="post-content">
                            <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                            <p>{exp:word_limit total="15"}{body}{/exp:word_limit}</p>
                        </div>
                        {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                            <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                    src="{image}"></a></div>
                        {/if}
                    {/if}
                </div>
            </div>
            {/exp:channel:entries}
            <!-- /Wrap content -->
        </div>
        <!-- /Cols -->
    </div>
    <!-- /Row -->
    <div class="row margin-top-20">
        {exp:channel:entries channel="news" category="{segment_3}" limit="3" offset="`<?=($i+4);?>`" orderby="date" sort="desc" disable="categories|category_fields"}
        <div class="col-md-3 col-sm-3">
            <div class="post-wrap">
                {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                src="{image}"></a></div>
                {/if}
                <div class="post-content">
                    <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                    <p>
                        {exp:word_limit total="15"}
                        {body}
                        {/exp:word_limit}
                    </p>
                </div>
            </div>
        </div>
        {/exp:channel:entries}
        <!-- /Cols -->
        <div class="col-md-3 col-sm-3">
            <div class="advertisement">
                {ad_300x250_general_top}
            </div>
        </div>
        <!-- /Cols -->
    </div>
    <!-- /Row -->
    <div class="row margin-top-20">
        {exp:channel:entries channel="news" category="{segment_3}" limit="3" offset="`<?=($i+8);?>`" orderby="date" sort="desc" disable="categories|category_fields"}
        <div class="col-md-4 col-sm-4">
            <div class="wrap-content clearfix">
                <div class="post-wrap">
                    {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                    <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                    src="{image}"></a></div>
                    {/if}
                    <div class="post-content">
                        <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                        <p>
                            {exp:word_limit total="15"}
                            {body}
                            {/exp:word_limit}
                        </p>
                    </div>
                </div>
            </div>
            <!-- /Wrap content -->
        </div>
        {/exp:channel:entries}
    </div>
    <div class="row margin-top-20">
        <div class="col-md-9">
            {exp:channel:entries channel="news" category="{segment_3}" limit="4" offset="`<?=($i+11);?>`" orderby="date" sort="desc" disable="categories|category_fields"}
            <div class="col-md-3 col-sm-3">
                <div class="post-wrap">
                    {if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' == 0}
                    <div class="post-content" id="{count}">
                        <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a>
                        </h3>
                        <p>
                            {exp:word_limit total="15"}
                            {body}
                            {/exp:word_limit}
                        </p>
                    </div>
                    {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                    <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img src="{image}"></a></div>
                    {/if}
                    {if:else}
                    {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                    <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img src="{image}"></a></div>
                    {/if}
                    <div class="post-content" id="{count}">
                        <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a>
                        </h3>
                        <p>
                            {exp:word_limit total="15"}
                            {body}
                            {/exp:word_limit}
                        </p>
                    </div>
                    {/if}
                </div>
            </div>
            {/exp:channel:entries}
            <!-- /Cols -->
        </div>
        <!-- /Cols 9 -->
        <div class="col-md-3 col-sm-3">
            <div class="add">
                {ad_300x100_general_top}
            </div>
            <div class="add">
                {ad_300x100_general_top}
            </div>
        </div>
        <!-- /Cols -->
    </div>
</section>
<?php exit; ?>

```

# Answer
> 1 votes
Ok, forget my previous answer, let me just correct this all for you!!!!

Copy paste this into your template :

```
<?php
    $i = "{segment_4}";
?>

<section class="subsection ajax">
    <div class="row">
        {exp:channel:entries channel="news" category="{segment_3}" limit="2" dynamic="off" offset="<?php echo $i ?>" orderby="date" sort="desc" disable="categories|category_fields"}
        <div class="col-md-4 col-sm-4">
            <div class="post-wrap">
                {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img src="{image}"></a></div>
                {/if}
                <div class="post-content">
                    <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a>
                    </h3>
                    <p>
                        {exp:word_limit total="15"}
                        {body}
                        {/exp:word_limit}
                    </p>
                </div>
            </div>
        </div>
        {/exp:channel:entries}
        <div class="col-md-4 col-sm-4">
            {exp:channel:entries channel="news" category="{segment_3}" limit="2" dynamic="off" offset="<?php echo ($i+2) ?>" orderby="date" sort="desc" disable="categories|category_fields"}
            <div class="wrap-content clearfix">
                <div class="post-wrap">
                    {if {count} == 1}
                        {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                        <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                        src="{image}"></a></div>
                        {/if}
                        <div class="post-content">
                            <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                            <p>{exp:word_limit total="15"}{body}{/exp:word_limit}</p>
                        </div>
                    {if:else}
                        <div class="post-content">
                            <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                            <p>{exp:word_limit total="15"}{body}{/exp:word_limit}</p>
                        </div>
                        {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                            <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                    src="{image}"></a></div>
                        {/if}
                    {/if}
                </div>
            </div>
            {/exp:channel:entries}
            <!-- /Wrap content -->
        </div>
        <!-- /Cols -->
    </div>
    <!-- /Row -->
    <div class="row margin-top-20">
        {exp:channel:entries channel="news" category="{segment_3}" limit="3" offset="<?php echo ($i+4) ?>" orderby="date" sort="desc" disable="categories|category_fields"}
        <div class="col-md-3 col-sm-3">
            <div class="post-wrap">
                {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                src="{image}"></a></div>
                {/if}
                <div class="post-content">
                    <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                    <p>
                        {exp:word_limit total="15"}
                        {body}
                        {/exp:word_limit}
                    </p>
                </div>
            </div>
        </div>
        {/exp:channel:entries}
        <!-- /Cols -->
        <div class="col-md-3 col-sm-3">
            <div class="advertisement">
                {ad_300x250_general_top}
            </div>
        </div>
        <!-- /Cols -->
    </div>
    <!-- /Row -->
    <div class="row margin-top-20">
        {exp:channel:entries channel="news" category="{segment_3}" limit="3" offset="<?php echo ($i+8) ?>" orderby="date" sort="desc" disable="categories|category_fields"}
        <div class="col-md-4 col-sm-4">
            <div class="wrap-content clearfix">
                <div class="post-wrap">
                    {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                    <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img
                    src="{image}"></a></div>
                    {/if}
                    <div class="post-content">
                        <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a></h3>
                        <p>
                            {exp:word_limit total="15"}
                            {body}
                            {/exp:word_limit}
                        </p>
                    </div>
                </div>
            </div>
            <!-- /Wrap content -->
        </div>
        {/exp:channel:entries}
    </div>
    <div class="row margin-top-20">
        <div class="col-md-9">
            {exp:channel:entries channel="news" category="{segment_3}" limit="4" offset="<?php echo ($i+11) ?>" orderby="date" sort="desc" disable="categories|category_fields"}
            <div class="col-md-3 col-sm-3">
                <div class="post-wrap">
                    {if '{exp:surgeree:modulo numerator="{count}" denominator="2"}' == 0}
                    <div class="post-content" id="{count}">
                        <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a>
                        </h3>
                        <p>
                            {exp:word_limit total="15"}
                            {body}
                            {/exp:word_limit}
                        </p>
                    </div>
                    {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                    <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img src="{image}"></a></div>
                    {/if}
                    {if:else}
                    {if "{image}"!="" && '{exp:bn_file_exists:check_file src="{image}"}'}
                    <div class="post-images"><a href="/{embed:category_name}/{segment_3}/{url_title}"><img src="{image}"></a></div>
                    {/if}
                    <div class="post-content" id="{count}">
                        <h3><a href="/{embed:category_name}/{segment_3}/{url_title}">{title}</a>
                        </h3>
                        <p>
                            {exp:word_limit total="15"}
                            {body}
                            {/exp:word_limit}
                        </p>
                    </div>
                    {/if}
                </div>
            </div>
            {/exp:channel:entries}
            <!-- /Cols -->
        </div>
        <!-- /Cols 9 -->
        <div class="col-md-3 col-sm-3">
            <div class="add">
                {ad_300x100_general_top}
            </div>
            <div class="add">
                {ad_300x100_general_top}
            </div>
        </div>
        <!-- /Cols -->
    </div>
</section>

```

**PHP ON INPUT**

What I did :

1. Removed the `exit`
2. Removed the angled quoates from around your php tags

Please let us know how you fair with this...

---
Tags: ajax
---


title: Setting a global session cookie path

text:
# Question
Title: Setting a global session cookie path
I'm seeing `PHPSESSID` set at `/members/` when I have `$config['cookie_path'] = ''` (also tried `$config['cookie_path'] = '/'`).

Shouldn't this config ensure all session cookies are set at the root path? I'm finding data I have in `$_SESSION` is not available at paths other than `/members/`

# Answer
> 0 votes
Russ, did you clear your cookies between experiments??? Blank will cause the current path to be used (I guess PHPSESSID was set while you visited /members/). the slash should behave as you desire, but it there's already a PHPSESSID cookie set onthe domain before you made the change, this cookie will not overwrite, ergo the old path.

Might be wrong but worth asking!

---
Tags: members, config, sessions, cookies
---


# Question
Title: Pagination adding "index.php" into pagination links after category name
My question is similar to this one, but since it is different enough and has no accepted answers yet, I am posting my question as well. I have a very simple listing page by category with pagination. I am removing "index.php" from the URL's via .htaccess using the code from EllisLab.

When on this page: `/products/category/coins`, the pagination links are `/products/category/coinsindex.php/P60` and `/products/category/coinsindex.php/P120`.

Where is the extra "index.php" coming from?

Here is my code:

```
{paginate}
{pagination_links}
<ul class="pagination">
    {first_page}<li class=""><a href="{pagination_url}" class="page-first">First</a></li>{/first_page}
    {previous_page}<li><a href="{pagination_url}" class="page-previous arrow">«</a></li>{/previous_page}
    {page}<li {if current_page}class="current unavailable"{/if}><a href="{pagination_url}" class="page-{pagination_page_number}">{pagination_page_number}</a></li>{/page}
    {next_page}<li><a href="{pagination_url}" class="page-next arrow">»</a></li>{/next_page}
    {last_page}<li class=""><a href="{pagination_url}" class="page-last">Last</a></li>{/last_page}
</ul>
{/pagination_links}

```

{/paginate}

Any help would be greatly appreciated!

# Answer
> 0 votes
The problem was an EE bug. I upgraded and the problem went away. Thanks to Bluedreamer for the comment which gave me the solution.

# Answer
> 1 votes
You should remove "index.php" from 'Name of your site's index page' in control panel (Admin -\> General configuration).

---
Tags: pagination
---


# Question
Title: Freeform Pro Notify User select menu is blank
When I check the enable box form my 'Notify User' form preferences, the drop down is blank. Any idea what I need to check/code wise or other in order to get the list of fiends to appear in this drop down menu? We're using EE2.9.2 and Freeform Pro v.4.2.2

Also, and I figure the answer is no but will ask anyway. In either the admin\_notify or admin\_cc\_notify parameters, can you use multiple email addresses, with one being a field/variable from the form itself?

So if the form contained the field email2 which is an email address. Could the admin\_cc\_notify field = "email2"?

Thanks

Peter T

# Answer
> 0 votes
You will need to add an email field to the form before you can get a field to choose for user notification emails.

Admin notification emails can only be directly set on the parameter and cannot be set via a field. You can also set it in the form preferences in the control panel.

If you need additional notification types, there are the dynamic recipients:

https://solspace.com/docs/freeform/form/#recipients

Which let you specify a hidden list of emails, chosen by the user with a key that posts and selects the hidden email (this helps to prevent spam) or you can use a user inputted email notification via user recipients:

https://solspace.com/docs/freeform/form/#recipient\_user\_input

---
Tags: solspace-freeform
---


# Question
Title: templates not being served, could it be .htaccess?
I've tried the tips here:
404 on Every Template and TPL group
and here:
404 error on all templates but homepage after removing index.php

I can access the index by using the default url (on my localhost, port 8040)

```
http://localhost:8040

```

But I cannot access any other templates:

```
http://localhost:8040/cursos
http://localhost:8040/programas

```

Here is my .htaccess

```
RewriteEngine on
RewriteCond $1 ^(cursos) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]

RewriteEngine on
RewriteCond $1 !^(images|js|css|crmi_cms|themes|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]

```

And here is my template directory structure:

```
expressionengine
    templates
        default_site
            cursos.group
                index.html
            programas.group
                index.html
            site.group
                index.html

```

site.group/index.html is default site home page.

I've even tried moving the cursos.group index to the site.group and renaming it to cursos.html. Still nothing...

Please help me.

# Answer
This finally worked. I double checked that mod\_rewrite was installed, too.

```
# Removes index.php from ExpressionEngine URLs
RewriteEngine On
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond $1 !^(admin|images|system|themes|index\.php|admin\.php) [NC]
RewriteCond $1 ^(cursos|programas|testimonales|salondelafama|enhonor|registro|resources|calendario|TNA) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]

```
> 1 votes

# Answer
Can you get the templates to render if you leave index.php in your URL? eg

> localhost:8040/index.php/cursos

If so then it is your .htaccess. Max is right about the order of your .htaccess file. Also, you could try adding a '?' in your RewriteRule directly after index.php

```
eg RewriteRule ^(.*)$ /index.php?/$1 [L]

```

A fairly reliable method of removing your index file is in the EE docs here - have you tried it? http://ellislab.com/expressionengine/user-guide/urls/remove\_index.php.html#exceptions
> 5 votes

# Answer
To add to this now old topic, I had a similar issue. While the original poster found the solution for their case, in my case the answer from BellamyStudio worked: https://stackoverflow.com/questions/10938330/unable-to-remove-index-php-on-expressionengine-wamp-installation#answer-11906830, updating the vhost.conf file, or in my case the file /etc/apache2/sites-available/default, to "AllowOverride All" for the directory where my site was hosted.

```
<Directory /the/path/to/my/webroot/>
  AllowOverride All
  Order allow, deny
  Allow from all
</Direcory>

```

In other words, my apache configuration was completely ignoring my htaccess file. Setting "AllowOverride All" made apache use the htaccess file in the webroot.

**Side note:** An easy test to see if your webserver is ignoring your htaccess file is to just add some junk data (a random string of letter for example) to the top of the htaccess file in the webroot, and then reload the website. If the result is an error (usually an "internal server error") then your webserver IS using the htaccess. Otherwise, the webserver IS NOT using the htaccess.
> 1 votes

---
Tags: templates, htaccess
---


# Question
Title: Something has gone wrong and this URL cannot be processed at this time + Zoo Visitor
I upgraded ExpressionEngine version to 2.9.0. and also Zoo Visitor to latest version. After upgrade, I am seeing a very strange error message after submitting Zoo Registration form `exp:zoo_visitor:registration_form`

> **Error**
>
> Something has gone wrong and this URL cannot be processed at this time.

Before, upgrade everything was working fine. Could anyone please help me.

# Answer
> 4 votes
Probably you have some broken conditional tag. The conditionals are more strict since 2.9.

# Answer
> 0 votes
This could be caused by missing curly bracket.

I had hard time debugging this, turned out I had

> return="{segment\_1}/{segment\_2/thanks"

where I should had

> return="{segment\_1}/{segment\_2}/thanks"

---
Tags: zoo-visitor, registration
---


title: Date range in EE postmaster template

text:
# Question
Title: Date range in EE postmaster template
I have a notification setup that is pulling the top 5 most viewed entries within the specific channel, and I want to send this email with the top 5 most viewed entries, and I want to send this notification out every 2 weeks. Below is the line of PHP code that I embedded to the notification as well as the channel entry calling it. Its showing just the top 5 most viewed overall still and is not resetting.

```
<?php
        $start_time = ee()->localize->format_date('%Y-%m-%d %H:%i', ee()->localize->now - (60*60*24*14));
?>

    {embed="_embeds/two-weeks-php"}
{exp:channel:entries start_on="<?php echo $start_time; ?>" site="example" channel="blog" dynamic="no" limit="10" status="open|Preview" {global:disable_basic} orderby="view_count_one"}

```

Any help would be greatly appreciated!

# Answer
if the dynamic timespan is your problem, try using

```
start_on="-2 Weeks"

```

and (optional)

`stop_before="{current_time}"`

and first try to test it with a regular template. You will not need an addon

I would try to avoid using php

Gabriel
> 0 votes

---
Tags: php, embeds, postmaster
---


title: Help diagnosing weird migration problem

text:
# Question
Title: Help diagnosing weird migration problem
I would value any suggestions / help available regarding a weird problem I'm having with an EE migration.

Trying to create a clone of an existing site (that works just fine) to do some development to the site templates.

I've set up a clean build of EE 2.10.1 on the development server, and it works just fine.

I've moved all the ancillary files associated with the existing site (e.g. Templates, Add-ons etc.) to the development server, and they are all visible and / or in the right place. But I've retained the (working) config.php and database.php files from the initial setup of the new machine.

I've exported the MySQL of existing site using phpmyadmin - a process I've used before and works fine.

I edit the MySQL dump to remove table relating to CECache (which points to cache entries I did not migrate across).

I've imported the exported MySQL tables into the MySQL of the newly created server.

I try to log into the CP and get no further than the login screen looping back after each attempt.

I've had a look and it appeared that the 'new' site was trying to load some assets from the old site - presumably due to settings in the imported MySQL (as config.php and database.php remain unchanged and relate only to new site).

So I reload the original database for new site, and check it works as before.

I edit the MySQL dump to change all references in there to the old site (or the old file path) to the new site URL / site path.

I try importing the edited MySQL to the new site database, and try to log in, and get same error as before - but this time the new site is not trying to load assets from the old site.

All the fixes I can find for this assume / suggest it is a problem with settings in the config.php file. But in this case, as I have a working config.php, the error must be something that is introduced via the MySQL import - not sure what though.

Anyone with any ideas? Would value any / all suggestions about how to fix.

Thanks!

# Answer
> 0 votes
Check these:

* Does the site remove the index.php? If so, did you import the .htaccess file and are there any directory customisations in there?
* In config.php, check these variables:
* cp\_url
* site\_label
* base\_url
* ce\_image
* in /index.php, are there any custom config values you might have forgotten?

---
Tags: ee2, migration
---


# Question
Title: Googlemaps InfoBox target close button with jQuery
I've got a google maps for EE map with multiple pins working. I've also set it to add a class to a div further down the page when clicking a pin.

However what I need is to remove that class when closing the infobox. Unfortunately I am unable to figure out how to target the close button as the inspector doesn't appear to work over the map. I've tried toggleClass but that only works when you click the pin again, not close the infobox.

My current working code is here, the jquery is at the bottom in the exp:gmap:event tag pair - I've added a second event tag pair targetting the closeclick event, but it's not working.

```
          {exp:channel:entries channel="branches" disable="member_data|pagination|categories|category_fields" limit="300"}

           {!--{branch_location id="map"}--}

           {exp:gmap:marker
            id="map"
            latitude="{branch_latitude}"
            longitude="{branch_longitude}"
            icon="/images/map-pin.png"
            offsetY="-40"
            offsetX="0"
            geocode="false"
            infobox="true"
            clustering="true"
            class="ui-infobox-dark"
            closeBoxMargin="5px"
          }
              <div class="ui-infobox-content entry{entry_id}">
                <h4>{title}</h4>
                {branch_address} <br>
                {branch_city} {branch_province} <br>
                {branch_postcode} <br>
                Work Phone: {branch_phone} <br>
                Toll Free: {branch_toll_free} <br>
                Fax Number: {branch_fax}
              </div>
            {/exp:gmap:marker}

            {!--
            // add active class to branch card to highlight it.
            --}
            {exp:gmap:event id="map"}
              $('.block article.entry{entry_id}').addClass('active');
            {/exp:gmap:event}

{exp:gmap:event id="map" event="closeclick"}
    $('.block article.entry{entry_id}').removeClass('active');
{/exp:gmap:event}

          {/exp:channel:entries}

```

# Answer
> 0 votes
Forgot about this Question until Laurance commented. Here is my working code:

```
     {exp:gmap:marker
  id="map"
  latitude="{branch_latitude}"
  longitude="{branch_longitude}"
  duplicate_markers="false"
  icon="/images/map-pin.png"
  geocode="false"
  clustering="true"
  latitude="{branch_latitude}"
  longitude="{branch_longitude}"
  limit="100"
  entry_id="{entry_id}"

  infobox="true"
  offsetY="-40"
  offsetX="0"
  class="entry-{entry_id} ui-infobox-dark"
  closeBoxMargin="5px"
}
  <div class="ui-infobox-content">
    <h4>{title}</h4>
    {branch_address} <br>
    {branch_city} {branch_province} <br>
    {branch_postcode} <br>
    Work Phone: {branch_phone} <br>
    Toll Free: {branch_toll_free} <br>
    Fax Number: {branch_fax}
  </div>
{/exp:gmap:marker}

{!--
// add active class to branch card to highlight it.
--}
{exp:gmap:event id="map"}
 $('.branch-block article.entry{entry_id}').addClass('active');

 $( ".ui-infobox-dark img" ).click(function() {
    $('.branch-block article').removeClass('active');

    console.log('was clicked');

  });

 {/exp:gmap:event}

{exp:gmap:event id="map" event="closeclick"}
   $('.branch-block article.entry{entry_id}').removeClass('active');
{/exp:gmap:event}

{!--
  http://devot-ee.com/add-ons/support/google-maps/viewthread/14346#47060
--}
<script>
  for(var x in map_markers) {
   var marker = map_markers[x];
   var id = marker.entry_id;

   // If this console.log doesn't return an entry_id, you need to
   // pass the entry_id using a parameter to your exp:gmap:marker tag.
   console.log('entry_id:', id);

   if(marker.window) {
    google.maps.event.addListener(marker.window, 'closeclick', function() {
     // $('.branch-block article.entry'+id).removeClass('active');
     $('.branch-block article').removeClass('active');
     console.log('this was clicked');
    });
   }
  }
</script>

```

---
Tags: jquery, google-maps-for-ee
---


title: parameters in URL for query sorting

text:
# Question
Title: parameters in URL for query sorting
I'm using the query module to return entries for a particular page. I would like to create a drop down list where the user can change how the entries on those pages are sorted.

is it possible to use something like Mo' Variables to add something in the URL string that I can pick up and use in my query to change my sort on page refresh?

Something

www.site.com/category\_name/?sort=rating\_rank

I think I'm reaching for straws, so need some good guidance.

# Answer
> 1 votes
sure, that is doable. set your template to read php on input. then in your query do

```
ORDER BY <?php echo ee()->input->get('sort'); ?>

```

or something like that

---
Tags: query-module
---


# Question
Title: Exp-resso Store shipping rates display live
I am using the UPS shipping plugin. My customer is logged in but when they get to step one in the checkout where I display the shipping options the shipping charge is $0.00

The actual charge is not displayed until the proceed to the final step in teh checkout process

How do I display the shipping charge on this initial checkout page rather that on the final step before heading to paypal?

# Answer
> 1 votes
The UPS plugin requires that you have at least the buyers shipping city, state and zip code if I remember correctly. So you will need to collect those before you show shipping information.

I usually do this once a user has an item in their cart and do not have shipping details already saved in their profile with a modal window recommending the user get tax & shipping estimates. If your customers are going to be logged in you should just need to make sure that you have mapped the shipping fields to custom profile fields so that you can bypass collecting that information in the future and can show the shipping details on the first page.

---
Tags: expresso-store
---


# Question
Title: Missing channel_id in Inventory Edit Entry URL breaks Structure
We have encountered issues when running Exp-resso 2.5.1 in tandem with Structure 3.3.17 when accessing the Control Panel Inventory page.

The $product-\>channel\_id that is requested on line 94 of InventoryController.php does not exist, and therefore when the link to edit an Inventory item is clicked, the channel\_id is omitted.

Typically this does not cause problems, however when using Structure and editing a channel entry directly from the Inventory page, the lack of a channel\_id in the URL string seems to break something with Structure. This can typically be fixed by editing the channel entry in Structure and saving it without making changes, but our clients are often unable to recall these simple steps.

Can I request that the following edit be made to the official build. On line 43 of the file:

```
system/expressionengine/third_party/store/src/Cp/InventoryController.php

```

REPLACE

```
->select(array('store_products.*', 'channel_titles.title', $this->ee->store->db->raw('SUM(`stock_level`) AS `total_stock`')))

```

WITH

```
->select(array('store_products.*', 'channel_titles.title', 'channel_titles.channel_id', $this->ee->store->db->raw('SUM(`stock_level`) AS `total_stock`')))

```

Adding the channel\_titles.channel\_id column to the query should resolve this issue in the future.

Thanks for your time and effort put into this addon,

Phil Dowson

# Answer
> 0 votes
Feature request are better sent directly to the developer. You have 2 options for that you could go to their support form or by emailing them directly at info@devdemon.com

---
Tags: expresso-store, structure, url
---


title: Get URL to MSM sites

text:
# Question
Title: Get URL to MSM sites
How do you link one MSM site to another? Or putting another way, how can I get the site\_url config item for a specific subsite (without resorting to PHP)? Seems like a very basic question, but couldn't find anything in the documentation.

Thank you!

# Answer
> 0 votes
I've run into this deficiency too - In the end I created each subsite's URL as a global variable for cross-site usage. (FocusLab Master Config helps with that).

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


title: retrieving first 3 content then last 3

text:
# Question
Title: retrieving first 3 content then last 3
I'm trying to figure out how to get content dynamically from expression engine. Basically I have 6 article summaries as content. When the page loads, I'm getting 3 summaries, but I have a "show more" button. When it's clicked, I want to load the next 3 summaries but I don't know how to do this.

this is what my tags look like now:

```
{exp:channel:entries channel="blogposts" limit="3"}
    <div class='article-box'>
        <div class="article-image-box">
            <div class="article-image">

            </div>
        </div>
        <article>
            <h4>{title}</h4>
            <p class='author'>{blog_author}</p>
            <p>
                {blog_body}
            </p>
           <div class="ful-art-but-box">
                <button class="button green-but">
                    READ FULL ARTICLE
                </button>
            </div>
        </article>
    </div>

{/exp:channel:entries}

```

# Answer
> 1 votes
You could use the `offset` parameter:

https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#offset

But that wouldn't be very efficient since you'd need two repetitive `channel:entries` tags which don't perform very well. You could instead use `count` to output different markup on different passes:

```
{exp:channel:entries channel="blogposts" limit="6"}
    {if count == 3}<div style="display:none">{/if}
    <div class='article-box'>
        <div class="article-image-box">
            <div class="article-image">

            </div>
        </div>
        <article>
            <h4>{title}</h4>
            <p class='author'>{blog_author}</p>
            <p>
                {blog_body}
            </p>
           <div class="ful-art-but-box">
                <button class="button green-but">
                    READ FULL ARTICLE
                </button>
            </div>
        </article>
    </div>
    {if count == total_results}</div><!-- close hiding div -->{/if}
{/exp:channel:entries}

```

... but that's not very readable or elegant in my opinion (I hate outputting disjointed chunks of opening/closing html tags, it becomes an ugly mess), so instead I'd use Stash with one `set_list` and two `get_list` tags, using `offset` and `limit`. Then if the actual markup for a single article becomes cumbersome you should abstract it out to a Stash embed to avoid the repetition.

```
{exp:stash:set_list name="entries" parse="yes"}
    {exp:channel:entries channel="blogposts" limit="6"}
        {stash:the-title}{title}{/stash:the-title}
        {stash:another-field}{blog_field}{/stash:another-field}
        {stash:and-another}{blog_field2}{/stash:and-another}
        {stash:link}{url_title_path=blog}{/stash:link}
        ...etc...
    {/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name="entries" limit="3"}
    <div class='article-box'>
        <h1>{the-title}</h1>
        ...etc... (or abstract all this markup to a Stash embed)
    </div>
{/exp:stash:get_list}

<div class="hidden-articles">
    {exp:stash:get_list name="entries" limit="3" offset="3"}
        <div class='article-box'>
            <h1>{the-title}</h1>
            ...etc... (or abstract all this markup to a Stash embed)
        </div>
    {/exp:stash:get_list}
</div>

```

---
Tags: tags
---


# Question
Title: Possible to alter url_title field so it populates from the title and another field
Currently, as standard the url\_title field generates the url from the title field. I can then manually change the url\_title field for each entry separately, but is it possible to set the url\_title field to automatically generate with the title and an additional field for a specific channel?

For example, currently I may have the following fields in a 'Food' channel:

```
{title}

```

Pepperoni Pizza

```
{url_title}

```

pepperoni\_pizza

```
{restaurant}

```

Luigi's Smoke House

and I would like to set the url\_title to automatically populate with the title and restaurant fields, resulting with:

```
{url_title}

```

pepperoni\_pizza\_luigis\_smoke\_house

# Answer
Have a look at the Magic Fields add-on \- it can do this.
> 3 votes

# Answer
Ammendum: Derek's suggestion seems much more suitable! Thanks for that Derek, I'll look at this module too!!

My origional answer (that I never finished typing)

Its possible, but you'll need to do alot of core and CP hackery to achieve this, the function `url_title` is in the file \`/system/expressionengine/helpers/url\_helper.php Line 474 on EE 2.10.1 if your interested. Be wary changing this function though, other diveses and modules use this common function, you'd be better re-implimenting it for the one place you want it.

Also the logic in the CP is not suitable, the current version works as url\_title derives from title, so once title field is updated and url\_title is blank then update. With your construct there would need to be code that redefines this logic so that if either field is updated and rul\_title is blank or matches one or the other fields but not both then.... you see waht I mean???

**An Alternative**

Could you not handle this another way? Lets say you have a template set up with the route of `/resturants/{any}` so would pick up the URL `/resturants/pepperoni_pizza-luigis_smoke_house. Now lets say you split the 2 fields (lets say`url\_title`for the Luigi part and`food\` as the pizza part) with a dash instead of another underscore so you can seperate the 2 fields, as per the example above.

Then in your template you can easily do this :

```
<?php
    //resturant router
    $seg = ee()->uri->segment(2);
    $parts = explode("-", $seg);
?>
{exp:channel:entries dynamic=no url_title="<?php echo $parts[1] ?>" search:food="<?php echo $parts[0] ?>"}
    {!-- ... --}
{/exp:channel:entries}

```

**PHP on INPUT**

**Another Alternative**

Or just use the category system? It's what it's intended for, so Pepperoni Pizza would be the category and Luigi's Smoke House would be the URL title. URL's would look something like : `/pepperoni_pizza/luigis_smoke_house` or just a permalink to the resturant you want `/luigis_smoke_house` or all resturants that server pepperoni pizza `/pepperoni_pizza/`.

Just some suggestions...
> 0 votes

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


title: Add New Grid Rows via Channel Form

text:
# Question
Title: Add New Grid Rows via Channel Form
I have a channel where I would like admin to be able to create entries and then anonymous users would be able to add rows to a grid field. I do not want the users to be able to see existing rows(if they exist), just add.

I thought I would be able to get the total rows, and with the Simple Math plugin, make Channel Form ready to add a new row.

```
<input class="input-block-level" type="text" name="field_id_44[rows][new_row_{exp:simple_math calculate="{shipping_quotes:total_rows} + 1" decimal_places="0"}][col_id_6]" value="">

```

Which actually works as expected

```
<input class="input-block-level" type="text" name="field_id_44[rows][new_row_2][col_id_6]" value=""

```

So \[new\_row\_2\] outputs as "2" because in this case there is already an existing row. This works no matter how many rows I add. If the entry has 3 rows in this grid field, it outputs \[new\_row\_4\]... as expected.

But this unfortunately doesn't translate when submitting the form. Submitting just replaces the existing row(#1), so I think I am misunderstanding how to add new rows via Channel Form.

So long story short, how do I add rows to a grid field via channel form.

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

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

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

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

---
Tags: safecracker, grid
---


# Question
Title: How do you get your modifiers to be on your paypal invoice?
When a purchase is made with exp-resso Store and the payment is sent to paypal the customer and company both receive an email receipt from paypal.

Problem is the paypal receipt does not contain the product modifiers. HOw do I get these added to the paypal invoice/receipt?

# Answer
> 1 votes
You will need to open up the PayPal payment gateway file and search for the relevant code to send the line item data and then add code to loop through any modifiers for each item in the cart.

---
Tags: expresso-store
---