# Question
Title: Load stash partials with custom extension
I'm trying to parse markdown files stored on the server, and display them inside EE templates in a nice automatic fashion.

My first idea was to read the files using Stash, then parse them using Smartdown. However, I have run into a problem:

**Stash assumes the files have an extension of `.html`.** If I use this:

```
{exp:stash:get name="index.md" file="yes"}

```

I get the error:

> Stash: the file "/path/to/stash/index.md.html" was not found.

Is there a way to tell Stash not to automatically add the `.html` extension?

Alternatively, is there another easy way to read in files (and cache them)?

# Answer
Sounds like a great idea to me. I've added it to the issue list:

https://github.com/croxton/Stash/issues/31
> 5 votes

# Answer
Stash currently only supports templates with a `.html` extension (mod.stash.php):

```
$file_path = $this->path . implode('/', $file_path) . '.html';

```

\[This answer originally included an untested Stash code tweak which I've removed as Mark's confirmed that it won't work.\]
> 2 votes

---
Tags: add-on, stash, add-on-development, filesystem
---


# Question
Title: setting a global var in an embedded template with PHP
I have a header template with PHP parsing on Input an the following code:

```
<?php
   $this->EE->config->_global_vars['user_language'] = "nl";
?>

```

When I use {user\_language} in my header template it works as expected and outputs "nl".

However, my header template is being embedded in my main template, and when I use {user\_language} over there, it doesn't output anything.

I know it has something to do with the parsing order, but how do I fix it ?

# Answer
> 3 votes
I agree that this is a parse order issue.

It would probably be better for you to set your global variable in the config.php. Not only will this ensure it's set before the templates are parsed, but it'll also prevent you from needing to use PHP in your template, which makes things a bit more secure and efficient.

If you're using the Focus Lab Master Config, there's already a section in config.master.php for global variables that you can just add this to.

Otherwise, it's as simple as adding `$assign_to_config['global_vars']['user_language'] = 'nl';` to your config.php.

You can then use the variable directly in your templates as `{user_language}`

# Answer
> 5 votes
You should do this in an Extension instead - an extension on the sessions\_end hook (which is called near the beginning of every request to the site, just after the Session library has finished loading). You could then create new Global Variables before any template parsing begins, and which would then be available to all of your templates.

Extensions are very simple to write - just a single PHP file. You can use the awesome pkg.io tool to generate a skeleton for you, just select the sessions\_end hook, and it will generate a class that you can fill in with your custom logic.

# Answer
> 1 votes
If it is static for all users, I like the idea of setting it in the config.php file.

If you are setting it differently depending on the user, I highly recommend just creating your own plugin or extension to accomplish the task. It is more efficient, and avoids many (not all) parsing order issues. Once you've done one or two, it's almost as easy as what you are already doing, and you can leave PHP processing off in your templates.

---
Tags: ee2, php, parse-order, embeds, global-variables
---


title: Paid = NO but order submitted

text:
# Question
Title: Paid = NO but order submitted
My only payment method is paypal, but some orders are getting submitted with no payment. How is this possible that an order can be submitted with no payment?

# Answer
> 2 votes
Orders can be submitted without being paid but they will show up incomplete. This allows people to come back and pay for an order at a late date (if there card fails or similar). This also allows for certain situations where you need to authorize only and then capture payments after the order has shipped.

---
Tags: expresso-store
---


title: Store custom errors not working

text:
# Question
Title: Store custom errors not working
I'm trying to use field:billing\_name error:order\_custom1 to generate the error message I've set in Settings \> Order Fields \> order\_custom1 - but the message is not displayed when the field on the front end is left empty.

I have error\_handling="inline" and require="name" set in exp:store:checkout. If it makes any difference I'm using membership on the site.

Have I missed something out?

Thanks! Lee

# Answer
> 4 votes
The mapping in Settings \>\> Order Fields \>\> order\_custom1 would be more for you then the error messages. For example you might have Gender in your template you would want to have something along the lines of:

```
{field:order_custom1}
{if error:order_custom1}Whoa you need to select Male or Female{/if}

```

---
Tags: expresso-store
---


title: Store: Customizing reports

text:
# Question
Title: Store: Customizing reports
**EE v2.4.0 - Build: date 20120123** and it is the **Store 1.5.3** module by **Exp-resso**

I looked through the docs and could not find a specified way to customize reports. Is there a documented way to customize reports?

**We would like to display the tax rule used to calculate the taxes for each order.**

*Just as a side note, if you ever have to work with eCommerce in Georgia, be warned that every single county has their own sales tax rate. Awesome.*

thanks!

# Answer
There's currently no way to change the reports available in the back-end. That said, all of the order information is available to you using the `{exp:store:orders}` tag, so you are free to create any reports you need on the front end. Alternatively, you could create your own simple CP module and pull order details directly from the database.

We're open to suggestions for how to improve this. Feel free to email `support@exp-resso.com` if you want to discuss ways to let users generate their own reports (or what you need to display which isn't covered by the built in reports).
> 2 votes

# Answer
@Adrian Macneil would be the best person to respond, but from my experience, there is not a method to customize what fields, etc. are available within the current set of reports. There are also, no current Store extensions that customize reports, though there are for things like Inventory.

I've been interested in this as well. One of our clients operates a free publication shop. Many of the reports obviously reports on Sales, which we are interested in, but we aren't interested in total amounts in cost, but items, spread, etc.

I was planning on doing some custom queries, but it maybe doable with the API. In fact, in would be lovely if the API allowed people to just add report types and formats to the list of what's available.
> 2 votes

---
Tags: add-on, expresso-store, ecommerce
---


# Question
Title: Using Expresso store and trying to hardcode weight of UPS shipment
I have a large database of products. None of these products have a weight and probably won't have a weight added in for future entries. I do however know what the weight of a shipment will be for all packages.

Is there a way to hard code the weight of the shipment which is passed on to UPS via the UPS shipping module included with Store?

# Answer
> 3 votes
You could simply hard code this in the shipping plugin. You need to remember not to replace this file when you upgrade Store though.

Open `store/libraries/store_shipping/store_shipping_ups.php`, and around line 135 you will find this:

```
// order weight must not be zero
if ((float)$rating_request->Shipment->Package[$i]->PackageWeight->Weight <= 0)
{
    $rating_request->Shipment->Package[$i]->PackageWeight->Weight = '0.1';
}

```

Add this line directly after it:

```
// force weight to 50 lb
$rating_request->Shipment->Package[$i]->PackageWeight->Weight = 50;

```

---
Tags: add-on, expresso-store, ups-shipping
---


# Question
Title: How can I use the current logged in member ID in a custom query using the query module?
I have a query that I need to do that involves using the logged in member ID to limit the results. The following does not work, because the {member\_id} variable is not parsed early enough.

```
{exp:query sql="SELECT ct.title AS title
            FROM exp_channel_titles AS ct
            WHERE ct.member_id = {member_id};"
                }

```

I've tried to pass {member\_id} as an embed as well, but it outputs the actual curly braces again and does not work either:

```
{embed="members/.favorite-query" member_id="{member_id}"}

{exp:query sql="SELECT ct.title AS title
            FROM exp_channel_titles AS ct
            WHERE ct.member_id = {embed:member_id};"
                }

```

I then tried to create a global variable using the session\_end hook. If I hard code the global variable, the query works, but it turns out that the $this-\>EE-\>session array is not available yet when using the session end hook, so I cannot use that method dynamically.

There is a thread on this topic here: http://ellislab.com/forums/viewthread/168569/#804745

I also tried creating a member\_id value using a module tag, but again, the parse order is against me.

Am I overlooking any other options available here?

# Answer
You can use the `{exp:member:custom_profile_data}` tag to access the member's profile information. By default it will use the currently logged-in member.

http://ellislab.com/expressionengine/user-guide/modules/member/index.html#custom-profile-data-tag

As this is a module tag this should now parse the `{member_id}` variable earlier than the `{exp:query}` tag:

```
{exp:member:custom_profile_data}

    {exp:query
        sql="SELECT ct.title AS title
        FROM exp_channel_titles AS ct
        WHERE ct.author_id = '{member_id}'"
    }
    <p>{title}</p>
    {/exp:query}

{/exp:member:custom_profile_data}

```
> 8 votes

# Answer
Mo' Variables adds early parsed member variables. Once you've installed that the following query should work (you want to use `author_id` for the where condition, not `member_id`).

```
{exp:query sql="
    SELECT title
    FROM exp_channel_titles
    WHERE author_id = '{logged_in_member_id}'"
}

```
> 4 votes

---
Tags: members, query
---


# Question
Title: Expesso Store - ratings / reviews add-on?
Expesso Store

Looking to add a ratings / reviews facility for each product in the Store.

Could anyone recommend an EE Add-on that would be suitable & would 'play nicely' with Expresso Store?

Many thanks for your help!

# Answer
> 5 votes
Since Store uses channel entries to store product details, you can use any EE rating/review modules with it.

Some of the more popular options are:

---
Tags: expresso-store
---


# Question
Title: How to prevent specific pages from being moved/deleted within Structure?
I am using the Structure plugin and would like to prevent certain pages from being moved/deleted by certain user groups.

Is there a way to define this with either structure or ExpressionEngine itself?

# Answer
> 2 votes
If you go into the Structure module and click 'Module Settings' at top right, you can set permissions based on member group - it will allow you to set permissions for moving or deleting pages, but it's across board rather than allowing you to choose which pages specifically.

---
Tags: ee2, structure, users
---


# Question
Title: safecracker - how to specify who gets notified on form submission
As the admin of my site, I currently get notified when someone submits an entry via safecracker, but is there a way to specify which other emails or users get notified on submission?

# Answer
> 7 votes
The default functionality using the channel preferences is not very informative for users. Clients almost always complained when I used it. I highly suggest you checkout Postmaster. https://objectivehtml.com/postmaster

There quite a few add-ons to add additional email functionality to EE but none come close to the robust feature set of Postmaster. You can use any email service to send any array of emails at any time.

Postmaster supports things like re-occurring emails, custom email messages made up of other EE tags, post-dated emails, and so much more. It's really the definitive solution for using ExpressionEngine to programmatically send email at really anytime you desire.

Other add-ons that have similar functionality are:

But if you have similar clients to mine, you will find the other solutions inadequate in flexibility and extendibility. Postmaster is definitely a premium solution with over 6 months of development - all the people that currently use it, just love it.

---
Tags: safecracker, forms
---


# Question
Title: Assets file fieldtype does not work in Safecracker (script uses too much memory)
I have a simple safecracker form that allows guests to submit entries to my site. It works fine until I include Pixel and Tonic's Assets module, upon which point, when the browser attempts to load the page (even before submission) - I get an error in chrome stating "script on the page used too much memory".

This is essentially all i'm doing:

```
{exp:safecracker channel="inspirations" return="site/inspiration_submitted"}
    {field:inspiration_image}
{/exp:safecracker}

```

Anyone able to successfully get Safecracker to work with Assets? I'm using the latest versions of both as of today's date, along with jquery 1.8.3.

# Answer
> 3 votes
About a year ago @BrandonKelly, Pixel and Tonic mentioned potentially adding support for using just using the SafeCracker File Upload field to upload to Assets, but I'm not certain if that has happened, as of yet.

There are ways to hide the file browser, using CSS or Javascript, but that wouldn't solve your memory issue, since the script to examine the directory is still triggered, it's just that the results are hidden.

I recommend, if users are ONLY uploading a file to a directory from the front end, switch to either SafeCracker File Upload or the EE File Upload. Looking through the documentation, I don't see any new data on configuring the File Upload to **NOT** display the directory, and that can take a fair amount of memory.

The other option is to, of course, point to a directory with a very small number of resources. For example, create a new file upload area, specifically for the form. Assuming that you won't have 100s of uploads, this shouldn't use as much memory. Of course, if you are expecting 100s or 1000s of uploads, then the same issue will occur, as more applications/forms get completed.

---
Tags: safecracker, javascript
---


# Question
Title: Search not rendering excerpt (or full text)
anyone ever run into an issue with the simple search form where it won't render the excerpt or the full text? I'm using the simple search form from the search module (EE module, not a 3rd party) ... I'm getting results with the title of pages but nothing more.

# Answer
Have you checked the option to make your field searchable? go to admin \> channel administration \> channel fields and select the group and field you want to show up in results and make sure its searchable.

see attached screenshot.
> 2 votes

---
Tags: search
---


title: Lumis IMG Resizer

text:
# Question
Title: Lumis IMG Resizer
I am using the img resizer on a bunch of sites and I had a server upgrade and since then all images will not resize. I think it is connected to a php plugin but am not sure which one I need to enable on my server

# Answer
> 8 votes
Do you have the latest version which is 2.6.4, if not upgrade and see if that solves your issue.

Are you aware that this plugin is no longer in development and that it is effectively abandonware? For a more robust solution that is actively developed and supported by the developer I would recommend CE Image additionally the documentation is second to none making it very easy to use.

# Answer
> 3 votes
Most likely some issue with the GD library. Check for errors for further hints: Image Resizer doesn't output errors but logs them in the Template Parsing Log. You can turn that on in the CP at **Admin****System Administration****Output and Debugging** and switch **Display Template Debugging?** to yes.

(As CreateSean notes, this plugin is basically vaporware. CE Image is fantastic, but there's also ED Image Resizer if you need a free option.)

---
Tags: add-on, image
---


title: Maps solutions for EE

text:
# Question
Title: Maps solutions for EE
I run a website (walkiees.co.uk) that lists dog walks. The site runs by users adding dog walks to the site via a safecracker form.

I have a MX Google Maps field, which the user uses in the safecracker form to mark where a walk is.

This works OK, but I am getting a bit stuck when using the maps data on the site.

After the recent release, I am starting to look at Objective HTMLs Google Maps add-on, as it is certainly feature rich.

What I want to know is:

* Can I export the data (long/lat) from the MX google maps field, to another add-on (Objective HTMLs).
* How can I display all entries on a single map, with links through to the single entry.

Thanks

# Answer
> Can I export the data (long/lat) from the MX google maps field, to another add-on (Objective HTMLs).

You can't really convert the data exactly, but as long as the lat/lng values are stored in individual channel fields in each entry you are do it. The one thing MX Google Maps does that my add-on doesn't do currently is searching entries with multiple locations (without lat/lng fields).

Essentially, MX Google Maps stores an index of these coordinates. My add-on was never structured this way. However, this capability will likely come in some form in the future. For now though, simply structuring your data for 1 marker per entry will work fine.

Example: https://objectivehtml.com/google-maps/examples/search

> How can I display all entries on a single map, with links through to the single entry.

This is relatively easy. You can use the `exp:gmap:marker` tag or the fieldtype tag, whichever you use to setup your entries. Basically use the marker tag if you don't use the FT.

Here is using the `exp:gmap:marker` tag.

```
{exp:channel:entries}

    {exp:gmap:marker id="map" latitude="{your_lat_field}" longitude="{your_lng_field" geocode="false"}
        <a href="/some/path/{url_title}">{title}</a>
    {/exp:gmap:marker}

{/exp:channel:entries}

```

Or here is how to use the fieldtype tag.

```
{exp:channel:entries}

    {your_map_field id="map"}
        <a href="/some/path/{url_title}">{title}</a>
    {/your_map_field}

{/exp:channel:entries}

```

Additional Links
> 3 votes

# Answer
Objective's Google Maps does take decimal longitude and latitude, so you should be able to import than easily from MX Maps (which I'm sure uses similar).

This is how you would show a map with multiple items. PS the examples are pretty good here.

```
{exp:gmap:init id="map" style="width:290px;height:250px;border: 5px solid #f1f1f1;"}

{exp:channel:entries channel="dogwalks"}
    {exp:gmap:marker id="map" latitude="{cf_general_latitude}" longitude="{cf_general_longitude}" open_windows="false" geocode="false" zoom="3"}
        <p><strong>{title}</strong></p>
        <a href="{title_permalink='dogwalks/entry'}">View walk</a>
    {/exp:gmap:marker}
{/exp:channel:entries}

```
> 4 votes

# Answer
Shorn. We are using Objective HTML Google Maps for the same solution as you're looking for in your second question "How can I display all entries on a single map, with links through to the single entry."

We have the following functionality:

1. Map with each single entry indicated by a marker
2. Click a single entry marker to display an info box with single entry title and details
3. Single entry title in the info box links through to the single entry

Our template code is below. I'm sure an expert would be able to trim it down but it is at least working. Note the last line of code, I found that each marker reset the centre point of the map whatever method I used to initially define it in the {exp:gmap:init} tag. My solution was the final {exp:gmap:center} tag to define the map centre after all markers have been loaded.

```
{exp:gmap:init id="map1" scrollwheel="false" zoom="9" map_type="google.maps.MapTypeId.TERRAIN"}

{exp:channel:entries channel="{embed:channels}" disable="member_data|pagination|category_fields" url_title="not {embed:url_title}"}
  {location-map id="map1" parse="markers"}
    {exp:gmap:marker
      id="map1"
      extend_bounds="false"
      icon="/themes/third_party/interactive-map/interactive-map-marker.png"
      show_one_window="true"
      style="width: '200px'"
      latitude="{latitude}"
      longitude="{longitude}"
      infobox="true"
      offsetY="-39"
      offsetX="-3"
      class="ui-infobox-dark"
      category="{categories backspace="1"}{category_url_title}|{/categories}"
      geocode="false"
    }

      <div class="ui-infobox-content">
        <h3><a href="{segment_1}/{url_title}">{title}</a></h3>
          <p>
            {markers}
               {marker:formatted_address}
            {/markers}
          </p>
        </div>

    {/exp:gmap:marker}
  {/location-map}
{/exp:channel:entries}

{exp:gmap:center id="map1" latitude="51.2469449" longitude="0.7"}

```
> 1 votes

# Answer
I'll shed a little light on showing all markers. I've done something pretty similar to this, but I was using Google Maps API v2 and EE1, but fundamentally should be the same.

The best way to do this is to map all the markers to a XML template so Google can read and plot the markers. Create new xml template in EE and add this:

```
<markers>
{exp:channel:entries channel="locations" disable="trackbacks|comments|pagination|member_data" status="Open"}
<marker lat="{google_map}{latitude}" lng="{longitude}{/google_map}" label="{title}" >
<infowindow><![CDATA[  <div class="bubble"> _whatever_ </div> ]]></infowindow>
</marker>
{/exp:channel:entries}
</markers>

```

Then, create a new template that will display the map, read the xml file and plot the markers. Be sure to update the URL to the XML file

```
<div id="map" style="height: 350px"></div>
<noscript>
    <b>JavaScript must be enabled in order for you to use Google Maps.</b>
        However, it seems JavaScript is either disabled or not supported by your browser.
        To view Google Maps, enable JavaScript by changing your browser options, and then
        try again.
</noscript>

<script type="text/javascript">
//<![CDATA[
if (GBrowserIsCompatible()) {
    // A function to create the marker and set up the event window
    function createMarker(point,name,html) {
    var marker = new GMarker(point);
    GEvent.addListener(marker, "click", function() {
        marker.openInfoWindowHtml(html);
    });

    // create the map
    var map = new GMap2(document.getElementById("map"));
    //map.addControl(new GLargeMapControl());
    //map.addControl(new GMapTypeControl());
    map.setCenter(new GLatLng(39.962598,-76.727745), 10);
    map.setUIToDefault();

    // Read the data from example.xml
    GDownloadUrl("http://domain.com/path/to/xml", function(doc) {
        var xmlDoc = GXml.parse(doc);
        var markers = xmlDoc.documentElement.getElementsByTagName("marker");

        for (var i = 0; i < markers.length; i++) {
            // obtain the attribues of each marker
            var html = GXml.value(markers[i].getElementsByTagName("infowindow")[0]);
            var lat = parseFloat(markers[i].getAttribute("lat"));
            var lng = parseFloat(markers[i].getAttribute("lng"));
            var point = new GLatLng(lat,lng);
            var label = markers[i].getAttribute("label");

            // create the marker
            var marker = createMarker(point,label,html);
            map.addOverlay(marker);
        }
    });
} else {
    alert("Sorry, the Google Maps API is not compatible with this browser");
}
//]]>
</script>

```

Again, this is specific to Maps API v2, but with a little tweaking it should come to life.
> 0 votes

---
Tags: add-on, google-maps, google-maps-for-ee
---


title: EE1 to EE2 Upgrade

text:
# Question
Title: EE1 to EE2 Upgrade
In light of the EllisLab news today, I have a couple clients still using EE1. I haven't done any upgrades to EE2 yet so I'm not sure the best way to go about it.

1. Do I use the native upgrade wizard?
2. Do I recreate everything in EE2 and then import the data in?

In your experience, what has been the most practical and efficient? What issues have you come across using any methods above?

Also to keep in mind, this site uses these add-ons:

* Structure
* Field Frame
* Matrix
* Playa
* Wygwam
* File by Mark Hout
* nGen File Field

# Answer
Luckily the add-ons you are using have some upgrade paths from EE 1 =\> 2... The only two you need to tweak are the file fields before and after the upgrade:

1. nGen File Field https://stackoverflow.com/questions/13041491/expressionengine-1-to-expressionengine-2-upgrade-with-ngen-file-field
2. File by Mark Hout http://ellislab.com/forums/viewthread/218268/

Other notes (that have helped me out):

* Upgrade to 1.7.3 before upgrading to 2.X
* Convert all fieldtypes that don't have EE 2 equivalents to plain text fields
* Under 1.7.3 upgrade all add-ons you plan on keeping to the latest EE 1.X versions you can find
* Structure has an upgrade script for EE 1 =\> EE 2. Contact support to grab a copy (or it might be included in the download now)
* BACK UP YOUR DB EVERY STEP OF THE WAY. I use Navicat
* I also backed up files for every major step 1.6.8 =\> 1.7.3 =\> Add-on updates =\> 2.5.X
* During the upgrade I used "tail" to view the upgrade process because I kept havine issues with various browsers: tail -f config.php
* I think FF was the only browser that lets me go through the upgrade process without hanging on the ajax calls (OS X Lion here)
* As soon as EE 2 is upgraded start updating/upgrading your add-ons
* Wait until the site is upgraded to EE 2 to change/add/remove functionality
* Field Editor is your friend

On my last upgrade I had some issues with Gypsy not copying over the custom field formatting settings so if you have issues there start looking at that.

I'm sure I will think of more as I look through my notes. I've done quite a few of these and the only issues that really come up are from outdated and unsupported add-ons.
> 20 votes

# Answer
I've recently done about 8 EE1 to EE2 upgrades. For the most part everything went really smoothly. The key is to prepare and backup, backup, backup. Did I mention you should backup?

Use the native upgrade wizard and be sure to follow the instructions carefully. The download for structure includes a separate folder for upgrading structure 1 to structure 2. It looks scary on the surface but if you follow the instructions exactly everything will be just fine.

My basic procedure with structure is.

1. Any field types that do not have EE2 equivalents should be converted to a basic text field before upgrading. (if you miss one and find it post upgrade, convert it in phpmyadmin then change to correct field type in CP)
2. Upgrade EE1 to EE2
3. upgrade Structure 1 to structure 2 (don't forget to do the prepping step while still running EE1)
4. Then for any ngen fields or matrix with ngen follow the instructions in this SE thread (my answer).
5. Next install any addons you need (remember EE1 addons are not compatible with EE2)
6. find replacements for addons that do not have an EE2 upgrade option with nearest equivalent and then check your template code.

I see that Paulo was typing at the same time as me. He has some addional steps which I didn't need, but will still be worth checking out.
> 10 votes

---
Tags: ee2, ee1, upgrade
---


# Question
Title: Cart Throb - Canada Post live rates errors
Trying to get CPC live rates working and I am getting this error

Couldn't connect to host (7)

I get this on the front end AND the back end. My CPC id has been set up and verified. Doesn't matter if I have test or live set as the status same error.

And when this error shows up I get locked out of the admin section of the site. The ONLY way to get back in is to manually remove the CPC ID# from the database.

IS there anyone out there who has the Canada Post live rates working with Cart Throb? I am getting little help over at the CT forums as shipping plugins are not supported

# Answer
This was solved but opening port 30000 on my server
> 2 votes

# Answer
Canada Post completely changed their e-commerce platform API in June of this year. I know the CartThrob plugin was in development quite awhile before that, and at that, I don't think it was given much attention. So my bet is it was never updated.

I keep meaning to delve into building my own for the new API, as I am in Canada and work with many Canadian clients. But I *mean* to do a lot of things, ha.
> 5 votes

---
Tags: cartthrob
---


# Question
Title: How to generate a list of years dynamically starting with this year
Wondering how I would use either EE or PHP to dynamically generate a list of years starting from this year. I'm doing this for a credit card expiry select box that needed to use EE global variables for the label, which is why i couldn't just use the fields spit back from the gateway. And of course their example code is just a static list starting with 2012, so I'd rather the list be dynamic for say 10 years starting this year. Can someone tell me how to do this?

# Answer
> 3 votes
Assuming PHP is enabled in your template, this should get you started...

```
<select name="credit-card-expiration-year" id="credit-card-expiration-year">
  <?php
   for($i = date("Y"); $i < date("Y")+10; $i++){
     echo "<option>" . $i . "</option>";
   }
  ?>
</select>

```

# Answer
> 7 votes
I wrote a simple plugin to do this and you can also use this plugin (I did not write rangee): http://devot-ee.com/add-ons/rangee

---
Tags: cartthrob, date
---


# Question
Title: How can I send the contents of an entry using the built in communicate module
What I would like to have is a channel entry that will be a monthly newsletter that can be updated each month and then available on the site to view. But that can also be used as the content for sending out to a small mailing list using the communicate module managed within the EE control panel.

In the perfect world I'd like it to be converted to use inline css to reduce problems with some email clients. When I do it manually I use the Mailchimp inliner tool but that's getting complicated for non-techie users.

The Chimper addon by Dukt would probably be perfect and be better for larger mailing lists but the project has been on hold for a long time now.

Any ideas for a simple easy to use solution?

# Answer
> 4 votes
Postmaster can definitely do this provided you use a mailing service, and not using the built-in communication module. You could however write an email service for Postmaster that reused your mailing list vs. deferring to MailChimp or something.

I advocate using MailChimp or CampaignMonitor over another services because sending email is otherwise unreliable. You will find that people simple don't receive some messages, even though the server sent them. PHP doesn't do email very well by default, so it's best to use one of these services. And to use these services with small amounts of email won't cost any money anyway.

Postmaster can handle all your template and allow you to use channel entries to create new campaigns. You can use whatever fieldtypes you desired, so the data entry portion is really great since clients are already use to it. The real challenge in my mind will be how to reuse the native mailing list module. Other users have requested support for it, but to honest, I can't even figure out how it works (and it's not very good anyway). If you decide to go with an email service, Postmaster includes all the tags needed for signup.

While Postmaster may seem like overkill, the template parsing isn't an easy task. All the options and configuration are really what make Postmaster as good as it is. For instance, you could setup Postmaster to send "draft" campaigns when an "open" (default) status, but only send to the real subscriber list with a "Publish" status. The possibilities are endless.

---
Tags: email, html-email
---


# Question
Title: FreeForm 3.1.4: Collection created by guest - how to prevent this
I've got a site using FreeForm 3.1.4 which is having a bit of an issue where guests are creating their own collection by, presumably, manipulating the source before submitting the form. As you can see from the attached screenshot we have several "collections" the ones that should be there are prefixed by HGI. All forms on this site are using honee-pot.

Is there a way to prevent this from happening? Back in February I posted this to the Solspace support forums but it wasn't resolved.

All suggestions greatly appreciated.

# Answer
> 5 votes
I just wrote an extension for you which will let you do this. It's called Post Block. It allows you to specify a set of POST or GET fields which must contain certain values (or not contain certain values). If these conditions are not met, an error is shown and the form submission is blocked.

The condition you'd create in this case would be something like:

```
collection [not in list] contact_us|support|newsletter

```

This looks like this in the configuration:

This add-on will go up on Devot:ee soon, but you can download it directly from my site here.

*Edit*: Devot:ee page is now up.

# Answer
> 1 votes
Is updating to FreeForm 4 an option for you on this site?

A new post in the Solspace forum thread you linked to suggests that FF 4 no longer exposes collection ids via hidden form fields, so should prevent this from happening.

---
Tags: add-on, ee2, solspace-freeform, spam
---


# Question
Title: How do I create a set it and forget it, self updating copyright footer?
If a client is interested in a copyright range in their footer rather than just current years, how can i make this dynamic in EE?

# Answer
I figure this quick little example would help someone so I've asked and answered my own question:

```
Copyright © {if '{current_time format="%Y"}' > "2010"}2010 - {/if}{current_time format="%Y"}. ACME Inc. All rights reserved.

```

This assumes:

a) your start year is 2010 - could be whatever four-digit year you want (since that's what the date comparison is looking for

b) yes, this is a complex conditional - natively it winds up having to be in order to get the format parameter in there. You could probably do this more efficiently with current time as a stashed variable, but i wanted to simply show a basic native approach here first.

c) this will only insert the range IF the current year is greater than the start year. Otherwise, it will only show the current year. Something like this only makes sense if you know for sure the client wants to have a dynamically-set range in their copyright footer.

Hope this helps someone.
> 7 votes

---
Tags: date
---


title: Store: Can I create shipping zones?

text:
# Question
Title: Store: Can I create shipping zones?
In shipping methods, is it possible to setup zones? For example rather that setting up a separate method for ever country in Europe, can I create a single shipping method for Europe and add in the European countries?

Thanks as always!

# Answer
> 5 votes
It's not possible to do using the CP. However, it's possible to write a simple shipping plugin, and group your shipping rules for various countries.

For example, you could put this into a file named `store/libraries/store_shipping/store_shipping_example.php`:

```
class Store_shipping_example extends Store_shipping_driver
{
    /**
     * Calculate the shipping total for an order.
     * Use print_r($order) to see all the fields available to you.
     * The fields available also match those in the Checkout tag:
     * http://exp-resso.com/docs/store/tags/checkout.html
     *
     * @param array $order
     */
    public function calculate_shipping($order)
    {
        $eu_countries = array('uk', 'ie', 'fr', 'de', 'es', 'it');

        if (in_array($order['shipping_country'], $eu_countries))
        {
            return 15.00;
        }
        else
        {
            return 30.00;
        }
    }
}

```

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


# Question
Title: Seeking input for camp registration site
I am looking for some advice for a kids camp looking to take online registrations.

It will require:

1. parents creating a member account
2. Parents adding kids (as channel entries I suspect)
3. Adding Camps (products)
4. Checkout/payment processing
5. Invoice/receipt
6. Tracking kids registered in different camps
7. Parents can use same info next year when registering kids again with the option to edit their kids details.

My first thought was CartThrob but would love some advice if other modules are out there I am not aware of.

# Answer
I build essentially this exact site earlier this year (http://schoolhouseofwonder.org). I followed the structure you laid out - Parents as members, children & camps as channel entries. I used Zoo Visitor to handle member registration, which I find to be the best of the many modules that have recently popped up for that purpose. For the e-commerce aspect, I used Exp:resso Store, although CartThrob would have worked just as well. I wrote my own extension to display camp rosters on the entry edit page, which I have released as VZ Buyers. Otherwise, CartThrob includes similar functionality by way of saving order line-items as channel entries and creating a custom template.

You might also look into the moreEvents module, which sits on top of CartThrob and adds additional registration functionality. I haven't used it yet, but it looks promising.

Feel free to message me if you want to discuss any of this directly.
> 4 votes

# Answer
I did something pretty similar awhile ago, and managed to do it all with EE Simple Commerce. Most of what you are looking to do can easily be managed using the Member module (parents) and normal Channels (camps and children).

Two limitations of using Simple Commerce - it is PayPal only, and you do not get options on the product. If you need more than that, you may well need to go with a full blown cart app.

Good luck!

Roi
> 2 votes

---
Tags: ecommerce
---


# Question
Title: Can I use custom field types for custom category fields?
I have just gone to add some custom fields to my category group when I was shocked to find that there was no way to define a rich text field. There are only several basic field types.

Is there a plugin which adds a richer selection of field types for categories?

# Answer
Editor allows a WYSIWYG for the *category description field* only. Not sure if that will be enough for your needs, but it might be worth looking into.

You can see a picture of what that will look like:
> 6 votes

# Answer
I'm afraid your answer is no.

EE does not make it's custom field types available outside of the Channels functionality and it would be a nice feature to have in other parts of the system such as for Members or some addons like ones that add form functionality.

This is why you see several addons such as Profile:Edit and Zoo Visitor actually create a relationship between the default Member functionality and the Channels, so that you can have more control over managing your users custom fields with the benefits of EE's custom field types.

I have not seen any similar solution for Categories.

Some unsatisfying options to consider:

* Add HTML directly to your Category fields. They may not have a Wysiwyg but they will accept HTML.
* Experiment with the "Default Text Formatting" setting which allows you to modify the output of the category fields with a plugin that you have installed
* Consider creating a channel and using a relationship field instead

Like I said, all unsatisfying!
> 6 votes

# Answer
A number of people have decided to abandon native EE categories and replace it with a combination of Pixel & Tonic's Playa and channel entries.

Playa is an add-on that allows you to create complex (or simple) relationships between entries.

The idea with that is:

* Forget about using EE categories
* Create a 'Categories' channel where each entry represents a category
* Add whatever custom fields you require to the 'Categories' channel
* In the channel(s) that you want to use categories on, create a Playa custom field which references the entries in your 'Categories' channel.

**Edit:**
Mark Croxton has released Tax Playa which lets you use this technique alongside Taxonomy to *really* create a category replacement.
> 4 votes

---
Tags: categories, custom-fields
---


# Question
Title: Get Zoo Visitor members based on category?
Is there a way to get Zoo Visitor members based on their category?

I don't see a category filter option in the `{exp:zoo_visitor:memberlist}` \- tag.
Only a membergroup filter option.

Or should I take another approach?

I also tried working with the `{exp:channel:entries}` tag:

```
{exp:channel:entries channel="zoo_visitor" category_group="2" category="14" dynamic="no"}
    {title}
    {exp:zoo_visitor:details}
        {visitor:member_firstname} {visitor:member_lastname}
    {/exp:zoo_visitor:details}
{/exp:channel:entries}

```

But nothing gets returned.

# Answer
There is a global variable for the categories associated with the currently logged in member. Not quite what you're looking for by the sounds of it though,, but it depends on what you're looking to use the category for:

```
{visitor:global:categories_piped}

```

Hope that helps a little.
> 2 votes

# Answer
In the absence of any other post have you though about using the categories tag pair within the channel:entries tag?

http://ellislab.com/expressionengine/user-guide/modules/channel/channel\_entries.html#id154

Perhaps you could then filter the categories tag on 'show\_group=' and/or 'show='
> 0 votes

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


# Question
Title: How can I create a dropdown menu of child pages from Structure?
I would like to have a select menu for the child pages of a page in a site using the Structure plugin. However some of the pages don't have child pages so they wouldn't need the select menu to display. a) How do I create the select menu so that you will be taken to the child page when you select it in a dropdown and b) what conditional do I use to see if there are any child pages?

Currently I have a nav using:

```
{exp:structure:nav start_from="/{segment_1}/{segment_2}"}

```

Thanks in advance.

# Answer
If I understand correctly the {exp:structure:nav} tag should do what you need. What isn't working for you?

However you might want to look at the structure entries add-on, which allows much greater flexibility.

For example, you can do stuff like this....

```
<ul class="toplevel">
    {exp:structure_entries depth="1" convert_html="true" status="open"}
        {if {entry_id}!='106'}
          <li class="{url_title}{if {current_parent}} parent-here
            {/if}
            {if {current_page}==1} parent-here{/if}"><a href="{page_uri}">{title}</a>
            {if "{title}"=="Blog"}
                    {embed="includes/_subnavblog"}
                {if:else}
                    {if {total_children}>0}
                {embed="includes/_subnav" entry="{entry_id}"}
            {/if}
                {/if}
             </li>
       {/if}
    {/exp:structure_entries}
</ul>

```

So what is happening here?

Firstly we call the structure entries tag pair which will list out the top level of "pages" set up in Structure (hence the depth="1" parameter).

We then do a check to make sure we aren't looking at entry number 106 as we want to ignore that (I can't recall why right now - it just didn't need to be in the nav but was a top level page in Structure.

Assuming it's not entry 106 we then output a list item with the name of the top level page and do a check for using the current\_page parameter to output a css class to mark the current page if needed.

Then we do a check to see if we are listing the blog item - this is the embed to list the blog categories rather than sub-pages.

If we aren't outputting the blog pages then we check to see how many child pages there are to this page. If there are more than 0 then we call another embed which contains another structure entries tag pair, passing the parent page entry id to it.

```
<ul>
    {exp:structure_entries depth="1" parent="{embed:entry}" status="open"
        <li{if {current_page}=='1'} class="here"{/if}><a href="{page_uri}">{title}</a></li>
    {/exp:structure_entries}
</ul>

```

This embed lists out 1 level of structure pages below the parent page as a straightforward list. We check if we are currently on the page concerned by looking at the current\_page boolean again.

Finally we close out all the tags and we're done.

Now, this was done quite some time ago and I have a feeling that much of what I've done here is now part of the {exp:structure:nav} tag pair anyway so I would urge you take another look at that.

From memory that tag will do exactly what you are describing you want. But since you are asking this question I'm assuming it isn't. Could you tell us what it is producing and why it differs to what you need?
> 3 votes

# Answer
To answer your second question of "what conditional do I use to see if there are any child pages?", there are two types.

Firstly, if the child pages are listings there is a global variable in Structure that does just what you need - {structure:is:listing:parent}

It returns 1 or blank for the current page, so you could use:

```
{if structure:is:listing:parent=="1"}
   Do what you gots to do.
{/if}
```

If you're looking for actual Structure child pages, you could use another global variable - {structure:child\_ids}

This should work:

```
{if structure:child_ids!=""}
   Do more of what you gots to do
{/if}
```
> 0 votes

---
Tags: structure, navigation
---


title: Is an add on appropriate for this?

text:
# Question
Title: Is an add on appropriate for this?
I want to have multiple stores using EE to manage their sites and their inventory. The inventory details are quite complex in terms the data model (probably more complex than what Channels can support). Additionally, I want the inventory data stored in a separate database (separate from where EE stores everything); all the stores will be saving their inventory data in this database.

I'd like to take advantage of EE to act as a CMS, but I'm not sure if there is something I can build on top of EE to do what I need. I'm new to EE and have not fully looked into building add ons. Will I be able to do what I want?

# Answer
Actually, I suspect you want to look at e-commerce add-ons to accomplish what you say. There are an amount of these, which you can find via Google or devot-ee.com.

They're the (only) ones which are going to be organized around inventories in the sense you say you want. And all the other features of 'stores'.

This is a complex need, and you want it done right, since if selling is not done on the website, you still want what the seller wants: detail and accuracy.

What you'd do from this basis is simply not show the elements which have to do with purchase. If you can't do it by any other configuration, you could do that via css. But find a way with configuration or template modification, I think, even though the elements wouldn't function without setup.

If you go this way, then when the shop says, 'but we want to sell online after all', you're also ready.

p.s. I actually feel this is a reasonable question as posed - moderators and down-voters may want to think about it, especially as it's a kind of unusual thing to want to do, but not probably one only one developer or customer desires. And it does likely take 'code' to arrange it.
> 2 votes

# Answer
I've built something similar for a motorcycle shop that retrieves all it's catalogue prices from a range of suppliers. I used Cartthrob to build the store on top of EE, but you might also want to try Exp:resso, that has a less steeper learning curve. Concerning inventory: with Cartthrob you can split inventory in a separate table per entry, like different sizes, so there's a range of options there. One thing I discovered is that it does not support backorder functionality, so I was unable to change delivery time on that basis. I haven't looked at Exp:resso about this.

The article options, like sizes, work best with Pixel & Tonic Matrix. Cartthrob has it's own system, but Matrix can more easily be synchronised through csv or xml, using another add-on called Datagrab (with Solspace importer as an alternative, but not for csv to matrix) . So that's what we ended up using.

Not sure if you want to serve the different stores from the same EE install, you would need the Multiple Site Manager to do this.
> 2 votes

---
Tags: add-on, ecommerce
---


# Question
Title: What happens to old Non-Commercial Licenses now that EllisLab doesn't sell these anymore?
Will I still be able to update to the latest versions of EE?

Does anything change?...

Will they require me to upgrade to the commercial version of EE to be able to keep using it?

# Answer
> 18 votes
Any existing non-commercial licenses have been automatically upgraded.

As stated in their blog post ExpressionEngine License Simplification:

> Previous license types have been upgraded for free. Whether you purchased a Freelancer license at $99.95 or a Non-Commercial license at $149.95, if you look at your existing purchases, you’ll see no differentiation. Your purchase has been grandfathered, and you now have the same download and same license as someone who paid $299.95 for the old Commercial license

---
Tags: ee2, license
---


# Question
Title: How to create a custom Widget for the Widgets add-on
I am creating a selection of additional widgets to be used with the Widget addon. The widgets addon detects widgets that are placed into the following directory structure:

```
/third_party/your_addon/widgets/widget_name_1
/third_party/your_addon/widgets/widget_name_2
/third_party/your_addon/widgets/widget_name_3

```

I cannot figure out which type of add-on I need to create:

* **Plugin** \- I do not want to define a custom tag.
* **Module** \- I do not need to create a user interface in the control panel.
* **Extension** \- I do not need any hooks.

# Answer
You don't need to create a full EE addon (ie an extension, plugin or module) just to add an additional widget type to the Widgets addon. Widgets uses its own very simple format for defining new widgets, and rather than creating a new addon you just add a new directory with your widget's code in the widgets/widget directory ie in:

```
system/expressionengine/third_party/widgets/widget/your_shiny_widget

```

Each widget basically consists of a PHP class that extends the base `Widget` class and a couple of views, one for configuring the widget in the CP and one for displaying it when called in your template.

Have a look at the simplest included widget's code and if you know a bit of PHP it should be fairly straightforward to extend it to create your new widget.
> 3 votes

---
Tags: plugin, widget
---


# Question
Title: Possible to "package" a Channel/Template/etc into a module?
I'm still learning EE. It seems easy enough to build something like a custom blog: define the fields I want, assign them to a channel, create templates to output the channel entries. Done.

But let's say I build a blog feature that I want to keep reusing. Is there a way to "package" what I have already created on one site so that it can be installed on another? Perhaps if this was the goal, I should not have built it using the Channels/Templates/etc CPanel in EE -- instead approach it some other way?

Some guidance please.

**Update 1:**

Just a side question: is there a blog addon for EE that's good? It's simple enough to build a basic one, but if someone has already taken the time to give it a lot of thought and do it "properly", I'd rather use that. I would probably want to update the template files to make it use Twitter Bootstrap if it doesn't already.

# Answer
Leevie Graham introduced NSM Site Generator at EECI 2012 in Leiden. It’s an add-on which lets you build themes or reusable modules/packages including channels, custom fields, categories and statuses.

I have not tried it by myself but EE-Garage’s other add-ons are top-notch.

Check out Leevie’s slides from EECI 2012 Europe.
> 4 votes

# Answer
You could create a base install with a database that includes all the channels, fields and templates that you like to use. Simply export the db from your base install and import it into your new project, and you have a site set up with everything set up the way you like.

You could maybe set up different base installs for different types of sites, e.g. one for a blog, or you could include a blog as a part of a larger base install and then just delete it if you don't need it. It depends on how you like to work and the needs of individual projects.
> 3 votes

# Answer
There is not a "blog addon" for ExpressionEngine specifically. Blogs are built with the native channels/fields/categories as needed for your specific project. EE is such that you have a blank slate when you start and you build exactly what you need.

You could build an EE addon that created your channel, fields, templates, etc with the click of a button if you wanted to replicate over and over. An easier approach would be to so a base install and replicate that for each project as needed.
> 2 votes

---
Tags: add-on, add-on-development
---


# Question
Title: How can I prevent all entries from being listed with an arbitrary url?
This is quite a basic question I think, but when viewing a template with entries with the standard entries tag:

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

```

and if I replace the last segment with arbitrary letters, it will show all entries from that channel, like:

```
www.somewebsite.com/mytemplategroup/sdjhkkajsd

```

In a page with regular entries I can avoid this by using `entry_id=segment_2`, but this doesn't work when viewing a category with category titles enabled:

```
http://www.somewebsite.com/mytemplategroup/category_template/category/category_url_title

```

Replacing category\_url\_title with "lzdsfuhkhjfdg" shows ALL entries from the channel. I can't prevent this in the entries tag with

```
 {exp:channel:entries channel="mywebsite" category_url_title="segment_4"}

```

Because that is not supported. So how would you solve this?

Thank you very much!

# Answer
On a single entry page (ie one with a `url_title` or `entry_id` in the URL) you can use the `require_entry="yes"` parameter, by using this in conjunction with the `{if no_results}` conditional, to only show a "proper" page when a valid entry is passed.

```
{exp:channel:entries require_entry="yes"}
  {if no_results}
    {redirect="site/404"}
  {/if}
  <h2>{title}</h2>
  ...
{/exp:channel:entries}

```

For category pages things are a little more complex as you note. I tend to make use of Low's Seg2Cat extension, which provides additional variables in your template of the format `segment_n_category_id`, and perhaps most handily `{last_segment_category_id}` so you can then do:

```
 {if last_segment_category_id == ''}
   {redirect="site/404"}
 {/if}

```

You can then just leave your `channel:entries` tag with the (default) `dynamnic="yes"` and it will pull the relevant entries for the cat from the URL, but redirect to your 404 if there isn't a valid category in the URL.

All that said, rather than using a separate template for category listings I frequently just use the same template for my "list" view as for my category view, eg I have URLs like `example.com/group/template` (list) and `example.com/group/template/category/category_url_title` (category)

I then use Seg2Cat to conditionally output the category name/info in my template if present:

```
{if last_segment_category_id}
   <h1>{last_segment_category_name} News</h1>
   {last_segment_category_description}
{if:else}
   <h1>Latest News</h1>
{/if}
{exp:channel:entries limit="10" channel="news"}
  ...
  entry content in here
  ...
{/exp:channel:entries}

```

That way you have one fewer templates to manage, and you don't have to worry so much about having valid categories in your URL
> 6 votes

# Answer
I'm with @Tom Davies on this one. Require entry, but you can also do so by using

```
url_title="{segment_3}"

```

But make sure you set-up the 'no\_results' option, either to redirect or just a statement on page. But that stops the prevention of random urls. Some bots/spiders do this as well, and you'll see a search engine has tons of erroneous links indexed.
> 0 votes

# Answer
Good answers above, but as an easy first line of defense I also always include a limit in my channel:entries tag--

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

```

That way if it does fail it's a bit more graceful.
> 0 votes

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


# Question
Title: Can I turn a file field back into a text input field?
## In Brief

How can I convert a file fieldtype back to a text input field containing {filedir}filename?

## The long-winded version

I have a file field that I converted from an input field when I was first moving to EE2 and was trying things out. The input field was just the url of the file on the server, so something like {filedir\_11}filename\_here

I don't use any special features of the file fieldtype, and only use the file url as output. There are other input fields used for file urls in this field group that have not been converted, and for those I can use text expander shortcuts to make my life easier, but for the one that is a file type field I have to mouse around and it slows things down for no benefit.

What I would like to figure out how to do is convert the file field back into a text input field and make sure that the field contains {filedir}filename. I'm not shy about running database queries to accomplish this, but I'm not currently familiar enough with how the file fieldtype works to feel confident in trying it, so I'm hoping someone can save me some time.

# Answer
> 5 votes
> How can I convert a file fieldtype back to a text input field containing {filedir}filename?

You can actually just edit the custom field in the Control Panel, changing it from File to Text Input, and you're set. There aren't any further steps needed. The custom field will still contain the same data it did when it was a File fieldtype. Content like `{filedir_1}some_file_name.jpg` will remain intact in `exp_channel_data` after you have changed a field from File to Text Input.

Always good to backup your database before making a change like this, though.

---
Tags: custom-fields, field-conversion
---


# Question
Title: Inserting entries from remote posted XML
I'm trying to post/update/delete entries in a channel by posting XML to a URL.

I've created a module with an action URL that does the processing and uses the Channel Entries API to manage the entries but this requires that I am logged in while I post the data.

My question is how can I post the data from a remote server without needing to be logged in?

Is it possible to authenticate a user by IP rather than logging in or emulate a users credentials from within the module?

Thanks

# Answer
I've done this by securing the ACT id with a token of sorts, then before calling the API to import the data - I simply create a temporary user session for a superadmin.

Example:

```
function login_temporary_user()
{
    if( $this->EE->session->userdata['member_id'] == 0)
    {
        $this->EE->session->create_new_session(1, TRUE);
        $this->EE->session->userdata['group_id']  = 1;
        $this->EE->session->userdata['can_edit_other_entries'] = 'y';
        $this->EE->session->userdata['can_assign_post_authors'] = 'y';
    }
}

```

Then you can just call it like so:

```
$this->login_temporary_user();
...
$this->EE->api_channel_entries->submit_new_entry...

```

This will give your script the privelages it needs to perform insertions and updates if you require.

You could/should of course add additional security in your module to make sure the ACT is being triggered by a trusted source, but will leave that to you to work out. The session variables above should be enough to get you going.
> 8 votes

# Answer
For an example of an existing approach to this you might want to take a look at how the Entry API module ($) handles this. This addon essentially provides CRUD api for channel entries via REST/XML-RPC (it also supports SOAP too if you happen to really hate yourself).

It does use a member (which I's argue is a good thing, as you can then hook into the native permissions to restrict access to just the channels you need) & I'm not certain how it handles authentication, but for $45 it might well provide a leg up to get you to where you need to go.
> 3 votes

# Answer
Have you considered using DataGrab for this?

http://brandnewbox.co.uk/products/details/datagrab

I know you can post and update entries via remote XML.

> Import data from RSS/ATOM feeds, CSV files and XML files. Other datatypes can be added.
>
> Imports can be saved and re-run
>
> Entries can be updated if the source data changes — keep data synchronized

And there is a setting to delete as well:

> Delete old entries
>
> If you check this, DataGrab will delete any entries in the channel that have not been added or updated by this import. This can be useful for maintaining an up-to-date product list, for example, but must be used with care.

You can set saved imports to run via a template and or cron:

http://brandnewbox.co.uk/support/details/running\_imports\_periodically\_using\_cron
> 2 votes

---
Tags: ee2, module, security, xml
---


title: Syncing channel data across servers

text:
# Question
Title: Syncing channel data across servers
We typically have a dev/staging/production setup for sites. We have all the configuration stuff sorted out and deploying from one to another is easy.

The problem is the database, specifically channel data, which contains both structural and user contributed data. Is there a good way to sync channel data when new features are added to the site, without bringing the site down?

# Answer
This is probably the closest thing we have to migrating content between servers. Unfortunately this is has always been an achilles heel of EE (and most CMSs for that matter).

https://github.com/ckimrie/Site-Manager
> 3 votes

---
Tags: ee2, deployment
---


# Question
Title: Member Activation Redirect conflicts with Twomile Login Redirect
The add-ons Member Activation Redirect and Twomile Login Redirect don't play nicely together - has anyone gotten that to work?

It seems like the "welcome" page set under the first extension gets hijacked by the "last page" set with Login Redirect. I've tried setting Activation Redirect to have a lower priority (4) in exp\_extensions, but that didn't help.

Some background from somebody who had the same problem: http://devot-ee.com/add-ons/support/member-activation-redirect/viewthread/6897

Ideas? Thx!

# Answer
I recommend not to use Twomile Login Redirect, we've encountered issues with it in the past, not a very good add-on.
> 2 votes

---
Tags: add-on, members, login, extension
---


title: "Remember Me" functionality

text:
# Question
Title: "Remember Me" functionality
I'm sure that this question/issue has been resolved some way because I've seen it working on sites like devot-ee, but how can I get the 'Remember Me' functionality working for when user login to the front-end of a site?

Thanks in advance.

~ Lucas

# Answer
> 12 votes
If you already have the auto\_login field in your login form and it's just not working, you are probably running into a long standing bug where Remember Me just doesn't work consistently or correctly. Here are two possibly related bug reports:

http://expressionengine.com/bug\_tracker/bug/16355

http://expressionengine.com/bug\_tracker/bug/17423

# Answer
> 9 votes
Add a checkbox with the name auto\_login to your login form

```
<input class="checkbox" type="checkbox" name="auto_login" value="1" /> Auto-login on future visits

```

# Answer
> 2 votes
So this may or may not solve your issue but we were having problems getting this to work for quite awhile and I decided to make my own patch to the EE core files. It only works for my instance but if you can get the general idea if should help you.

The remember me functionality is broken for multi site logins (so this patch will only work for that).

There are two parts that are important for the remember\_me to work.

1. The user needs to have the remember me cookie in their browser with the associated hashed key
2. The user needs to have the remember\_me entry in the exp\_members table filled with the same hash value

The issue with multi site login is that it gives the cookie in the first login and fills the members table with the hash value. It then redirects to do the second (or more) site logins but without the remember\_me input being checked in the form (that is the bug) which causes the remember\_me field in the members table to be wiped out.

Though I believe there is a more elegant solution involving passing the hashkey generated o the first login along with the checked remember me input through to the next logins, I haven't gone that far yet. My solution will solve remember\_me issues for the first site (which is all we really required).

WARNING: It involves modifying core files which I have a lot of experience with. This is sort of an advanced user patch.

Solution:

Add a field to the members table, remember\_me\_timestamp INT(10).

Modify the function start\_session in the core Auth.php file to do a timecheck on when the remember me was filled:

```
        $SITE_MEMBER_ID = $this->member('member_id');

    if(empty($remember))
    {
        $this->EE->db->query("UPDATE exp_members SET remember_me_timestamp = UNIX_TIMESTAMP() WHERE member_id = '$SITE_MEMBER_ID' LIMIT 1");
        // update the remember me column
        $this->EE->db->where('member_id', $this->member('member_id'));
        $this->EE->db->update('members', array(
                'remember_me' => $remember
        ));
    }
    else
    {
        //check previous remember me time

        $SITE_remember_time_query = $this->EE->db->query("SELECT remember_me_timestamp as lastRemember, UNIX_TIMESTAMP() as currentTime
        FROM exp_members WHERE member_id = '$SITE_MEMBER_ID' LIMIT 1");

        $SITE_remember_time = $SITE_remember_time_query->row('lastRemember');
        $SITE_current_time = $SITE_remember_time_query->row('lastRemember');

        $SITE_more_than_one_hour = ($SITE_current_time - 60*60) > $SITE_remember_time ? TRUE : FALSE;

        //if no last remember time then just let clear the remember me field, else don't touch it
        if(empty($SITE_remember_time) || $SITE_more_than_one_hour )
        {
                // update the remember me column
            $this->EE->db->where('member_id', $this->member('member_id'));
            $this->EE->db->update('members', array(
                    'remember_me' => $remember
            ));

        }

    }

```

That was the code I added to the start\_session function. Replacing:

```
            $this->EE->db->where('member_id', $this->member('member_id'));
        $this->EE->db->update('members', array(
                'remember_me' => $remember
        ));

```

The idea is that when it does the first login, it has the remember me post data filled so it inserts the key, sets the cookie and also inserts the timestamp. On subsequent site logins (which happen consecutively in a small span of time) if the remember me post data is empty (which it will be because of the bug) then it checks the timestamp to see if an hour has past since the last remember me (really it could be like 10 seconds). If the time limit hasn't been passed then it won't blank out the remember\_me field in the members table.

Hopefully this helps some people but considering the skill level usually required to edit core files, I would prefer to see ellislabs make an actual patch (they could have by now I suppose, I just don't updated because of all my custom edits).

---
Tags: ee2, login, core
---


# Question
Title: How to send email to admin if no_results?
I have a page that lists programs people can donate to for a non-profit. This list is updated from a separate database. The current flow takes the entries offline via using Solspace Import to mark them closed, then a second import will edit or add new entries. Those that are still active are then marked open and the list is once again live and ready for people to use.

However, things can and do go wrong. We would not want this list to be blank. I currently have a notice in the no\_results tag that asks the user to email the admin if they see that message. A preferred method would be to have the system send an email if the no\_results tag is displayed.

Any ideas how to implement this or something similar? Anything that lets us know the list is blank will work.

# Answer
Take a look at **Email-from-Template**.

> This plugin sends its tag contents in an email (with or without echoing that content back to the template).

By placing it in a template, and inside a conditional if necessary, you can trigger an email to be sent as needed.

Example Usage:

```
{exp:email_from_template to="admin@ee.com" from="server@ee.com" subject="Hello!" echo="off"}

   This tag content is being viewed at {uri_string}.
   Sending notification to {to}.

{/exp:email_from_template}

```

I did a quick test and if you wrap something similar to the above example in a `no_results` conditional it works perfectly. Should be just what you need to send an email when there are no results.
> 6 votes

# Answer
There's an addon Encaf 404 Email which is pretty close to what you need. It is triggered on a 404 error. If you know php perhaps you could use that add-on as a guide on creating your own plugin to achieve what you need.

Another possibility is Postmaster, though I'm not sure that it will do what you need either.
> 2 votes

---
Tags: channel-entries, email, no-results
---


# Question
Title: How to Send CartThrob Custom Data To Campaign Monitor At Checkout?
We currently can successful send the name and email fields to Campaign Monitor by this addon:

https://github.com/CartThrob/addon-mailing\_list

By adding this field to our checkout form:

```
<input type="hidden" value="list id goes here" name="custom_data[campaign_monitor]">

```

Is there a way to send custom fields or an other fields to CM aswell?

IE. Fields like:

```
<select id="custom_data[order_gender]" name="custom_data[order_gender]">
  <option value="">please select</option>
  <option value="m">Male</option>
  <option value="f">Female</option>
</select>

```

OR

```
<input type="text" id="address" name="address" value="{address}" placeholder="Street Address" class="placeholder">

```

OR

```
<input type="text" id="custom_data[order_date_of_birth]" name="custom_data[order_date_of_birth]" value="{custom_data:order_date_of_birth}">

```

# Answer
Looking at around line 114 of the source of the CT Mailing list extension, it looks like the addon adds the content of the `['campaign_monitor']` key of `$this->EE->cartthrob->cart->order('custom_data')` as part of the request to CampaignMonitor. The contents of this can be either a String or an Array, which suggests it's designed to permit multiple values to be sent to CM.

***Quick aside:** I find the CT docs are a little confusing as the suggest that when adding custom data to **orders** you can just use your custom field name name in your template rather than as `custom_data['field_name']` the way you would for custom data on the save member form (though your custom field does need to exist in the back end for data to be saved). However looking at the source (Carttrob\_core\_ee.php, ~ line 548) I don't think you'd then still able to access these values via `$this->EE->cartthrob->cart->order('custom_data')`. I could be wrong though.*

I haven't had a chance to test that I've got the syntax right, but it looks to me like all you may need to do is add the relevant fields to your order via the checkout form, namespacing your values under `campaign_monitor[]` (assuming you want to pass multiple values), so I *think* you either need

```
<input type="hidden" name="custom_data[campaign_monitor][custom_value_1]" value="{my_value_1}" />
<input type="hidden" name="custom_data[campaign_monitor][custom_value_2]" value="{my_value_1} />

```

or perhaps (but less likely):

```
<input type="hidden" name="campaign_monitor[custom_value_1]" value="{my_value_1}" />
<input type="hidden" name="campaign_monitor[custom_value_2]" value="{my_value_1} />

```

You can then set whatever data you need to send through to Campaign Monitor in your template.

If your data to send to CM always comes from the customer, you could probably also add the data via a simple custom extension using the `cartthrob_save_customer_info_end` hook, but I'd probably start by just outputting the values in the template (or reading them from other user inputed fields on the fly with JavaScript) as it's probably faster to try out.
> 1 votes

# Answer
One option is get Postmaster v1.2 when it comes out. I spent more 9 months analyzing problems from clients and how to better implement notifications with any email service.

Here is the original release https://www.objectivehtml.com/articles/read/postmaster-the-definitive-email-solution-for-expressionengine

v1.2 is coming in the next week or two, but happy to setup anyone up with the beta that has a license. v1.2 will feature CartThrob compatibility out of the box, for both checkouts and subscriptions. You can use EE tags to compose your email, html or plain text, whatever you need. There are even additional variables passed to the templates that CT doesn't even support. So to be clear, you can send emails with any service when a user checkouts. The hooks are there for failures and declines, but I didn't include that functionality by default. Among CT, Postmaster will work with any EE hook. Developers can include advanced support for their add-ons do really anything they want.

v1.2 will also open the extremely robust API's to the public with great documentation that I have also spent a lot of time improving.

Email support\[at\]objectivehtml.com if you have any project specific questions.
> 1 votes

---
Tags: ee2, cartthrob, email
---


# Question
Title: How can I check if an event is currently happening with Solspace Calendar?
I am putting together a site full of events. Some events are recurring (monthly, daily, yearly), others are one-time events that can be one hour to sometimes three days long. I would like to call out that they are currently happening, have happened or will be happening. What is the best method to do so?

Looking for the functionality as such:

```
{exp:calendar:cal event_id="{entry_id}"}
    {if event_is_over}This Event is over{/if}
    {if event_is_happening_now}This Event is Currently Happening{/if}
    {if event_will_happen}This Event Will Happen{/if}
{/exp:calendar:cal}

```

As an aside, the "event will happen" has a javascript countdown timer. Not critical to the answer, but putting it out there.

# Answer
> 2 votes
Updated my answer to reflect your expanded question.

I tested these conditionals inside both the `exp:calendar:cal` and `exp:calendar:events` tags and it works as expected. I did not test it with recurring events, though.

```
{if {event_end_date format="%U"} < current_time}
    event is over
{/if}

{if event_start_date < current_time AND {event_end_date format="%U"} > current_time}
    happening now
{/if}

{if event_start_date > current_time}
    will happen in the future
{/if}

```

Not sure why the format parameter was required on `event_end_date`, but without it the tag wasn't parsed. I tested this with Calendar 1.7.0.

# Answer
> 0 votes
I'd just use `{exp:calendar:day}` unless you need to do some strange formatting. This will grab any event happening on the current day and display it. Solspace has some examples of the use if the day tag in their documentation.

---
Tags: conditionals, solspace-calendar
---


# Question
Title: How to create front end AJAX handler which validates and adds comment to content?
I am attempting to create a "Leave Comment" form which is loaded by AJAX on demand and then shown using a jQuery popup. There are three motivations for this:

* Less clutter on page.
* Reduced automated spam.
* Faster page load time (with caching enabled the page load time goes from 400ms to 120ms when the comment form is not included in the article template).

Here is what I have currently:

I have created the following template which is called `ajax/blog-comment-form`:

```
{exp:comment:form channel="blog" entry_id="{segment_3}"}
{if logged_out}
    <label for="name">Name:</label> <input type="text" name="name" value="{name}" size="70" /><br />
    <label for="email">Email:</label> <input type="text" name="email" value="{email}" size="70" /><br />
    <label for="url">URL:</label> <input type="text" name="url" value="{url}" size="70" /><br />
{/if}

    <label class="outline" for="comment">Comment:</label>
    <textarea name="comment" cols="70" rows="7">{comment}</textarea>
    <div class="comment-note">Note: HTML tags are not supported.</div>

{if captcha}
    <div class="captcha">
        <label for="captcha">Please enter the word you see in the image below:</label>
        {captcha} <input id="captcha" type="text" name="captcha" value="{captcha_word}" maxlength="20" />
    </div>
{/if}

    <div class="button-strip">
        <input class="ui-pink-button" type="submit" name="submit" value="Submit" />
    </div>
</div>
{/exp:comment:form}

```

I am currently using the following JavaScript to submit the form via AJAX. This is almost working except there is no way to display error messages when inputs are entered incorrectly.

```
form.find('input[name="submit"]').click(function() {
    $.ajax({
        type: 'POST',
        url: form.attr('action'),
        data: form.serialize(),
        success: function(data) {
            // ???
        },
        failed: function(data) {
            // ???
            // this never seems to actually occur
        }
    });
    return false;
});

```

# Answer
**TL;DR:** You're binding a callback to the wrong `$.ajax` option, but that isn't enough to fix this: I would use the Ajax Babble addon and get on with your day, as this problem turns out to be more complex than it looks. While you could do client side validation as Anna suggests, there are all sorts of other error conditions not related to request content that you can't validate client side, such as requiring an IP, minimum time between comments etc.

Anyway if $35 is too much for your budget then by all means read on...

### The long answer...

*Sorry this is so long, but I had a little time on my hands...*

The first reason that your `failed` callback is never called is `failed` is not the name of the `$.ajax` option that you want, you want `fail` (jQuery 1.8+) or `error` (pre jQ 1.8).

However, even if you change that, the callback still won't fire because of the fact that the ajax request is returning successfully (ie an HTML response with a `200` HTTP status code), it's just that the response is an EE error page, rather than an error code. jQuery doesn't understand the content of that page, so unless it returns HTTP error code such as a `403` or `500`, which it doesn't that code will never run.

Before we get to the non-addon route to solving this, a few jQuery/JS notes:

**You should bind to the forms `submit` event, rather than a click handler on the submit button**, as forms can be submitted without clicking (keyUp/JS triggered submit etc).

**Use** `event.preventDefault()` **instead of** `return false`, as doing the latter from a jQuery event handler is the equivalent of calling both `event.preventDefault()` **and** `event.stopPropagation()`, the latter of which which stops the event from bubbling.

You may want to do this, but if so do it explicitly to avoid debugging headaches with delegated events:

```
$('form').on('submit', function(e){
  //the first argument passed to the event handler is the jQ wrapped event object
  e.preventDefault();
  //handle event here
}).addClss

```

**Consider using jQuery deferreds instead of passing callbacks as options to `$.ajax`**. It makes your code easier to read and you can register callbacks where it makes sense rather than where `$.ajax` wants you too. You can even register callbacks on requests that have already returned (in which case they execute immediately):

```
$('form').on('submit', function(e){
  var req = $.ajax({...}); //returns a jQ deferred object

  e.preventDefault();
  ...
  req.done(function(){
    //handle success
    alert('yay!');
  })
  .fail(function(){
    //handle error
    alert('boo!');
  })
  .always(function(){
    //fires when request done whether successful or not
    alert('finished!');
  });

});

```

## Enough already, how do I roll my own Ajax comment submission?

Okay so, if you *really* want to go down the route of rolling your own for this one, you're going to need to parse the response in some way (such as by looking for an `id` on the `body` element of the message template) and then extract the message:

In your system message template:

```
<body class="system-msg">
  <div class="system-msg-content">
    {content}
  </div>
</body>

```

In your jQuery:

```
//not tested, may need tweaking
req.done(function(data, status){
  var $data = $(data),
      msg = $('<p class="msg"/>'),
      msgContent;
  if ($data.find('body').hasClass('system-message')){
    //handle error message
    msgContent = $data.find('.system-msg-content').html();
    $msg.html(msgContent);
    $form.prepend($msg);
  }
  else {
    //do normal success stuff here
  }
})

```

You could even use the Custom System Messages addon and Mo'Variables to use a regular template for your error and then detect an ajax request and return a differently formatted response (or even an error code, in which case you *can* use `fail()`)for consumption by your jQuery.

**But to be honest, I wouldn't do any of that** unless you don't really value your time or you enjoy the challenge, instead I'd stump up $35 for Ajax Babble and go home early instead.
> 3 votes

# Answer
Here's a simplified version of a contact form I coded last week which might work for you. Since my potential "errors" can be checked with validation I make sure everything is correct before submitting the form. Your validation can be much more complex if needed obviously.

```
$("#contact-form .submit").click(function(){
    var url = $("#contact-form").attr("action");
    var email = $("#contact-form #email").val();
    if (email == ""){
        $("#contact-form .error").show();
        return false;
    }
    $.ajax({
        type: "POST",
        url: url,
        data: $("#contact-form").serialize(),
        success: function(data){
            if (data.success == true){
                $("#contact-form .success").show();
            }
        }
    });
    return false;
});

```

---

Can I assume from your code example that you are want to trigger the error for incorrect captcha data? If yes, you may consider switching to **Snaptcha** for spam protection. It's invisible captcha and may work for what you are doing. One less thing the user needs to enter.
> 1 votes

---
Tags: templates, ajax, comment-form
---


title: Customizing Private Messaging Pages

text:
# Question
Title: Customizing Private Messaging Pages
I'm looking for a way to easily customize the look of the core EE Private Messaging functionality. I know that there are add-ons out there that open up some of the functionality, but I would really like to utilize as much of the core functionality as possible. I've found the templates in the 'themes' \> 'profile\_themes' directory, but is there any documentation or anything out there on how to actually customize this? Anyone out there have experience doing this?

Thanks in advance.

# Answer
Sorry to be the bearer of bad news, but unfortunately working with the default member profile templates really is a massive, massive pain. Hence the large number of member related addons out there.

About the only plus point is that they are saved as files unlike the system message/speciality templates, but otherwise the documentation really is next to non-existent as you've no doubt found, and the default templates are an ugly mess of layout tables and inline JS with no clear structure that I personally doubt has been touched much since they were ported from EE1.

Previously I would have sent you to the EE wiki, in which the community had tried to plug this particular void, but helpfully EllisLab pulled the wiki as part of their recent redesign. Here is a google cache link, not sure how long it will work for though. You can get more (possibly relevant) stuff from Google's cache of the wiki here

When I last built a serious membership-based site on EE I lasted lierally about an hour before I bought Solspace User (I didn't need private messaging for that site though) and I'm so glad I did. Using native functionality where possible is absolutely a good idea to aim for, but in this instance it really is a world of pain.
> 2 votes

---
Tags: members, core, themes
---


# Question
Title: Can I use category_group to relate groups with Stash's context?
I cannot seem to get this to work. Can stash utilize {category\_group} as a context variable?

```
{!-- Premium Member Feed --}
{exp:channel:entries channel="dba_member" status="premium" orderby="random" dynamic="off"}
    {exp:stash:append_list name="thumbs_list" context='{category_group}'}
        {stash:thumb}{snippet:members_thumbs}{/stash:thumb}
    {/exp:stash:append_list}
{/exp:channel:entries}
{!-- /Premium Member Feed --}

{exp:stash:set name="mainContent"}
    <h2>Featured Businesses</h2>
        <div class="row">
            <ul class="box-grid">
                <h3>Dining</h3>
                {exp:stash:get_list name="thumbs_list" context='3' limit="3"}{thumb}{/exp:stash:get_list}
                <h3>Nightlife</h3>
                {exp:stash:get_list name="thumbs_list" context='2' limit="3"}{thumb}{/exp:stash:get_list}
                <h3>Shops and Services</h3>
                {exp:stash:get_list name="thumbs_list" context='5' limit="3"}{thumb}{/exp:stash:get_list}
            </ul>
        </div>
{/exp:stash:set}

```

Also then, if possible, how can I limit or "get" 3 of each {category\_group} these without stashing hundreds of entries or will there not really be a performance hit? I was thinking if I limited the channel entries to "9" that it may not fetch 3 in each context of the stash list.

```
{exp:channel:entries channel="dba_member" limit="9" status="premium" orderby="random" dynamic="off"}

```

# Answer
I think you could use `{categories}{category_group}{/categories}` inside your context like so:

```
{exp:stash:append_list name="thumbs_list" context='{categories}{category_group}{/categories}'}

```

Another possible option:

You could rid yourself of Context all together but, still use the category\_group setup I mentioned yet, this time in a Stash var. Then do a match against in your get\_list.

For example in your Stash append\_list you would have something like this:

```
{exp:stash:append_list name="thumbs_list"}
    {stash:thumb}{snippet:members_thumbs}{/stash:thumb}
    {stash:this_category_group}{categories}{category_group}{/categories}{/stash:this_category_group}
{/exp:stash:append_list}

```

And in your view you would have this for each item:

```
<h3>Dining</h3>
{exp:stash:get_list name="thumbs_list" match="#^3$#" against="this_category_group" limit="3"}{thumb}{/exp:stash:get_list}

```
> 1 votes

---
Tags: stash, category-group
---


# Question
Title: How can I display a code example (HTML plus EE-tags) in my blog post
In my blogpost (SE-page) I want this code to be treated as text and not as code since I want to show it as an example.

```
<a href="http://{exp:low_replace find="http://"}{linklist_url}{/exp:low_replace}
"target="_blank">{title}</a>

```

I wrapped it in `<code></code>`-Tags, but it didn´t work. It renders to

```
<a href="http://{linklist_url} "target="_blank">Im the actual title of the entry</a>

```

and the source is

```
<code>
<a href="http://{linklist_url} "target="_blank">Im the actual title of the entry</a>
<br>
</code>

```

When I use the EE tag `[code]` while entering the text in the CP I have the follwing in my Matrix TinyMCE field:

```
[code]<a href="http://{exp:low_replace find="http://"}{linklist_url}{/exp:low_replace} "target="_blank">{title}</a>
[/code]

```

When I submit my blog entry in the CP I see a nicely formatted and colorcoded string on the "view entry" page.

When I let EE the page render I see

```
[code]<a href="http://{linklist_url} "target="_blank">Im the actual title of the entry</a>
[/code]

```

Same case as above. EE renders the {title} field and low\_replace. The only difference is, that I have the surrounding `[code]` tags.

Why do the low\_replace add-on and the {title} get rendered and how do I stop this?

EDIT: Removed the part with Allow EE, since it led to confusion and edited the title for clarity.

# Answer
EE has a native code formatting feature which is essentially a wrapper for highlight\_string. Just use `[code]` tags to trigger it. For example this:

```
[code]
$foo = 'bar';
[/code]

```

Will output the following markup:

```
<div class="codeblock"><code><span style="color: #000000">
    <span style="color: #0000BB">$foo </span><span style="color: #007700">= </span><span style="color: #DD0000">'bar'</span><span style="color: #007700">; </span>
</span></code></div>

```

You can choose your own colours by adjusting various PHP INI directives. For a live example of this see my addon documentation.
> 3 votes

# Answer
On my blog (example post here) I'm using GWcode SyntaxHighlighter in combination with wygwam. Basically I write my post as normal and any code I want I then use the "code" button in wygwam and voila beautifully highlighted with line numbers.
> 3 votes

# Answer
You need to encode all your curly braces in your code samples to make sure they aren't parsed by EE at some point.

Use `{` for `{` and `}` for `}`.

Some EE WYSIWYG editors will do this for you in code blocks, but you'll have to check the source to be sure.
> 3 votes

# Answer
I had pretty much the same issue with the Rich Text Editor module, and got round this issue by embedding a GitHub Gist instead, which works very well except for that when you go to edit a previously saved channel entry, you have to paste in the JavaScript embed code again.
> 2 votes

# Answer
**Loading a whole template file without parsing it**
Check out Template Code by rob-sanchez.
It should get you what you want.

**Show data from entry-fields unparsed**
This is how EE works by default. Nothing from Entries is ever parsed.
Allow EE Code enables this for you.

If you enter "some {type\_tag} with {number} tags in it" as the value of a field in an entry it should show up as "some {type\_tag} with {number} tags in it".

But if you use Allow EE Code you get "some {value of type\_tag} with {value of number} tags in it" If there are nothing matching your custom tags the tag itself should be displayed.

**Replace every special-char with its html entity**
As i mentioned in the comment below, Checkout EEncode it should run everything in between its tag through html\_entities.
> 1 votes

# Answer
You wouldn't want the {allow-decode} plugin, since that would do as you expect, allow the ee code to be rendered.

You have two issues here. You have ExpressionEngine code/tags and html/xhtml code tags. Obviously, an entry into EE will allow for html/xhtml to be rendered. So

```
<a href="http://{exp:low_replace find="http://"}{linklist_url}{/exp:low_replace} "target="_blank">{title}</a>

```

may come out looking like

```
{title}

```

but the click link would still have the code, {exp:low\_replace} or {link list\_url} in it.

You want something that converts all the code into html entities. A number of the text editor fields will do this for you, such as WygWam from Pixel & Tonic or Espresso by Put Your Lights On.

You'll need `<pre><code>` to preserve spacing, and obviously whatever styling you want to employ. Applying colors to different types of code is more complicated, but doable, with `<span>` classes.
> 1 votes

# Answer
I recommend using Prism.js for syntax highlighting.

http://prismjs.com/

I have made an EE syntax highlighter that I find better than the available solutions. I tried really break down each tag, and it's under active development. Prism.js is super lightweight and really faster, and adds no bloat to the page. Eventually it would be nice to have some sort of EE plugin for stuff (not sure what it would do), but the raw JS is just as good.

https://github.com/objectivehtml/prismjs-for-expressionengine

The other answers in this thread are always good too, but main difference is they don't utilize Prism.js, which is key for me. I have tried a lot of syntax highlighter, and really pleased with the API of Prism.js, which only took a matter of minutes to understand.

And to help write examples with EE code (not sure you need it specifically but others may), I use the HTML entity for it. If you remove the first bracket, the rest of the tag is void. (Conditionals need every first bracket replaced.)

```
<pre class="language-ee"><code>
{exp:channe:entries}

    <h1>Your header</h1>

    {if segment_2}

        ....

    {/if}

    ....

{/exp:channe:entries}
</pre><code>

```

My Prism.js syntax highlighter automatically trims and converts HTML tags to output correctly, so no entity needed there. (Obviously in the Prism.js highlighter you would see the bracket and not the entity, this example is how you would type it.)
> 1 votes

---
Tags: ee2, allow-eecode
---


# Question
Title: Hiding specific categories from the publish tab
Within a category group, I've got about 10 categories that don't need to be seen by anyone but myself.

If I had realised this while planning the site, I would have created them in a separate category group to keep them slightly isolated.

However, my content admins would still be able to see it. How can this be addressed? (It would be cool if category groups were also available within publish layouts to hide/show!)

# Answer
> 1 votes
If it's a "don't need to be seen" situation, give them a "Don't Use" category parent and stick 'em at the bottom of the list. If it's a "can't be seen" situation, that's a different animal.

---
Tags: categories, publish-layout
---


# Question
Title: List of categories doesn't appear when creating a new parcel in Postmaster
When creating a new parcel in Postmaster (1.2 beta, build 1.1.99.4), I always find that after selecting a channel, the list of categories for that channel never updates. The text remains as, "This channel has no categories." Even though there are categories for the channel that I selected.

The statuses do update, so I wonder if I'm missing something from the setup as to why these categories don't appear right away? After saving the parcel and going back into it, the categories do then appear.

# Answer
Just wanted to follow up with this thread, this bug has been fixed in my latest development build and will be available in the v1.2 release.

Email support\[at\]objectivehtml.com if you need access to the beta build.
> 1 votes

---
Tags: add-on, categories, postmaster
---


title: Complex member fields

text:
# Question
Title: Complex member fields
RE: http://ellislab.com/expressionengine/user-guide/cp/members/custom\_member\_fields\_edit.html

Is it possible to have a group of fields to represent a single entry (of a possible many) in member fields? For example, say the member is to list his/her professional services, it may look like this:

```
1 hour(s), Web Development, $100
1 hour(s), Web Design, $125
1 hour(s), Web Content Development, $75

```

Each entry contains 3 fields. Is this natively possible? Do I need some sort of addon? Or is this not supported at all?

# Answer
I am not entirely sure what you are trying to do. But given the fact that the native Member module is not good for much of anything, I always recommend not using it. Using an add-on that stores profiles in channel entries allows you to use any fieldtype you want and get the level of flexibility you need. I am sure there is a fieldtype (FT) available to what you need, and you already used the word "entries" which tells me one of these add-ons would be exactly what you need.

All of these are solid solutions
> 8 votes

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


title: showing categories in a dropdown

text:
# Question
Title: showing categories in a dropdown
One of my category groups is rather big ( 100+ categories ) and the tree-structure to show categories just doesn't cut it anymore. It's too long and confusing.

So I would like to display my categories in a dropdown on the publish page. **Something very similar to this: WB Category Select, but without having to use a custom field to display and store the categories.**

I really want to use the native categories because of 2 reasons:

1. All of my entries are allready assigned to their categories, and I don't want to redo this for 1000+ entries in 100+ different categories
2. I'm working with GWCode categories to display everything on the front-end, and that add-on only works with the native categories

That's why WB category select is out of the question.

So how do I do this, **can I build an add-on to affect the way categories are being outputted in the back-end** ?

Also, the categories have multiple levels of subcategories, but they don't require multiple selections, so a drop-down should be sufficient ( doesn't have to be a multi-select )

# Answer
> 2 votes
There's an add-on called Lonely Cat http://devot-ee.com/add-ons/lonely-cat that may be close to what you're looking for.

---
Tags: ee2, categories
---