# Question
Title: Zoo:Visitor Registration form throws errors, doesn't render form when user is logged out, but not when logged in
So it looks like I'm having some issues with EE 2.5.5 and Zoo Visitor 1.3.21. I have a fairly simple registration template:

```
{embed="embeds/_header"}

  {exp:zoo_visitor:registration_form class="form-horizontal sign-up"}

    <header>

      <h6>Please fill out the following to create your BLOOM account.</h6>
      <p>All fields required.</p>

    </header>

    <fieldset>

      <div class="control-group">
        <label class="control-label" for="member_firstname">First Name</label>
        <div class="controls">
          <input type="text" name="member_firstname" id="member_firstname" class="input-xlarge" placeholder="First Name" />
        </div>
      </div>

      <div class="control-group">
        <label class="control-label" for="member_lastname">Last Name</label>
        <div class="controls">
          <input type="text" name="member_lastname" id="member_lastname" class="input-xlarge" placeholder="Last Name" />
          <p class="hint">Use this space for messaging about BLOOM’s recommendation on how teachers should or should not change their username</p>
        </div>
      </div>

      <div class="control-group">
        <label class="control-label" for="email-address">Email Address</label>
        <div class="controls">
          <input type="text" name="email" id="email" class="input-xlarge" placeholder="firstname.last@gmail.com" />
        </div>
      </div>

      <div class="control-group">
        <label class="control-label" for="password">Password</label>
        <div class="controls">
          <input type="password" name="password" id="password" class="input-xlarge" />
        </div>
      </div>

      <div class="control-group">
        <label class="control-label" for="password_confirm">Confirm Password</label>
        <div class="controls">
          <input type="password" name="password_confirm" id="password_confirm" class="input-xlarge" />
        </div>
      </div>

    </fieldset>

    <fieldset>

      <header>

        <h6>Choose your School and Grade</h6>

      </header>

      {field:member_school}

    </fieldset>

    <fieldset>

      <header>

        <h6>Add Your Class(es)</h6>

      </header>

      <div class="well">
        {field:member_classes}
      </div>

    </fieldset>

    <fieldset>

      <ul class="control-group btn-group">
        <li><button type="submit" class="btn btn-small btn-primary">Sign Up</button></li>
      </ul>

    </fieldset>

  {/exp:zoo_visitor:registration_form}

{embed="embeds/_footer"}

```

And the registration form shows just fine if the user is logged in. However, if the user is not logged in (as you would expect from a registration page), I get a number of errors:

```
Uncaught ReferenceError: EE is not defined index.php:657
    (anonymous function) index.php:657

Uncaught ReferenceError: EE is not defined signup:100
    (anonymous function) signup:100

2 Uncaught SyntaxError: Unexpected token < login:1

Uncaught ReferenceError: EE is not defined signup:70
    (anonymous function) signup:70
    p index.php:43
    l.fireWith index.php:44
    b.extend.ready index.php:33
    k.addEventListener.A index.php:42

```

Also, here’s the page output:

```
<html><head>
    <meta charset="utf-8">
    <title>iPlan BLOOM</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width">

    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/twitter-bootstrap/2.1.1/css/bootstrap.no-icons.min.css">
    <link rel="stylesheet" href="//netdna.bootstrapcdn.com/font-awesome/2.0/css/font-awesome.css">

    <link rel="stylesheet" href="/assets/css/site.css">

    <script src="//www.google-analytics.com/ga.js"></script><script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
    <script>window.jQuery || document.write('<script src="/assets/js/libs/jquery-1.8.2.min.js"><\/script>')</script>
  </head>
  <body>

    <header class="toolbar">

      <h1><a href="/"><span class="bloom">BLOOM</span> <span class="iplan">iPlan</span></a></h1>

            <nav class="account-navigation">
        <ul>
          <li><a href="http://local.upitt.com/account/signup">Sign Up</a></li>
          <li><a class="btn btn-small btn-primary" href="http://local.upitt.com/account">Log In</a></li>                  </ul>
      </nav>

    </header>

    <script type="text/javascript" charset="utf-8" src="http://local.upitt.com/?ACT=3&ui=core,widget,mouse,position,draggable,resizable,button,dialog,datepicker&plugin=scrollable,scrollable.navigator,markitup,thickbox,toolbox.expose,overlay,tmpl&v=1355874508&include_jquery=y"></script>
<style type="text/css">  .playa-entry a span.open { color: #093 !important; }
  .playa-entry a span.closed { color: #900 !important; }
  .playa-entry a span.Super_Admins-id1 { color: # !important; }
  .playa-entry a span.Banned-id2 { color: # !important; }
  .playa-entry a span.Guests-id3 { color: # !important; }
  .playa-entry a span.Pending-id4 { color: # !important; }
  .playa-entry a span.Members-id5 { color: # !important; }
  .playa-entry a span.Content_Admins-id6 { color: # !important; }
</style>
<link rel="stylesheet" type="text/css" href="http://local.upitt.com/assets/themes/third_party/playa/styles/field.css">
<link rel="stylesheet" type="text/css" href="http://local.upitt.com/assets/themes/third_party/playa/styles/singleselect.css">
<link rel="stylesheet" type="text/css" href="http://local.upitt.com/assets/themes/third_party/matrix/styles/matrix.css?2.5.2">
<script type="text/javascript">PlayaFilterResources = {
  filterUrl: "http://local.upitt.com/",
  ACT: 23,
  lang: { is: "is" }
};</script>
<script type="text/javascript" src="http://local.upitt.com/assets/themes/third_party/playa/scripts/singleselect.js"></script>
<script type="text/javascript">new PlayaSingleSelect(jQuery("#member_school"), {"defaults":{"expired":"n","future":"y","channel":"8","limit":"0","limitby":"","orderby":"title","sort":"ASC"},"fieldName":"member_school"});</script>
<script type="text/javascript" src="http://local.upitt.com/assets/themes/third_party/matrix/scripts/matrix.js?2.5.2"></script>
<script type="text/javascript">Matrix.lang = { options: "Options", add_row_above: "Add row above", add_row_below: "Add row below", delete_row: "Delete row", move_to_top: "Move to top", move_to_bottom: "Move to bottom", remove_file: "Remove File", select_file_error: "There was an error selecting your file. Please try again, or save and re-edit the entry if the problem persists." };</script>
<script type="text/javascript" src="http://local.upitt.com/assets/themes/third_party/playa/scripts/matrix.js"></script>
<script type="text/javascript">PlayaColOpts.col_id_3 = {"defaults":{"expired":"n","future":"y","channel":"9","limit":"0","limitby":"","orderby":"title","sort":"ASC"}};</script>
<script type="text/javascript">function initMatrix_fd62c6a3bc0e043e308b57854aa60a3f(){var m = new Matrix("#member_classes", "member_classes", "Classes", [{"id":"col_id_3","name":"class","label":"Class","required":false,"settings":{"multi":"n","expired":"n","future":"y","channels":["9"],"orderby":"title","sort":"ASC"},"type":"playa","newCellHtml":"<input type=\"hidden\" name=\"{DEFAULT}[selections][]\" value=\"\"\/><div id=\"{DEFAULT}\" class=\"playa playa-ss\" style=\"margin: 3px 0\" tabindex=\"0\"><table cellspacing=\"0\" cellpadding=\"0\" border=\"0\"><tr><td class=\"playa-ss-input\"><li class=\"playa-entry playa-ss-noval\"><a>Select an entry…<\/a><\/li><\/td><td class=\"playa-ss-button\"><img src=\"http:\/\/local.upitt.com\/assets\/themes\/third_party\/playa\/images\/select_btn_arrow.png\" alt=\"\" \/><\/td><\/tr><\/table><div class=\"playa-entries playa-ss-entries\"><div class=\"playa-scrollpane\"><ul><li class=\"playa-entry playa-ss-noval\"><a>Select an entry…<\/a><\/li><li class=\"playa-entry \" id=\"{DEFAULT}-option-5\" unselectable=\"on\"><a><span class=\"playa-entry-status open\">•<\/span>Numbering curriculum, 101<\/a><input type=\"hidden\" name=\"{DEFAULT}[options][]\" value=\"5\" disabled=\"disabled\" \/><\/li><li class=\"playa-entry \" id=\"{DEFAULT}-option-6\" unselectable=\"on\"><a><span class=\"playa-entry-status open\">•<\/span>Whatever happened to class?<\/a><input type=\"hidden\" name=\"{DEFAULT}[options][]\" value=\"6\" disabled=\"disabled\" \/><\/li><\/ul><\/div><\/div><\/div>","newCellSettings":false,"newCellClass":false},{"id":"col_id_4","name":"grade_level","label":"Grade Level","required":false,"settings":{"options":{"9th":"9th","10th":"10th","11th":"11th","12th":"12th"}},"type":"pt_dropdown","newCellHtml":"<select name=\"{DEFAULT}\">\n<option value=\"9th\">9th<\/option>\n<option value=\"10th\">10th<\/option>\n<option value=\"11th\">11th<\/option>\n<option value=\"12th\">12th<\/option>\n<\/select>","newCellSettings":false,"newCellClass":false}], [], 0, 0);
m.totalNewRows = 0;
};
jQuery(document).ready(function(){
initMatrix_fd62c6a3bc0e043e308b57854aa60a3f();
});
if (typeof(Bwf) != 'undefined'){
Bwf.bind('matrix', 'previewClose', function(){
initMatrix_fd62c6a3bc0e043e308b57854aa60a3f();
});
}</script>
<script type="text/javascript" charset="utf-8">
// <![CDATA[
$(document).ready(function() {
    if (typeof SafeCracker == "undefined" || ! SafeCracker) { var SafeCracker = {markItUpFields:{}};}
    $.datepicker.setDefaults({dateFormat:$.datepicker.W3C+EE.date_obj_time});
    $.datepicker.setDefaults({defaultDate: new Date(1357335315000)});});
// ]]>
</script>
<style type="text/css">.hasDatepicker{background:#fff url(http://local.upitt.com/assets/themes/cp_themes/default/images/calendar_bg.gif) no-repeat 98% 2px;background-repeat:no-repeat;background-position:99%;}</style><script type="text/javascript">
                    $.createDatepickerTime=function(){
                        date = new Date();
                        hours = date.getHours();
                        minutes = date.getMinutes();
                        suffix = "";
                        format = "us";

                        if (minutes < 10) {
                            minutes = "0" + minutes;
                        }

                        if (format == "us") {
                            if (hours > 12) {
                                hours -= 12;
                                suffix = " PM";
                            } else if (hours == 12) {
                                suffix = " PM";
                            } else {
                                suffix = " AM";
                            }
                        }

                        return " '" + hours + ":" + minutes + suffix + "'";
                    }

                    EE.date_obj_time = $.createDatepickerTime();
                </script>

    <script src="/assets/js/min/main-min.js"></script>
    <script src="/assets/scripts/site.js"></script>

    <!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
    <script>
      var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
      (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
      g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
      s.parentNode.insertBefore(g,s)}(document,'script'));
    </script>

<ul id="matrix-menu" style="opacity: 0; display: none;"><li>Add row above</li><li>Add row below</li><li class="br"></li><li>Move to top</li><li>Move to bottom</li><li class="br"></li><li>Delete row</li></ul></body></html>

```

I've never run into this before, so I'm quite stymied. Any suggestions or help the community could provide would be greatly appreciated!

# Answer
As it turns out, the problem was that I hadn't enabled Guest Members to post to the Member channel. A quick trip to the Zoo Visitor troubleshooting tab revealed this section, complete with information on what to do next:

Fortunately, all is resolved now!
> 3 votes

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


title: shipping calculator for expresso store

text:
# Question
Title: shipping calculator for expresso store
Not sure if a new question is the right thing? There was a question a month ago about users being able to calculate shipping on the first page of checkout.

In the template I substituted:

```
{field:shipping_method}
{if error:shipping_method}<p class="help-block">{error:shipping_method}</p>{/if}

```

for

```
<label>Shipping State</label>
{field:shipping_region}
<input type="submit" name="update_cart" value="Update Shipping" class="btn" />

```

The aim was to update `{order_shipping}` on the same page. This doesn't work.

I would appreciate some help on this. Cheers, Alex

# Answer
Justin's excellent support pointed out my error.

In the ExpressionEngine control panel Store \>\> Settings \>\> General \>\> Default Shipping Address can be set to "None", "Shipping Same as Billing" or "Billing Same as Shipping"

If you have it set to "Shipping the same as billing" you would need to make sure that you have {field:billing\_region} instead of {field:shipping\_region} or visa-verse if you have "Billing same as Shipping".

I had it set to "Shipping same as Billing" and changing {field:shipping\_region} to {field:billing\_region} sorted the issue.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Twitter and Facebook login support in EE
What do you recommend for implementing EE member sign-on support using Facebook and Twitter accounts?

We are having a lot of trouble with our CAPTCHAs with EE comments and so we are considering dumping the captcha and just requiring an account to be able to comment. In order to make it a little more open though, we'd like to let people use their Twitter or Facebook log-in to sign-in. Someone has recommended Social Login Pro, but are there other add-ons that are recommended or are we better off implementing our own solution using the Twitter and Facebook APIs?

# Answer
> 4 votes
What about Disqus? Personally, I prefer sites that use Disqus for commenting than Facebook comments. Of course, that's not the entirety of your question. In terms of an easy-to-use sign-on. Social Login Pro seems to be the way to go, if you want people to be able to choose, which account they want to sign-in for.

I like that it allows Google and Twitter, but haven't used it on a client project yet. I have used Solspace's Facebook Connect and thought that was very good, but it's all about Facebook (which worked for the project I used it on). I have it queued up for a new project, so I'm interested in seeing what's new in version 2.x of the add-on.

Generally speaking though, if you want Social Media login, I think Social Login Pro is probably the way to go. But I'd still consider switching to Disqus for comments.

# Answer
> 2 votes
If Spam through your current comment forms is the issue then there is a great add-on to stop spam in EE called **Snaptcha**. We were getting a lot of Spam on a site we had built and this STOPPED the spam immeadiately. I can't recomend it enough. Super simple to implement.

http://devot-ee.com/add-ons/snaptcha

---

We have recently used Disqus on another site we just launched to enable people to comment using their social login.

Another great add-on is **CX Disqus Comments** which enables two way comment sync and lets you export your existing EE comments to Disqus, and automatically sync new Discus comments back to the ExpressionEngine database for SEO and backup purposes.

This sounds like it could be perfect for you.

http://devot-ee.com/add-ons/cx-disqus-comments

---
Tags: members, accounts, comments, single-sign-on
---


# Question
Title: Remove "edit", "help", "+add" in Control Panel
I've created a Member Group and am trying to severely limit what members can access. All I want them to be able to do is to publish and edit certain Channels. So far, I have been able to implement that. However, I've noticed that the Control Panel has the following, too:

* "Edit" button: this is redundant as you can get to this UI by going to Content -\> Edit. I'd like to remove this
* "Help" button: this takes the member to the EE site. I want this removed as I will provide my own help documentation
* "+ Add": I want this removed also; there is nothing for the member to do but to manage Channel entries for a few select Channels

Suggestions on how to do these?

# Answer
Quick and easy answer, get your self ZFA:

Note: I think the add-on description along with images in the links I provided are self explanatory and why I'm pretty sure my quick and easy answer is sufficient in this particular case.
> 5 votes

---
Tags: control-panel
---


# Question
Title: Exp:resso Store - Add Shipping Cost after checkout
I'm currently in the midst of a Store development for a wholesale site that cannot use automated shipping due to the nature of the product (jewels / gem stones).

The client has to manually work out the shipping cost after the purchase order has been placed.

Is there a way to edit the order / add shipping after the end user has placed their order? This is so that the shipping / insurance costs can be manually calculated and then added to the invoice retrospectively.

There is no payment gateway on this site - it's 30 day invoicing to payment gateway is set to manual.

Thanks,

Jamie

# Answer
There's no way to do this from the control panel, and even the developer API doesn't have an easy way to recalculate/edit an order after it has been placed.

The best way to approach this would be to write a custom module which provides an interface where your client can update the shipping cost of an order. When you save this back to the database, be sure to update the order tax & total as well if they have changed.

At this point it should be fairly easy for you to send an invoice link back to the customer where they can pay by credit card (or manually record payments if they are paying via bank transfer).
> 2 votes

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


# Question
Title: Database errors on update - issue with updates/ud_215
I am trying to bring a slightly older site back to life. It's currently on 2.1.4 and I am trying to pull it right up to date. There appears to be something going wrong somewhere as I am receiving database errors...

It is in or around ud\_215 I think as this is where the error is reported. It appears to be attempting to create some duplicate fields in db tables - although I am aware that this may be because I have attempted to run the updater a couple of times. I've tried dropping the fields manually from the tables and re-running but I continue to get errors.

I ended up changing the software version in config.php to show as 215 and everything appeared to run okay - but on accessing the control panel I can tell that there up upload path issues somewhere.

I appreciate it's a long shot that someone else may have had similar issues - but where better to ask!? ;-)

# Answer
> 2 votes
Okay so this one is a bit strange but I got it to run in the end! I thought I would post my own answer in the hope that it may help others if they come across this issue themselves...

Having rolled back to 2.1.3 a few times (that was fun!) and running through the update whilst watching the expected changes to the database I discovered the following:

* The upgrade to 2.1.4 was running fine and updated the config to version 214
* The upgrade to 2.1.5 had in fact completed but for some reason was attempting to run again!

I compared the config file on my backup to the new one and the only major difference was that the version number variable was wrapped in " in the new file and ' in the old. Now I am pretty sure that really shouldn't be an issue, however I changed the new file from "215" to '215' and saved it. I then re-ran the updater and it sailed through fine!!!

At this point I had to re-sync the file uploads (a requirement of the 215 version notes) and the site is up to date and functioning again.

Just to add a twist, when I checked the config file on my now 2.5.5 install the version is wrapped in double quotes again!? :-)

Thanks to those who added their help to this one though - nice to see the community support is still there and willing to help :-)

# Answer
> 3 votes
I had this happen to me recently as well, upgrading a DB from 1.7.3 to the latest.

Even if you are in the DB and can respond to each error, the maddening thing is that as soon as you fix one error, it restarts the whole process for the version number it's on, meaning that you have to fix the entire list of errors, or it will simply re-choke on error number 1 again.

I ended up backing up the DB, then running the update to catch the next error.

I would then update my backup to fix that error, trash the version I just ran the update on, then create a new copy of my backup to run the installer against again.

It was a bit of a nightmare, but I made it through.

# Answer
> 1 votes
I had a serious of similar issues happen to me during an upgrade from EE 1.7.3 to EE 2.5.2. The darn duplicate field, can't add 'fieldname' cause it already exists. First thing, first… did you perform a backup of your database? If yes, can you rollback full to EE 2.1.4?

Then re-start the upgrade process from there. It's not ideal, but will get you a clean beginning.

---
Tags: error, updating, update
---


title: has anyone used the Hop Inject plug-in?

text:
# Question
Title: has anyone used the Hop Inject plug-in?
Looking for a way to "inject" images into channel entries without having the content administrator trying to mess with html. I found hop inject on devot-ee, and I'm wondering if anyone has used it or a similar plug-in, and what you thought of it. If you've used something different that you feel is better, I'd definitely be open to any recommendations. thank you!

# Answer
> 3 votes
Hop Inject, though I've never used, is geared more towards ads or ad like images (images unrelated to content). Do you just want images related to content? If so, than almost any of the WYSIWYG field\_types could be used and will allow images to be uploaded and inserted into copy/content without knowledge of HTML.

I'd say, WYGWAM by Pixel & Tonic is probably the most popular. We've used that, Expresso by Put Your Lights On, and hope to use Editor by DevDemon on an upcoming project. WYGWAM is our primary for most projects, but we like Expresso for smaller projects or when we need a more lightweight presence. Editor just seems interesting, we're hoping to test it and see if should be added to our toolbox.

Now, if you're really looking for adding items after the fact to content, then I've heard good things about Hop Inject, and it can be used for pull quotes or things other than adds, but I've never used it. While, there are other ad related add-ons, I'm not certain they attack the same issue as Hop Inject, which makes it more flexible for the situation, where an image should be displayed every 4 paragraphs or a pull a quote every third paragraph.

---
Tags: add-on, channel-entries, image
---


# Question
Title: Matrix in Template: how to get total rows?
I need to know outside of the Matrix tag pair the total rows that it has. To get total rows within the tag pair, this works for me:

```
{matrix_field_short_name}
   <h1>{total_rows}</h1>
{/matrix_field_short_name}

```

Outside the tag pair, it seems like this should work: `{matrix_field_short_name:total_rows}` per http://pixelandtonic.com/matrix/docs/templates. However, instead of getting an integer, I'm getting the string `http://domain.com/member_uploads/_s:total_rows/slide.jpg`.

My Matrix field is names `images` and it contains the columns `image` (the file) and `caption` (a text field).

Any idea what might be going on?

**EDIT 1: Code Snippet**

```
<h1>{images:total_rows}</h1>

{images}
    <div class="{if row_count == 1}active{/if} item">
        <img src="{image:250x250}" alt="{caption}"/>
    </div>
    <div class="carousel-caption">
        <p>{caption}</p>
    </div>
{/images}

```

# Answer
> 3 votes
I agree with the name. I've run into that before. I have adapted a matrix naming convention of a small prefix from the matrix field then whatever I need : eg. seg-images if the matrix field is segments. In your case, it looks like you have images as the matrix field itself. Try naming it something like mx-images.

---
Tags: templates, matrix
---


# Question
Title: Using Structure to output main menu when frontpage is the root?
I always end up with a custom addon for outputting the nav from Structure but for this project I was hoping to go all native .. it *should* be pretty simple, after all.

Given this Structure structure how could one output the menu to the right?:

The nav tag won't cut it as it will always output the root. Am I missing something?

```
{exp:structure:nav include_ul="no" start_from="/" max_depth="2"}
    <li><a href="{page_uri}">{title}</a></li>
{/exp:structure:nav}

```

// NOTE: I do know about the Structure Entries plugin but AFAIK this will use {title} for the page titles which means it won't work inside a {exp:channel:entries} loop w/o using an embed.

# Answer
> 1 votes
I have done something similar but I think it won’t work in Structure 3.3.7 and later (*\[Feature\] Fix for nesting pages under “Home” (url of “/”). No longer allowed.*).

Let’s assume your home page has the entry\_id 1:

```
{exp:channel:entries
    fixed_order="{exp:structure:child_ids entry_id='1'}"
    parse="inward"
    }
    <li{if "{page_url}" == "{structure:page:url}"} class="active"{/if}>
        <a href="{page_url}">{title}</a>
    </li>
{/exp:channel:entries}

```

This should work up to Structure 3.3.6.

`{exp:structure:child_ids}` is not documented in the current Structure documentation but you can find it in the EE1 Structure docs and Travis (or Jack?) assured me that it won’t be gone anytime soon. It looks like you can use `{structure:child_ids_for:XXX}` since Structure 3.3.5. But I have not tried it.

To output the menu in a `{exp:channel:entries}` loop I would use More Entries plugin or Stash (of course).

I have not tried it, but it seems like you can use `{exp:structure:entries}` tag instead of `{exp:channel:entries}` since Structure 3.3.7. Too bad nesting pages under “Home” is not allowed since the same version. :-(

May be this thread in Structure’s support forum could be helpful too.

# Answer
> 5 votes
You should be able to just do:

```
{exp:structure:nav include_ul="no" start_from="forside" max_depth="1"}

```

You can pick what page you want to start from, which in this case looks like "forside".

# Answer
> 0 votes
Another option is to use `{exp:structure:nav include_ul="no" start_from="forside" max_depth="1" add_unique_ids="yes"}`... note the added `add_unique_ids="yes"` parameter.

With unique IDs added, you can use CSS to hide the home page link as needed.

# Answer
> 0 votes
If you never want the frontpage output in the menu, how about just hiding it from the navigation tag altogether (by setting "Hide from nav" to "yes" in the structure tab)?

---
Tags: structure, navigation
---


title: image file names adding +

text:
# Question
Title: image file names adding +
I have a site that was just updated to EE 2.5.3 and since then it looks like any image I had in a file field that had spaces in the file name now appears to have + in place of the space. THis has caused all the image sources to be broken.

ie: an image with the name file name.jpg that was uploaded now appears to be file+name.jpg so the image is broken when viewed in the browser.

# Answer
Looks like a bug in 2.5.3 that was fixed.

https://support.ellislab.com/bugs/detail/18289
> 1 votes

---
Tags: file-uploads
---


# Question
Title: What's the difference between url_title and url_title_path?
I keep running into issues, and apparently I just don't understand the difference between these two variables. One set of pages works with url\_title\_path, and the other set will only act right with url\_title. There must be some difference I'm missing, but I don't know what it is. any help?

# Answer
> 11 votes
url\_title\_path requires a `template_group/tempate` to be passed to it, so it can return a complete URL. It should be used when creating links. (It seems to be the same as title\_permalink, which is what I always use myself.)

e.g., `{url_title_path="news/entry"}` returns `http://mysite.com/news/entry/hello-world`

`url_title` is simply a variable which returns an entry's `url_title`, e.g., `hello_world`

---
Tags: variable, url-title
---


# Question
Title: Allow Member to delete account, but not edit?
I've created a Member Group and want members in that group to be able to delete their own account. I've edited the Member Group Settings to set `Can delete own account - deletes all posts, entries, and comments as well` to "Yes", but didn't see anything in the Control Panel that would allow the member to delete his/her account. I then set `Can access MEMBERS section` to "Yes", but that gave the member access to ALL members, which is not what I want.

How does a member delete his/her account? And what settings does the Member Group need to have?

Also, I don't want the Member to be able to edit their Member details. When a user clicks on their screen name (left of the "logout" link on the top right of CP), they are taken to a "My Account" page where the member can edit profile, avatar, etc. I want to prevent access to any of that. Is this possible?

# Answer
Question 1: Where should a member delete his or her account?

This is explained in the user guide: http://ellislab.com/expressionengine/user-guide/cp/members/member\_groups\_edit.html

## Can delete own account - deletes all posts, entries, and comments as well

Determines whether a member of the group can delete their own account. **If enabled, members of this group will be able to delete their own account through their front-end member control panel.**

So there it is: the setting can be used via the *front-end* member control panel.

---

Question 2: How can I make sure a member cannot edit account details?

You should take a look at the member templates: check the "themes" folder --\> "profile themes". Use something like `{if member_group == "4"}` and show a message "You're not authorised to see this page" (or something like that) instead of the form.
> 3 votes

---
Tags: members, member-details
---


# Question
Title: how can I conditionally display image if one is attached to channel entry
I have an image that is an optional channel field, and I've got it hard coded into the template. If someone doesn't attach an image, there is an empty image box on the page for that entry. How can I tell EE to check for an image, and if its not there, just load the rest of the page normally?

# Answer
> 9 votes
I think this should work:

In this example I use three custom fields: `article_image`, `image_description` and `class`.

```
{if article_image != ""}
   <img src="{article_image}" alt="{image_description}" title="{image_description}" class="{class}" />
{/if}

```

You can also use the shorthand version of the above code like so "{if custom\_field}content here{/if}". This shortens up the code a bit.

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


# Question
Title: Should I use a channel entry tag pair for quotes?
I have small modules in the sidebar on various pages throughout my site. I'm including different quotes for different pages in the sidebar modules. Originally I hard coded them into the template, but I started thinking that I may want them to be editable by whoever will be administering the content on the site. I don't want to use snippets because you can't give someone access to snippets without also giving them access to the templates, and I'd like to not do that.

I was thinking of using a channel entries tag pair to display that content, and just have a "quotes" channel. Is that the best way to do that as far as speed goes? How heavy are those tag pairs if I disable all the unneeded properties?

# Answer
Yes, a quotes channel is a great idea. We have done something similar to that in countless websites. Sometimes this channel is called "testimonials" or "quotes".

This also has the advantage that you can have a separate custom field for the quote's author, and display this in a consistent format on your site, without relying on your client to format it correctly, or updating many quotes in a snippet.

Generally, I'm a fan of not worrying about performance issues until they are actually an issue (i.e. you are getting thousands of visits per day). In that case, any caching plugin (or even the built in EE caching parameters) will be plenty (e.g. you can display a random quote, and cache it for 5-60 minutes).
> 8 votes

# Answer
that's probably your best option to be honest. Low Variables would be another option but you're then limited in what can be added. With a dedicated quotes channel you could have as many as was required.
> 3 votes

---
Tags: channel-entries
---


title: Template Debugging - I can't see it

text:
# Question
Title: Template Debugging - I can't see it
I've enabled template debugging on our EE installation on a test server. I can't see the template debugging information when I load pages (either in CPanel or templates). Another developer I work with can see them just fine on his machine. We're both logged in as Super Admin. Any ideas what's wrong?

# Answer
> 3 votes
I have recently found that Chrome does not display the debugging information if the developer tools are being used.

I do not have any idea why this happens, but whenever I am logged in and not seeing the debugging info, it is because the developer tools are open.

I am using Chrome v23.0.1271.101, and EE 2.5.3

---
Tags: templates, debugging
---


# Question
Title: EE - move channel entries from one channel to another ( they share the same channel fields )
I accidently created two channels ( news & press-releases ). They share the same custom-fields - how do I merge them ( news into press-releases ) ?

Tried this ( 23 being the id of press-releases and news is 1 )

UPDATE exp\_channel\_data SET exp\_channel\_data.channel\_id=23 WHERE exp\_channel\_data.channel\_id=1

But my News-entries are is still showing up under the edit news in the control panel.

Any ideas ? ( hope I don't have to do it manually :) )

# Answer
If the item uses the same field\_group, you can generally switch channels via the edit menu.

Go to the 'Edit' Menu, Select the Entry, while in the Entry, Select the Options Tab. The choice of channels you can move the item to is listed. See image.

Additionally, if you were going to do it via query, you need to update multiple database tables: exp\_channel\_titles and exp\_channel\_data being the two primary. Based on your query, the titles are still the old channel and the data is now associated with the new channel.
> 7 votes

# Answer
You have to update the exp\_channel\_titles table too.
> 3 votes

---
Tags: control-panel, mysql
---


# Question
Title: Can I get Channel Entry Loop counts by channel?
I have a sort of odd need and I'm not exactly sure how to solve it so I'm coming here for help. I have a channel entries loop that displays all the latest posts for our site with pagination on our home page. We want to now add a new channel, but for it's entries we only want the most recent entry from that channel to show up in the main all channel channel entries loop. Is something like this possible? If so, how would you do it?

# Answer
You could use a combination of Stash, multiple `exp:channel:entries` loops and a snippet (optionally) to build your solution.

Snippet: sn\_set\_fields

```
{exp:stash:append_list name="entries"}
  {stash:title}{title}{/stash:title}
  {stash:channel}{channel}{/stash:channel}
  {stash:id}{entry_id}{/stash:id}
  {stash:date}{entry_date}{/stash:date}
{/exp:stash:append_list}

```

Template:

```
{exp:channel:entries channel="channel_1" limit="1"}
  {sn_set_fields}
{/exp:channel:entries}

{exp:channel:entries channel="channel_2" limit="1"}
  {sn_set_fields}
{/exp:channel:entries}

<ul>
{exp:stash:get_list name="entries" orderby="date" sort="desc" process="end"}
  <li>{date format="%d/%m/%Y"} from {channel}: {title}</li>
{/exp:stash:get_list}
</ul>

```

As people have suggested, use the multiple channel entries loops so you can take advantage of the limit of 1 per channel. But using Stash, you're able to combine them and control the output of them as if they were one.

Smarter people than me will be able to comment on performance issues with this.
> 1 votes

# Answer
With just the channels entry tag, this can't be done. As you can an imagine, you can tell the tag to pull from two or more channels, but you can't tell it you only want a single entry from channel 'b'. So…

```
{exp:channel:entries channel="news|events" limit="5" orderby="entry_date" sort="desc"}
  {fields}
{/exp:channel:entries}

```

Would get you the five most recent items, but no guaranteed ratio of news vs events. You could use a custom query to pull the items from the database as you like, or as @JasonVarga mentions Stash could be used to pull the queries individually, then group them together.
> 1 votes

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


# Question
Title: In what table in EE1 are banned user IPs stored?
I have a client, using EE1.6.8, that acquired a list of spammer IPs and added the list to Admin \> Members \> Banned Members. I don't know what IPs were in that list, but whatever the case, the front end of the site is now blank and neither of us is able to log in as super admins to undo the change. So I'm looking to go into the database itself, find the offending IP list and remove it. But I haven't managed to figure out in which table this list of banned members would be stored. Can someone point me in the right direction so I can help my client restore his site?

# Answer
> 6 votes
That data is stored in the exp\_sites table in the site\_system\_preferences column in a serialized array.

---
Tags: members, ee1, banned
---


# Question
Title: Logged in member redirected to CP: prompted to log in again
I am using Membrr and have the following process in place:

1. Users sign up using Safecracker Registration
2. Users click on the activation link in their email
3. Users are automatically logged in and redirected to a "choose your membership plan" Safecracker page (using the add-on: http://devot-ee.com/add-ons/member-activation-redirect)
4. For 2 of the membership plans, users are redirected to a Safecracker "profile manager". Users remain logged in and are able to access the profile manager. The profile manager has a check {if logged\_out} to redirect them to the sign in page, if needed.
5. For 1 of the membership plans, users are redirected to the EE control panel (/system/).

PROBLEM: users who picked the membership plan in #5 are prompted to log in at the EE log in page. It's as if they aren't logged in anymore. Users can still log in using the credentials they signed up with, though. Any ideas what might be wrong?

In all cases, once the user selects a membership plan, they are redirected to the "profile manager" template that has the following code:

```
{if logged_out}
    {redirect='/sign-in/'}
{/if}

{exp:membrr:not_subscribed}
    {redirect='/membership-plans/'}
{/exp:membrr:not_subscribed}

{!-- Redirect to EE CP --}
{if group_id == '8'}
    {redirect='/system/'}
{/if}

... profile manager template stuff down here ...

```

# Answer
> 1 votes
It could be that the URL is switching between `http://www.domain.com` and `http://domain.com`.

If this is the case, you need to set a "Cookie Domain" on the **Cookie Settings page**.

> **FROM THE DOCS:**
>
> This preference allows you to set your cookie domain. The vast majority of people will want to set this to:
>
> .example.com
>
> Obviously you’ll use your actual domain name instead of ”.example.com”. Note the period at the beginning as it is very important. Setting the cookie domain like this will allow the cookies to work regardless of whether people specify your URL with the www part or only the http:// part.
>
> If you want to restrict your cookies to a single subdomain then you may set that here as well:
>
> .subdomain.example.com

# Answer
> 0 votes
Is it possible that the page they start out at is an http page, and when they get sent to the control panel they are switched over to https? This could cause them to suddenly not be logged in again.

---
Tags: members, control-panel, safecracker-registration, membrr
---


title: Redactee and Safecracker

text:
# Question
Title: Redactee and Safecracker
I’ve a redactee’s channel field named “messaggio” and this is my code inside the safecracker form

```
<label>Scrivi la tua richiesta*</label>
{field:messaggio}

```

But the result is only a simple textarea and not Redactee How can i resolve it? Thanks

# Answer
> 0 votes
The jquery library must be loaded BEFORE the safecracker form (in the head of your page)

http://ellislab.com/expressionengine/user-guide/modules/safecracker/index.html#include-jquery

---
Tags: safecracker, redactor
---


title: Add HTML5 tags to XHTML field formating

text:
# Question
Title: Add HTML5 tags to XHTML field formating
It looks like the «xhtml»-field-formating in EE 2.5.5 has problems with figure and figcaption. If I write…

```
Lorem ipsum dolor sit amet, consectetur adipisicing elit.

<figure class="quote"><blockquote>bla bla bla</blockquote><figcaption>Willhelm Tell</figcaption></figure>

Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.

```

… into a custom field with xhtml-field-formatting, the following will be rendered:

```
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p><figure class="quote"><blockquote><p>bla bla bla</p>
</blockquote><p></p><figcaption><p></p><p>Willhelm Tell</p><p></p></figcaption><p></p><p></p></figure><p></p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</p>

```

which obviously is everything else than «optimal» ;-)

How can I tell EE to ignore figcaption and figure in «xhtml»-field-formating?

# Answer
I found out that this is actually inside CodeIgniter.

To add new HTML5 tags like `<figure>` and `<figcaption>` to the list of « do not wrap with `<p>` tags», just add them to the array located ~ line 30 of **/system/codeigniter/system/libraries/Typography.php** (the arrays `$block_elements` and/or `$skip_elements`).

I've also added an EE Bug Report for this. The new tags should hopefully be included into future EE releases.
> 3 votes

---
Tags: custom-fields, formatting
---


title: is using entry_id a bad idea?

text:
# Question
Title: is using entry_id a bad idea?
I have a quotes channel, and right now I want to use a specific quote on a specific page of my webiste, so i'm using the code below with a conditional based on the url title. Let's say down the road someone decides they want to change that quote and so they delete entry\_id 21, and create a new entry. Am I correct in assuming that a new entry would be given a new entry\_id and would no longer display on that particular page? If that assumption is correct, should I stay away from the type of code below? maybe use url\_title instead?

```
{exp:channel:entries channel="quotes" limit="1" disable="categories|member_data|pagination" entry_id="21"}
{/exp:channel:entries}

```

# Answer
> 5 votes
I would do this using a 'featured quote' relationship field (either native or Playa depending on whether you want the client to be able to select more than one quote per entry).

# Answer
> 5 votes
Using a specific entry\_id begs for a problem later - I wouldn't. What you can do is create a custom status for that channel and then let the entries tag target that status specifically. Limiting the results to 1 also will help focus on the individual entry; if you add a new entry with the same status, it will take only that last, most-recent version, no matter what the id.

# Answer
> 4 votes
Entry ID's are not re-used, so you are right - if someone deletes that entry and publishes another the code will fail.

URL\_titles are re-created, so if the original entry is deleted and a new one is published with exactly the same title (and hence, url\_title), the code will still work. So url\_title is safer, but still not awesome.

A custom status would work as Holland suggests - I've found that I dislike using custom statuses because once you go outside of the standard ones you have to remember to explicitly specify them everywhere as the channel:entries tag assumes the "Open" status only.

I would consider the relationship-based approach mentioned earlier as well.

Here's a additional thought - if you create a Select Dropdown field you are given the option to populate the field from the contents of another Channel/field in the installation. You could use this feature to grab the quotes from your quotes channel and drop them into the channel with your main pages content. Just keep in mind with this approach your Quotes would not be "dry" - they would end up being stored in 2 different channels. An interesting idea (and using a feature of EE that I've yet to), but probably not ideal.

---
Tags: url-title, entryid
---


# Question
Title: Lots of channels with small number of fields or one channel with lots of fields - efficient?
I am about to extend my site quite extensively. At the moment I have a new channel and a walks channel (I list dog walks!)

I am opening up to creating a directory of dog services and amenities, hotels etc and was wondering what the best way to do this would be.

So far I will be offering listing for several different types of businesses, but although some of them will share certain types of data (i.e. name of business, address, contact details etc, there will be quite a few differences as well.

I was wondering what would generally be considered best practise.

For example,

**Option one** I have channels for: Dog Walkers - this will include name, address, telephone, rates, logo, and description fields. Dog Friendly Hotels - this will include name, address, telephone, logo, website link, gallery amenities and description fields. Pet Shop - this will include name, address, logo, and opening times fields.

**Option two** I create a single channel that includes all the above fields and they are just shown/not shown based on what type of business it is (defined by business type within the category)

My feeling is that its logical to break it down into seperate channels, however I do not really want to do this if its likely to have an adverse affect on performance.

I hope this question makes sense! Any thoughts, pros/cons appreciated.

\**forgot to add that these entries will be added via a safecracker form, and not through the admin cp.

# Answer
If when you say "performance" you mean *system* performance the n it would probably be moot - as no matter what combination of channels and fields you put into EE at the EE database level you are just extending the same tables. In other words one EE channel does not equal one EE/MySQL table.

But by performance you could also mean *Content Manager* performance. If splitting it up makes the task of entering/managing the different content types more efficient then I'd worry about that more than system performance.

Then there is *developer* performance. If you have some field overlap across channels for the basics like address etc then one field group might save some setup time but cost you implementation time as you sort out the different validation and display requirements.

All in all I still prefer to split up different content types into their own channels and fields - it's how EE really "wants to work" and I'd rather play to the expectations of the CMS than work slightly at odds with them (in the form of one big field group etc).
> 6 votes

# Answer
Personally, I would put those into their own channels.

You could certainly have 1 field group between 2 channels and then customise the form on the basis of what you need for that channel.

But I would recommend 1 channel for 1 field group.
> 4 votes

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


title: EE sends duplicate email

text:
# Question
Title: EE sends duplicate email
I have a basic template that I plan on running on a cron job. I have stripped out the unnecessary parts, but the template still sends duplicate emails.

Here is the code:

```
<?php

    $this->EE->load->library('email');
    $this->EE->load->helper('text');

    $this->EE->email->wordwrap = true;
    $this->EE->email->mailtype = 'text';

    $this->EE->email->from($from);
    $this->EE->email->to($recipient);
    $this->EE->email->subject($email_subject);
    $this->EE->email->message(entities_to_ascii($email_msg));
    $this->EE->email->Send();
?>

```

What am I doing wrong? It sends me two emails.

# Answer
> 3 votes
I have come to a solution. There was never anything wrong with the code. I have PageSpeed installed as an extension on Chrome. Somehow this extension was causing the site to load twice or three times, which sent several emails.

# Answer
> 5 votes
When I've had this happen before with regular php mail code, I've used something like this:

```
$sent ="";
if ($sent == '0') {
  $this->EE->email->Send();
  $sent = 1;
}

```

---
Tags: email
---


# Question
Title: Datagrab Issue: Moved to new server and the library has stopped working
Hi all I have been working with the ExpressionEngine Datagrab library by Andrew Weaver for a while now. The library was working perfectly on our first server but then a client purchased a new server and since moving to a new server and domain. Having moved to the new server with the exact same configuration and codebase the library has stopped working. I have been tearing my hair out looking for solutions. I've done some digging and found that the code seems to break down to a certain extent at its **do\_import()** function at this line: **while( $item = $datatype-\>next() ) {**

The reason seems to be that the **-\>next()** property is not accessible. I have tried using **print\_r()** on **$datatype** and it prints out a tonne of information, however using **print\_r()** on **$datatype-\>next()** no info is printed out.

Obviously as it is a paid library I can not post the entire code for the project but I am becoming desparate at this point to find a solution as my deadline is right around the corner.

I have gone as far as to uninstall and reinstall Datagrab but the issue persists. It's important that I stress that nothing else has stopped working on the new server, just this library and the exact same codebase is still fully functional on the old server.

THe PHP versions are the same on both servers also so it shouldn't be anything to do with that. THe only other issue which I had considered to be potentially problematic is that the new site is running from a subdomain at the client's request.

Any input is greatly appreciated!

# Answer
This is now fixed. There was an old URL floating around which I hadn't found, but there were no errors being thrown anywhere which is what was getting me as I was unable to narrow the scope down properly.

Thanks everyone for their help, and in particular @AndrewWeaver for his time and efforts. Top notch support.
> 4 votes

---
Tags: import, datagrab, csv
---


# Question
Title: Control Panel (CP) Link Button is not working
There's a button in the top right corner of every EE install that links to the front-end of the site. On one of my installs it's returning:

```
http:///

```

instead of the site's address.

Where can I change the setting for this button?

If you look at the html it's the anchor inside the "msm\_sites" list item.

# Answer
> 2 votes
That link comes from **Admin → General Configuration** \- the setting named **URL to the root directory of your site**. I'm willing to bet you have "/" as the value there.

---
Tags: control-panel, config, config-overrides
---


# Question
Title: linking a custom field to any entry of your website
Is there a way of linking a custom field to any entry of your website. I've found this add on http://devot-ee.com/add-ons/entry-layout but it's not compatible with matrix. Thanks Geoff

# Answer
> 2 votes
To me it sounds like you might be defining your content too broadly (on a 'page' level instead of on a more atomic 'content' level). However, we still don't know enough to say whether this is the case, and you may just prefer to keep with the page paradigm anyway, so here are some options depending on your use case:

1. Instead of matrix rows, use entries in a separate channel and then use template logic to pull in those entries on the appropriate URL.
2. As above but integrated with Shortcode add-on so that the author can decide where the extra entries appear instead of hardcoding it in template.
3. Take a look at Content Elements add-on. This add-on looks impressive but scares me a lot... (I think you're better off breaking up your content into small tightly defined chunks instead).
4. Write a quick and dirty extension using the cp\_js\_end hook \- This allows you to inject your own javascript into the control panel, so you could probably write something simple that hides the Matrix on all but the right edit page. Could get a bit dangerous for future maintenance.

Also, since the Entry Layout add-on seems to do exactly what you want anyway, it may be worth enquiring as to whether Matrix *is* in fact supported - many add-on developers are over cautious about claiming compatibility if it hasn't been tested... or it could be a simple oversight, or it could also be the case that Devot:ee added that compatibility feature after this add-on was originally uploaded.

# Answer
> 0 votes
I suggest taking a look at the Better Pages add-on. It allows you to choose between different page "types" or "layouts", and will hide/show different fields based on which layout is currently selected for that particular page/entry.

Or, you could simply add instructions for your client to the Matrix field: "(only applies to the XX page)". That solution is quick, easy, and free.

---
Tags: channel-entries, fields
---


# Question
Title: Is there a definitive way to style a Matrix field in a Safecracker form?
I'm using Matrix fieldtypes in a front end Safecracker form and to say it looks terrible would be an understatement... I'm wondering whether there is a definitive guide to styling matrix elements in safecracker / frontend forms?

Does anyone have any tips?

Cheers

Jim

# Answer
Any front-end issues with showing interactive custom fields (aka Playa, Matrix, etc.) should be due to either:

1. Conflicting JavaScript
2. Conflicting CSS (classes/IDs)
3. Missing or corrupt files in the Themes/Third Party folder for the particular add-on

I've used all P&T add-ons as part of a Safecracker form (buffalo.com, getrightmusic.com, iacp.com, etc.) and as Lisa says it should look pretty much the same as the back-end counterpart.
> 2 votes

# Answer
I generally just add {field:my\_field\_name} and the usual P&T goodness you get in the CP comes to the fore.
> 2 votes

# Answer
Jim,

Do you have a screenshot? The front-end matrix forms should look nice, similar to the back-end, in your Safecracker form.

Also, seeing the template code and version numbers would be helpful.

Thank you!

-Lisa
Pixel & Tonic
> 1 votes

---
Tags: safecracker, matrix
---


# Question
Title: Is this the most efficient way to code this?
I have a specific entry I want to display when a user navigates to that particular section of the website. To clarify, I have an "about us" section of a church website where, when the user clicks on "about us" it takes them to the a url "pastors-welcome". From there there are listings in the sidebar for other entries in that channel. I am wondering if the way I have coded this is the most efficient method? I'm new to EE and as with anything new, you just don't know what you don't know. looking to you guys n' gals for the wisdom that comes from experience.

```
{if segment_2 == ""}
        {exp:channel:entries channel="content" limit="1"     disable="categories|member_data|pagination" url_title_path="pastors-welcome"}

            <h1 class="section-header">{title}</h1>
            <p><img class="body-image-left" src="{image:small}" alt="{image_description}" title="{image_description}"/>{page_content}</p>

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

    {if segment_2 != ""}

        {exp:channel:entries channel="content" disable="categories|member_data|pagination"}
        <h1 class="section-header">{title}</h1>

        <p>
        {if image != ""}<img class="body-image-left" src="{image:small}" alt="{image_description}" title="{image_description}"/>{/if}

        {page_content}

        </p>

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

```

# Answer
I've built quite a few church websites with EE over the years.

I'd now use Structure but I did build my first church website similarly to how you did where I had an 'about' template group.

In terms of your channel entries, there's no need for your segment conditional or setting the url\_title parameter. If you're linking to /about/pastors-welcome - by default, EE will look at segment\_2 and load the corresponding entry. **Here's a good explanation by Mr Boyink**.

```
{exp:channel:entries channel="content" limit="1" {gv_param_disable_default}}

<h1 class="section-header">{title}</h1>
        <p><img class="body-image-left" src="{image:small}" alt="{image_description}" title="{image_description}"/>{page_content}</p>

    {/exp:channel:entries}

```

Then in my sidebar I'd have another channel entries tag disabling everything other than the title for that channel and link items via the url\_title\_path variable.
> 2 votes

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


# Question
Title: Safecracker Registration: how to edit Channel entry after registration?
After a member is registered via Safecracker Registration, how do I allow the member to update his/her Channel entry?

Safecracker Registration has the option `edit_member="yes"`, so I created a Safecracker form with the fields I want members to be able to update. The opening tag is something like this:

```
{exp:safecracker channel="members" class="form-horizontal" edit_member="yes" error_handling="inline" id="profile_manager_about_me" include_jquery="no" return="/profile-manager/" safecracker_head="no"}

```

While the member is logged in and submits the Safecracker form, a field error is returned stating that the `email` field is required (it's not one of the fields to be edited).

Is Safecracker Registration's `edit_member="yes"` only supposed to be used when you are also editing member data along with possibly the Channel entry data? How can I edit just the Channel entry data?

Could I use the global variable `member_id` to get the current member's entry in the Channel, then get that result's `entry_id` (there should only be one, I think), then use the `entry_id` as a parameter in the Safecracker tag pair? Seems convoluted?

# Answer
> 2 votes
You need to use the `edit_member="yes"` parameter in conjunction with using the member fields from your registration form. If you don't want those fields, just make this a standard safecracker form and edit your profile entry as normal.

There are several ways you can do it, but my advise would to use hidden form fields to store the values you don't want to be visible. This way, you don't have to workaround any unforeseen limitations you may come across.

# Answer
> 1 votes
In fact I think that the e-mail address field is required, but you can hide it in a hidden field.

---
Tags: channel-entries, members, safecracker, safecracker-registration
---


# Question
Title: How to set the default template group in index.php
I'm running multiple domains/sites with one EE install without using MSM (I don't need the power or complexity and to save licence fees). I have copied the index.php file to the subsidiary domain and edited the Custom Config Values as per instructions.

```
$assign_to_config['template_group'] = 'ocoach';
$assign_to_config['template'] = 'index';
$assign_to_config['site_index'] = 'http://www.xyz.co.uk';
$assign_to_config['site_404'] = 'ocoach/404';

```

I want to have url's like:
domain.co.uk/item/url\_title
domain.co.uk/category/category\_url\_title

I've created a template group called ocoach and templates within in called, index, item, category, 404. I've got seg2cat installed. But I get the 404 page when I use either of the above url's. If I go in and tick the "Make the index template in this group your site's home page?" it all works. But if I want to have multiple domains using different template groups I can't set the default in the EE control panel. I thought that setting it in the index.php file in each domain would override the control panel, but it doesn't seem to make it the default, just the one to use. I've searched around and can't find mention of setting the "default\_template\_group" as a config variable.

# Answer
> 0 votes
This is the answer I'm going for. It works on my server setup which has an open\_basedir restriction. It allows you to have very short url's and does not require a template group as segment\_1.

This was tested on EE 2.5.5, both Core and Full license versions on a shared server hosting package running cPanel.

You need to define some additional global\_vars as suggested by @nonprofit\_tech. You need to do this for the index.php file for every subsite.

```
/* CUSTOM CONFIG VALUES */
$assign_to_config['template_group'] = 'name of default template group';
$assign_to_config['template'] = 'index';
$assign_to_config['site_index'] = '';
$assign_to_config['site_404'] = 'name of subsite template group/404';
$assign_to_config['cp_url'] = '';
$assign_to_config['global_vars'] = array(
'subsite_id' => 'subsite',
'domain' => 'http://www.subsite.org',
'site_name' => 'Subsite',
);

```

Then in the index template of the default template group I used this code to conditionally embed the correct template group and template using the {subsite\_id}:

```
{if segment_1 == "category" AND segment_2 !=""}{embed="{subsite_id}/_category"}
{if:elseif segment_1 !=""}{embed="{subsite_id}/_single-entry"}
{if:else}{embed="{subsite_id}/_home"}
{/if}

```

Then you just create new template groups with the same name as the {subsite\_id} variable. I guess you don't have to use embeds, but whatever method you use, stash, snippets etc. use the {subsite\_id} to customise the call.

# Answer
> 3 votes
You've probably already done some of this, but I'm providing you my process of doing subsites, under EE2 without Multi-Site Manager (MSM).

In the subsite folder's index.php file, I set the following…

```
/* -- Multiple Site Manager --  */
$assign_to_config['site_name']  = 'subsite';
$assign_to_config['cp_url'] = 'http://subsite.org/admin.php';
$assign_to_config['site_url'] = 'http://subsite.org';

```

and then

```
/* -- CUSTOM CONFIG VALUES --  */
$assign_to_config['template_group'] = 'subsite';
$assign_to_config['template'] = 'index';
$assign_to_config['site_index'] = '';
$assign_to_config['site_404'] = '';
$assign_to_config['global_vars'] = array(
    'subsite_id' => 'subsite',
    'domain' => 'http://subsite.org',
    'site_name' => 'My Subsite',
    'googleSearchToken' => 'token',
    ); // This array must be associative

```

Then in config.php I change the following

```
/* -- URI PROTOCOL --  */
$config['uri_protocol'] = "AUTO";

```

to

```
$config['uri_protocol'] = "PATH_INFO";

```

This last switch is a pretty big deal on most of the servers I work on for getting subsites to work properly. I've only worked on our development server without having to switch to 'PATH\_INFO' on all our production servers seem to require it.

The other items seem to be more, as you need them. For example, we don't always allow logging in via the sub site, so mostly the cp\_url points to the main domain.

```
$assign_to_config['cp_url'] = 'http://main-domain.org/admin.php';

```

we always have a few `global_vars` but many sites have none, etc. But the adjustment in the `config.php` file, seems to be the key component to make everything work.

# Answer
> 1 votes
This answer is correct if you have an open\_basedir restriction on your server setup and you can't set the template\_group as the default one. But there is another solution that may work for you and that is in my next answer.

I've now done loads of tests and have come to the conclusion it's not possible to leave out the template\_group from the url unless it is using the default template group.

Each template\_group has the following templates: index \_home \_category \_single-entry 404

For info the simplified index template code I'm using is:

```
{if segment_1 == "category" AND segment_2 !=""}{embed="subsite/_category"}
{if:elseif segment_1 !=""}{embed="subsite/_single-entry"}
{if:else}{embed="subsite/_home"}
{/if}

```

The .htaccess cose is bog standard:

```
#remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$  /$1 [R=301,L]
# remove index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

```

As soon as you add a segment to the url it looks for a matching template in the default template group. So if you set the template group and template in the subsite index.php like:

```
$assign_to_config['template_group'] = 'subsite';
$assign_to_config['template'] = 'index';

```

Then visit subsite.org It will load the index template from the subsite template group, but as soon as you add a segment it looks in the default template group for a template name matching the segment and then loads the main sites template, if there is no template name matching the segment it will load the default template group index template (whilst still displaying the subsite url in the address bar).

I tried adding a template to the default template group (subsite-index) and then changed the index.php to:

```
$assign_to_config['template_group'] = 'mainsite';
$assign_to_config['template'] = 'subsite-index';

```

Again, it loads the subsite-index template when the url has no segments but as soon as you add one it loads the mainsites templates.

The correct domain name is always showing in the browser address bar and plain html files can be called/viewed from either domain.

Studying the James Smith URL schematic closer it does seem to confirm my findings. There is no global variable for default\_template\_group and the database entry in 'exp\_template\_groups' has a field 'is\_site\_default' y or n. Then in numerous system folder files a check is done to establish the template\_group, an example from core.template.php is below:

```
// We we are not enforcing strict URLs, so Let's fetch the the name of the default template group
$result = $DB->query("SELECT group_name, group_id FROM exp_template_groups WHERE a is_site_default = 'y' AND site_id = '".$DB->escape_str($PREFS->ini('site_id'))."'");
// No result?  Bail out...
// There's really nothing else to do here. We don't have a valid template group in the URL
// and the admin doesn't have a template group defined as the site default.

```

---
Tags: templates, url, config-overrides
---


# Question
Title: Expresso:Store - Undefined Property on checkout
I've just doing some final tests before go live and when I complete at the checkout I receive the following error:

```
A PHP Error was encountered
Severity: Notice
Message: Undefined property: EE::$template
Filename: libraries/store_emails.php
Line Number: 68
Fatal error: Call to a member function parse_variables() on a non-object in ~/expressionengine/third_party/store/libraries/store_emails.php on line 68

```

The order completes - as far as to say it's in the CP orders page, but clearly the email function is failing and preventing usual redirect.

All other emails (HTML / Plain Text) work fine, the email debug passes.

I've replaced the default email template with simply {order\_id} and again with just 'test' to rule out any conditions - and I still get the same error.

EE - **2.5.5** / Store - **1.6.2** / Payment Gateway - **None**

# Answer
> 1 votes
Adrian was right... forgot to check our custom module we built that hooks into the checkout process. We corrected the template lib and all is well.

Changed -

```
 $email['subject'] = $this->EE->template->parse_variables($email['subject'], $tag_vars);

```

to

```
 $email['subject'] = $this->EE->TMPL->parse_variables($email['subject'], $tag_vars);

```

As I say, this was a custom module, not Store - so nothing amiss with exp:resso

---
Tags: expresso-store, email, error
---


title: Can't programmatically log member in

text:
# Question
Title: Can't programmatically log member in
Can someone explain to me why I am not capable of forcing a new ExpressionEngine session to be generated for a specific user? I've been following this link: https://stackoverflow.com/questions/13073134/what-is-the-best-way-to-log-a-user-in-programatically-in-expressionengine

What I am trying to do is to temporarily create an EE session, and then to create a channel entry for that logged in user. I can then destroy the session. However, my PHP script seems to fall down when it sees $this-\>EE. Is there something in particular I need to do to initiate the EE variable to begin with?

See my code below. Do I need to place this code in a template or something else?

```
// Get the member's id (the member must have permissions to post entries)
$log_in_id = 23; // conor.higgins@ul.ie - member id //

// Create session
echo 'before new session | ';
$this->EE->session->create_new_session($log_in_id);
//$this->EE->session->create_new_session(23, TRUE);
echo 'after new session | ';
print_r($this->EE->session);
$this->EE->load->library('api');
$this->EE->api->instantiate('channel_entries');

$data = array(
    'channel_name'  => 'members', //[Required]
    'title'         => $tmp_firstname.' '.$tmp_lastname, //[Required]
    'author_id'     => $memberID,
    //'entry_id'        => 0,
    'field_id_37'   => $memberID,
    'field_id_38'   => $tmp_firstname,
    'field_id_39'   => $tmp_lastname,
    'field_id_70'   => $tmp_company,
    'field_id_71'   => $tmp_ref,
    'field_id_73'   => $tmp_qty,
    'field_id_74'   => $tmp_remainder,
    'field_id_72'   => $tmp_owner
);
print_r($data);

$this->EE->api_channel_fields->setup_entry_settings(1, $data);

if ($this->EE->api_channel_entries->submit_new_entry(1, $data) === FALSE){ echo '[ERROR]'; }
else{ echo 'SUCCESS';  $this->EE->session->destroy(); }

```

Any info would be appreciated!

# Answer
> 7 votes
`$this->EE` is referring to the EE singleton object that basically powers everything in EE. You need to reference the global object from memory.

```
$this->EE =& get_instance();

```

If this doesn't work, then be sure you are executing your code within the EE bootstrap (within a module, plugin, extension, library, or some other approved place).

# Answer
> 3 votes
This has now been solved thanks to @Justin Kimbrell. I have just placed the original code I was developing inside an ExpressionEngine template and updated its php preferences. Doing so places the code within the bootstrap as suggested above, and still allows for the template to be call via a URL. In the template I am simply just using the same code as above with a single addition: $this-\>EE-\>api-\>instantiate('channel\_fields');

---
Tags: channel-entries, php, login, sessions, authenticate
---


# Question
Title: Problems using the Italian language pack in the EE control panel
I've got an EE 2.5.5 site and I'd like to be able to set the control panel language to Italian. I've followed the instructions on how to do this from the user guide.

I downloaded the Italian language pack from EllisLab's GitHub account, and I've uploaded the italian folder to system/expressionengine/language/**italian**. But when I set the language from english to italian, I get the following error:

```
An Error Was Encountered
Unable to load the requested language file: language/italian/core_lang.php

```

I have added an issue on GitHub, but not sure if that is being monitored closely by EllisLab so thought I'd post here for help.

Is that language pack out of date (as there's not even a core\_lang.php file within the repository), or do I need to be doing this in a different way?

# Answer
you're getting that error simply because the https://github.com/EllisLab/EE-Language-Italian pack is for EE 1.x versions.

Plus you can download this (though it's not 100% translated) at least it's a Version 2.1.3 https://bitbucket.org/age38dev/eecita/src/87fdcac9ce735f722f4cb182e40f51e42b92b043/2.1.3/EE/language?at=default
> 2 votes

---
Tags: control-panel, multi-language
---


title: Show current category

text:
# Question
Title: Show current category
I have this markup:

```
{exp:channel:entries channel="imagegallery"}
<div class="element {exp:channel:categories category_group="1" channel="imagegallery" style="linear"}{category_url_title}{/exp:channel:categories}">
    <p>Bla Bla</p>
</div>
{/exp:channel:entries}

```

I'd like to add the current category as a class. With this markup all categories are added. But I only want the one from this channel entry. How do I do this?

Thank you

# Answer
> 8 votes
The `{exp:channel:categories}` tag is specifically for displaying a list of *all* categories. You can use the `{categories}` variable pair inside of the `{exp:channel:entries}` loop to get the assigned categories to that entry. You can read more at the docs

```
{exp:channel:entries channel="imagegallery"}
<div class="element {categories backspace="1"}{category_url_title} {/categories}">
    <p>Bla Bla</p>
</div>
{/exp:channel:entries}

```

---
Tags: categories
---


title: index.php and page rank

text:
# Question
Title: index.php and page rank
Does the inclusion of index.php in the URL negatively affect the page rank of each page within an expressionengine site?

Example:

```
www.domain.com/index.php/about-us  vs  www.domain.com/about-us
www.domain.com/index.php/contact  vs  www.domain.com/contact
www.domain.com/index.php/services  vs  www.domain.com/services

```

Do search engines see index.php as the only page?

# Answer
> Do search engines see index.php as the only page?

Definitely not. Google treats it as part of the URL, the same as the other segments. There is no penalty to keeping `index.php` as the first segment.

Even if you were using true query parameters in your URL (`index.php?page=about-us`), Google is smart enough to understand that this is a distinct page from `index.php`. (For example, they even offer a tool to customize how they index sites with URL parameters.)
> 4 votes

# Answer
Not necessarily, Google will index regardless. However, from a users perspective shorter URL's are always better. Stick with with one method and 301 redirect all the old URLs to the new ones so it doesn't affect your rankings.
> 4 votes

# Answer
I'm no SEO expert, but the problem starts happening when www.domain.com/index.php/about-us and www.domain.com/about-us are considered 2 different URLs even if they aren't being linked anywhere else on the site. Both can resolve to the same thing.

I read this:

http://kevinthompson.info/blog/2011/03/04/completely-remove-index-php-from-expressionengine-urls.html

Where if you DO decide to remove index.php that you should have the 1st domain redirect to the version w/o it as opposed to just having the version without it render as normal.

Would like any clarifications or corrections if I am incorrect in my assumptions. :)
> 2 votes

---
Tags: seo
---


# Question
Title: Nested Playa, Matrix and reverse_related_entries
Ok, it'll be a miracle if anyone can help me here, but I have an EE-1 site (upgrading is not an option here) with the following:

```
{exp:weblog:entries ...}
   {reverse_related_entries limit="1"}
      <h2>{title}</h2> <!-- all good so far -->
      {a_matrix_field}
         <p>{a_matrix_column}</p> <!-- still good -->
         {a_playa_field}
            {title} <!-- fail -->
         {/a_playa_field}
      {/a_matrix_field}
   {/reverse_related_entries}
{/exp:weblog:entries}

```

The playa field outputs some garbage along the lines of `{REL[1355][a_matrix_field]AcYdXsrHREL}`

# Answer
> 3 votes
I would just pass the `entry_id` to an embed.

```
{exp:weblog:entries ...}
   {reverse_related_entries limit="1"}
      {embed="some/template" entry_id="{entry_id}"}
   {/reverse_related_entries}
{/exp:weblog:entries}

```

Embed:

```
{exp:weblog:entries entry_id="{embed:entry_id}" ...}
      <h2>{title}</h2>
      {a_matrix_field}
         <p>{a_matrix_column}</p>
         {a_playa_field}
            {title}
         {/a_playa_field}
      {/a_matrix_field}
{/exp:weblog:entries}

```

---
Tags: matrix, playa, relationships, reverse-related-entries
---


title: EE 1.6.x Module Development

text:
# Question
Title: EE 1.6.x Module Development
So I'm returning an array of all the information I need from my function, but I can't seem to figure out how to parse through the array once I get to the template.

Module:

```
Class main{
 function data(){
      blah blah blah
      return $array;
 }
}

```

Template:

```
{exp:main:data}{data}{/exp:main:data}

```

{data} returns “Array”

How can I parse through this in EE code or is there another to parse this variable?

I have also gone down another path which follows:

Module:

```
Class main{
 function data(){
      blah blah blah
      $this->return_user(14);
 }
 function return_user($var){
      return '<p>'.$var.'</p>';
 }

}

```

Template:

```
{exp:main:data}{exp:main:return_user}{/exp:main:data}

```

{exp:main:return\_user} returns `<p></p>`, but not `<p>14</p>`.

Any ideas?

# Answer
> 1 votes
EE 1.7 is pretty old but still fresh in my memory.

You need to use the global object $TMPL, which has a tagdata property that contains the data/string.

Example code

```
function data(){
    global $TMPL;

    $vars = array();
    $vars[LD.'data'.RD] = 'foo';
    $vars[LD.'data2'.RD] = 'foo2';

    $TMPL->tagdata = str_replace(array_keys($vars), array_values($vars) $TMPL->tagdata);

    return $TMPL->tagdata;
}

```

---
Tags: add-on-development, module, ee1
---


title: Index.php Removal Not Working

text:
# Question
Title: Index.php Removal Not Working
I have a site causing me no end of trouble with index.php removal. It works on one host (EngineHosting) but not on another (Liquid Web). I have other sites on the same server at Liquid Web using the same htaccess rule that work fine. By all definition, this should work. Here's the htaccess:

```
# EE 404 page for missing pages
ErrorDocument 404 /index.php?/site/404

# Simple 404 for missing files
<FilesMatch "(\.jpe?g|gif|png|bmp)$">
  ErrorDocument 404 "File Not Found"
</FilesMatch>

#Options +FollowSymlinks
RewriteEngine On
RewriteBase /

# remove the www
RewriteCond %{HTTP_HOST} ^www.sitenameremoved.com$ [NC]
RewriteRule ^(.*)$ http://sitenameremoved.com/$1 [R=301,L]

# Remove trailing slash
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} ^(.+)/$
RewriteRule ^(.+)/$  /$1 [R=301,L]

# Force remove index.php (File and Directory Check)
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]

# Remove IE image toolbar
<FilesMatch "\.(html|htm|php)$">
  Header set imagetoolbar "no"
</FilesMatch>

```

I have tried the RewriteRule with and without a ?, I have ensured that the other rules are working (they are), I have verified that 'Name of your site's index page' is blank, I have removed all other rules and tested, and I have used this same rule on dozens of other sites. Here, however, it does not work.

This site is EE2, non MSM.

What can I be missing?

# Answer
> 9 votes
I went through all the trouble of writing up this question after having sunk hours into this problem, when I took one last look and -finally- something I should have remembered clicked in my head.

$config\['uri\_protocol'\] = ""

That config variable was the trick. If you're having a similar issue, try a couple of common settings for it - AUTO and PATH\_INFO usually work for me.

---
Tags: htaccess
---


# Question
Title: Displaying all products on sale with exp:resso store?
I am wondering if it is possible to show all on sale items with exp:resso store?

```
{exp:store:search search:on_sale channel="products" sort="asc" limit="12"}
...
{/exp:store:search}

```

This is what I've been trying to work with, but it's displaying every product ever entered.

Thanks!

# Answer
> 5 votes
Try setting `search:on_sale="yes"` instead of `search:on_sale`.

---
Tags: expresso-store
---


# Question
Title: Strange filter applied to images by EE uploaded via File Manager - mystery!
I’ve got an EE 2.5.2 site running on Dreamhost which we upgraded a while ago from 1.6.x. Ever since doing so all the images we upload via the File Manager seem to get some weird filter applied to them, and they end up looking like this.

Anyone else experience this problem or have a clue how to solve it?

# Answer
It sounds like you may have a filter enabled for that file upload in the settings. Check to make sure there is not an **Image Manipulation** setting enabled in your File Upload Preferences by accident.

Also, if you are only seeing this image on the frontend and not in the control panel, check to see if you are using CE Image or some other image manipulation code that is possibly changing the image display.

---

**UPDATE:** I suggest that you upgrade to ExpressionEngine v2.5.5 to eliminate a bug in your EE version as the issue. This seems very unique to your server setup and EE install so upgrading EE is the first step.
> 1 votes

---
Tags: image
---


title: Odd Simple Search Results

text:
# Question
Title: Odd Simple Search Results
I'm having odd results with `exp:search:simple_form` and certain keywords. For instance, a search for *1010* returns results with:

1. XP1010
2. 81010
3. 1010

If I add a hypen to the search, *1010-24*, it returns no results? Why is this?

```
{exp:search:simple_form
    channel="not product_options|color_charts"
    form_class="search"
    result_page="search/results"
    search_in="entries"
    show_expired="yes"
    show_future_entries="yes"
    status="not closed"
    where="any"
}

```

# Answer
I just figured it out. I didn't have a matrix field searchable. Updating the settings for that field & column fixed the results. Now, I just need to figure out how to bulk update entries so they get included in the index. Hmmm...
> 1 votes

# Answer
Do you have any entries with 1010-24 in the title? My thought is it's looking specifically for a value of "1010-24" not "1010" "-" "24".
> 2 votes

---
Tags: search, simple-search
---


title: Wiki search leads to 404 page

text:
# Question
Title: Wiki search leads to 404 page
How are wiki search result URLs constructed?

I upgraded from EE 1 to EE 2 a few months ago and I've found what I think is a lingering problem since then: one of my small wikis is returning a 404 page for any search.

This is probably because I do use some extensive URL rewriting, but it seems then that the result URLs must have changed between EE 1 and EE 2, so an example of those would be great to have.

# Answer
> 1 votes
And I found a solution. The wiki templates changed between 1.x and 2.x from using wiki\_home to wiki\_base\_url and since I was still using wiki\_home, I wasn't get a slash at the end of that, which resulted in two segments of the URL running together.

---
Tags: wiki
---


# Question
Title: Sharing content between sites with MSM and Structure
I have a MSM installation that will be powering 3 different sites. One site is essentially a small stand-alone brochure site and is running fine. The other two are Site A - default site w/ most of the content and Site B, a smaller site that is going to re-use some content from A.

The short question is: Is it possible to use Structure and MSM to share content between sites?

Longer details:

All the sites are using Structure to manage pages. In Site B, I have duplicated the channels and Structure layout for this particular page I'm trying to display. I have also duplicated the template wich includes the channel:entries tag:

```
{exp:channel:entries
    channel="businesses"
    limit="1"
    site="default_site"
}

```

The only difference between Site A template and Site B is the `site="default_site"` tag. Everything else in the templates, channels, and entries are the same between sites.

Side note - my navigation templates use a similar channel entries tag (limited to a specific category id) and they display fine. The correct content entries are being displayed in the nav on Site B.

# Answer
> 4 votes
You can share content, but all navigation and page data is site-specific, so you can't call from one into another unfortunately. It's just an EE/MSM limitation.

# Answer
> 0 votes
The solution we have come up with is to use the Playa add-on and link the content that way. This requires us to create the pages on Site B via Structure, but solves the navigation and page-date restriction Travis mentions. This also allows us to add in Site B specific content as needed (another client requirement).

---
Tags: add-on, structure, multi-site-manager
---


# Question
Title: trying to establish "current" class on sidebar link
I have an "About Us" section of my website. I am trying to attach current classes based upon the url. When you click on the about us section of the website, it takes you to a channel entry whose url\_title is "pastors-welcome", and while on that page, the "about-us" template group index page is displayed, so segment\_1 is "about-us" and segment\_2 is blank. If you navigate the pages within the about-us template group, the current class displays correctly because segment\_2 == url\_title, but when segment\_2 is blank, obviously no class will be applied. I basically need a conditional that says, if segment\_2 == url\_title, OR (segment\_1 == "about-us" AND segment\_2 == "blank") then apply this class. I'm not sure if that's a great explanation, but here's my code:

```
{embed="embeds/html_header" page_title="{exp:channel:entries channel="about_us"}{title}" {/exp:channel:entries}}

<ul class="categories">
        <a href="{path=about-us}"><h2 class="section-header">About Us</h2></a>
        {exp:channel:entries channel="about_us" dynamic="no" {gv_param_disable_all}}
        <li><a{if segment_2 == url_title} class="current"{/if} href="{homepage}/about-us/{url_title}">{title}</a></li>
        {/exp:channel:entries}
</ul>

```

# Answer
> 1 votes
ok, I figured this one out:

```
{if segment_2 == url_title || url_title =="pastors-welcome" && segment_2 == ""}

```

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


title: PHP Error when searching in Low Search

text:
# Question
Title: PHP Error when searching in Low Search
When I submit my form, I get these errors in the error page.

```
A PHP Error was encountered
Severity: Warning
Message: array_merge() [function.array-merge]: Argument #2 is not an array
Filename: low_search/mod.low_search.php
Line Number: 312

A PHP Error was encountered
Severity: Warning
Message: array_key_exists() expects parameter 2 to be array, null given
Filename: low_search/mod.low_search.php
Line Number: 331

```

Here is my search form

```
{exp:low_search:form collection="members" secure="no" search_mode="all" result_page="test/low-search-test-results"}
<fieldset>
<label>occupation_status:</label>
<select name="occupation_status" dir="ltr" id="occupation_status">
{exp:low_options:occupation_status}
{options}
<option value="{option:value}">{option:label}</option>
{/options}
{/exp:low_options:occupation_status}
</select>
</fieldset>
<button type="submit">Search</button>
{/exp:low_search:form}

```

and this is my results form

```
{exp:low_search:results}
{if count == 1}<ol>{/if}
<li><a href="{comment_url_title_auto_path}">{title}</a></li>
{if count == total_results}</ol>{/if}
{if no_results}No search results{/if}
{/exp:low_search:results}

```

I am using Low Search 2.1.2 and ExpressionEngine 2.5.5

# Answer
> 2 votes
Looks like you stumbled upon a little bug there.

Try adding at least 1 parameter to the Results tag. In your case, you will need the `query=""` parameter anyway to generate the results from the form submission. The `disable=""` parameter would actually be useful here as well.

I'll get it fixed in the next version.

---
Tags: low-search
---


title: Parametric Search in Low Search

text:
# Question
Title: Parametric Search in Low Search
I have this search form in test/low-search-test

```
{exp:low_search:form collection="foo" secure="no" search_mode="all" result_page="test/low-search-test-results"}
<fieldset>
    <label>Job:</label>
    <select name="job" dir="ltr" id="job">
    {exp:low_options:job}
         {options}
            <option value="{option:value}">{option:label}</option>
        {/options}
    {/exp:low_options:job}
    </select>
</fieldset>
<button type="submit">Search</button>
{/exp:low_search:form}

```

and the results form in test/low-search-test-results

```
{exp:low_search:results}
  {if count ==  1}<ol>{/if}
    <li><a href="{comment_url_title_auto_path}">{title}</a></li>
  {if count == total_results}</ol>{/if}
  {if no_results}No search results{/if}
{/exp:low_search:results}

```

My problem is that the results page does not filter by job.It doesn't even respect the "collections" param in the search form. It returns all results including some channel entries not defined in the collections param.

Am I doing something wrong here? How do I filter results in Low Search based on their Channel Fields?

# Answer
> 2 votes
You need to add the `query=""` parameter to the Results tag so it knows what has been submitted.

Also, if you're searching a specific custom field, use the input name as though it was a parameter in the `channel:entries` tag. For example, this:

```
{exp:channel:entries channel="foo" search:some_field="bar"}

```

Would become this in a Low Search form:

```
<select name="search:some_field">
    <option value="foo">Foo</option>
</select>

```

So, in your case, you'd need to use `name="search:job"` in your `select`-element.

But all of that will be ignored anyway if you don't add the `query="{segment_3}"` parameter to the Results tag (where `{segment_3}` is the reference to the encoded query in the URI).

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


# Question
Title: Using Stash to prepend matrix output to wygwam output
I'm trying to make my press release pages a little more fool-proof so instead of leaving the formatting of the location and date to the user I want to create a location matrix field (they type the city name and choose a state from a drop down menu; states MUST be spelled out hence the dropdown field) and prepend the output of this to the wygwam field that contains the press release content. I'll also add the date from the entry\_date field to this. The output will eventually look something like this:

```
location, state - month day, year - begin press release...

```

I can set the stash without any problems and even output it on its own but I'm not sure how I could go about prepending it to the Wygwam content. In the past I've done this with MX Jumper but it required the addition of some random content at the beginning of the press release that could be swapped out. I'm hoping I can do this with Stash without the need for any extra content in the press release content field. Any suggestions on how this might work?

Update with template code:

```
{exp:channel:entries channel="press_releases"}
    {exp:stash:set name="pr-date-loc"}
        {press_release-location}<strong>{pr-city}, {pr-state} — {entry_date format="%F %j, %Y"} — </strong>{/press_release-location}
    {/exp:stash:set}
{/exp:channel:entries}

{exp:channel:entries channel="press_releases"}
    <h1>{press_release-title}</h1>
    {exp:stash:prepend name="pr-date-loc"}
        {press_release-content}
    {/exp:stash:prepend}
{/exp:channel:entries}

```

# Answer
> 1 votes
You can use the filter parameter to filter the output of a Stashed variable, in this case to remove the opening and closing `<p>` tags. You will need the Development version of Stash (currently v2.3.6) for the following to work:

```
{!-- capture the values --}
{exp:channel:entries channel="press_releases"}
    {exp:stash:set parse_tags="yes"}
        {stash:pr-date-loc}{press_release-location}<strong>{pr-city}, {pr-state} — {entry_date format="%F %j, %Y"} — </strong>{/press_release-location}{/stash:pr-date-loc}
        {stash:pr-content}{press_release-content}{/stash:pr-content}
    {/exp:stash:set}
{/exp:channel:entries}

{!-- output the values, if in the same template that you set the variables --}
<p>
{exp:stash:get name="pr-date-loc" process="end"}
{exp:stash:get name="pr-content" filter="#(?m)^<p>(.*)</p>$#" process="end"}
</p>

{!-- output the values if in an EE or Stash embed --}
<p>
{exp:stash:get name="pr-date-loc"}
{exp:stash:get name="pr-content" filter="#(?m)^<p>(.*)</p>$#"}
</p>

```

---
Tags: stash, wygwam
---


# Question
Title: ExpressionEngine pagination: access last segment
I am working on some search engine optimisation for my ExpressionEngine site. I need to add some link tags into my head to allow Google crawlers to acknowledge the relationship between paginated pages in my blog.

I need to add:

```
<link rel="next" href="http://www.mysite.com/news/latest-news/P10" />

```

to the first news page, then:

```
<link rel="prev" href="http://www.mysite.com/news/latest-news/" />
<link rel="next" href="http://www.mysite.com/news/latest-news/P20" />

```

to the next page, and so on until the final page where I'll add

```
<link rel="prev" href="http://www.mysite.com/news/latest-news/PXX" />

```

I have been trying to achieve this by using the following code:

First news page:

```
{if last_segment == "latest-news"}
        <link rel="next" href="http://www.6dg.co.uk/news/latest-news/P10" />
    {/if}

```

This works fine, but for subsequent pages I have tried this, which does not work as PX is not accessible as a url segment.

```
{if last_segment == "P10"}
        <link rel="prev" href="http://www.6dg.co.uk/news/latest-news" />
        <link rel="next" href="http://www.6dg.co.uk/news/latest-news/P20" />
    {/if}

```

{last\_segment} returns latest-news.

Does anyone know how I can get round this issue?

I also have another issue with this method. Currently I only have 3 paginated pages, but this will go up as more entries are added, so I am not going to know what segment value to target in order to add my final link tag.

Any help will be greatly appreciated.

I am using ExpressionEngine version 2.2.2

# Answer
> 6 votes
Done it!

Using Stash.

In my pagination tags I've added the following code:

```
{exp:stash:set name="total_pages"}{total_pages}{/exp:stash:set}
{exp:stash:set name="current_page"}{current_page}{/exp:stash:set}
{if previous_page}
    {exp:stash:set name="prev_auto_path"}{auto_path}{/exp:stash:set}
{/if}
{if next_page}
    {exp:stash:set name="next_auto_path"}{auto_path}{/exp:stash:set}
{/if}

```

Then in my tag I've added the following

```
{if segment_1 == "news"}
        {if {exp:stash:get name="current_page"} == 1}
            <link rel="next" href="{exp:stash:get name="next_auto_path"}" />
        {/if}

        {if {exp:stash:get name="current_page"} == 2 && {exp:stash:get name="current_page"} != {exp:stash:get name="total_pages"}}
            <link rel="prev" href="/news/latest-news" />
            <link rel="next" href="{exp:stash:get name="next_auto_path"}" />
        {/if}

        {if {exp:stash:get name="current_page"} > 2 && {exp:stash:get name="current_page"} < {exp:stash:get name="total_pages"}}
            <link rel="prev" href="{exp:stash:get name="prev_auto_path"}" />
            <link rel="next" href="{exp:stash:get name="next_auto_path"}" />
        {/if}

        {if {exp:stash:get name="current_page"} == {exp:stash:get name="total_pages"} && {exp:stash:get name="current_page"} > 2}
            <link rel="prev" href="{exp:stash:get name="prev_auto_path"}" />
        {/if}

        {if {exp:stash:get name="current_page"} == {exp:stash:get name="total_pages"} && {exp:stash:get name="current_page"} == 2}
            <link rel="prev" href="/news/latest-news" />
        {/if}
    {/if}

```

**Update:**

I've updated the code to work properly if there is only 2 news pages. Thanks for your help

# Answer
> 2 votes
Perhaps instead of looking for the last variable, you want to check if the page is paginated -- because that's basically what you're looking for, right?

Check: http://devot-ee.com/add-ons/mo-variables

{if paginated}, {if not\_paginated}, {page\_offset} are some variables that he has

{if paginated} would probably work for you and simply check if there's pagination occurring so you don't keep adding last\_segment conditionals.

The tricky part is figuring out how to render what the next page is e.g. P20. You might just want to wrap the {if paginated} conditional with the entries tag and pagination actually will render the next page link.

The problem with that is could be resource intensive (ie. another entries tag just to get the pagination # or url?) Perhaps Stash would be a good way to set the next page URL from the current page body and just use stash get to have it render the next page URL.

Anyone else have a simpler or native way to do this or maybe we can still use Rob's page\_offset? Not sure how it works but I can assume that MIGHT be simpler, even.

Hope that helps? :)

# Answer
> 0 votes
Checkout this thread on devot-ee. Using that conditional worked well for me in paginating a blog archive.

Note, you'll need to use Stash and Switchee ;-)

# Answer
> 0 votes
Try using `{last_segment_absolute}` instead of `{last_segment}` with the **Last Segment extension**.

> This extension will add the following global variables:
>
> * {last\_segment} – last segment (will never be the pagination segment ie /P1)
> * {last\_segment\_absolute} – absolute last segment (even pagination)
> * {last\_segment\_id} – the id of the last segment (for example “3”)
> * {last\_segment\_absolute\_id} – the id of the absolute last segment
>
> If you don’t want to add these global vars you can use the plugin instead:
>
> {exp:last\_segment} will return the last segment. {exp:last\_segment ignore\_pagination=‘no’} will be the same as {last\_segment\_absolute}

---
Tags: pagination, seo
---