# Question
Title: Playa Customisation: Include all entries for coparents tag
How can I arrange it so that the current entry is included with the others, but in the correct order when using the coparents tag. Currently I have got:

```
 <h3>Other scenes</h3>
    <div class="row">
        <div class="span3">
            {scene_preview}<img src="{url:Listing}" alt="{title}" class="{if '{entry_date format="%U"}' > '{current_time format="%U"}'}grey{/if}" />{/scene_preview}
            <h4>{title}</h4>
            <i class="icon-calendar"></i> {if '{entry_date format="%U"}' > '{current_time format="%U"}'}<strong>Coming:</strong>{/if} {entry_date format="%d %M"} <span class="label label-success"><i class="icon-eye-open icon-white"></i> Viewing</span></p>
        </div>
        {exp:playa:coparents field="movie_title"}
            <div class="span3">
                {if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{scene_preview}<img src="{url:Listing}" alt="{title}" class="{if '{entry_date format="%U"}' > '{current_time format="%U"}'}grey{/if}" />{/scene_preview}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}
                <h4>{if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{title}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}</h4>
                <i class="icon-calendar"></i> {if '{entry_date format="%U"}' > '{current_time format="%U"}'}<strong>Coming:</strong>{/if} {entry_date format="%d %M"}</p>
            </div>
        {/exp:playa:coparents}
    </div>

```

But this solution is not ideal, as it puts the current entry being viewed at the beginning of the row and not in the original order. Can I include ALL entries with the same co-parent and display them in the original order?

# Answer
> 1 votes
I'm not sure if this would actually work and I don't have a site with the right setup to test it right now but you could try this:

```
<h3>Other scenes</h3>
<div class="row">

    {embed="includes/_coparents"
        all_coparents="{entry_id}|{exp:playa:coparent_ids field="movie_title"}"
    }
</div>

```

Your `includes/_coparents` embed would look something like this:

```
{exp:playa:coparents coparent_id="{embed:all_coparents}"}
    <div class="span3">
        {if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{scene_preview}<img src="{url:Listing}" alt="{title}" class="{if '{entry_date format="%U"}' > '{current_time format="%U"}'}grey{/if}" />{/scene_preview}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}
        <h4>{if '{entry_date format="%U"}' < '{current_time format="%U"}'}<a href="{title_permalink='movie/scene'}">{/if}{title}{if '{entry_date format="%U"}' < '{current_time format="%U"}'}</a>{/if}</h4>
        <i class="icon-calendar"></i> {if '{entry_date format="%U"}' > '{current_time format="%U"}'}<strong>Coming:</strong>{/if} {entry_date format="%d %M"}</p>
    </div>
{/exp:playa:coparents}

```

Like I say, totally untested but it might just work.

---
Tags: playa
---


# Question
Title: 'Champagne' messes up my publish layouts
I already tried contact the guys from 'mighty big robot', but their support doesn't seem to be that fast and I really need to have this fixed. So I might as well try my luck over here.

So, I installed 'champagne' - http://devot-ee.com/add-ons/champagne and it works great.

It allows you to send newsletters through campaign-monitor directly from expressionengine. It also allows you to use EE's templating system to generate a template that can be use for your newsletter.

You can do this by selecting a EE-template that will be used for your newsletter in the channel you'll be using to create your newsletters. Like so:

Note: 'newsletter' is my channel, 'newsletter/index' is my template.

BUT, not every channel needs a newsletter. So when leaving these fields blank, like this:

You would expect that the 'champagne' module doesn't load when accessing the publish layout for this particular channel.
Unfortunately, it does: it ads a tab and a custom field, but they're riddled with errors and are messing up the whole publish layout. Like this:

I tried fixing it myself, but I just can't figure out where the module starts adding the tab and custom field.

In ft.champagne.php at line 85 it checks wether a template has been assigned to the channel and throws an error when this isn't the case.

```
if ( ! isset($channel_settings['html_content_url']) OR ($channel_settings['html_content_url'] == '' OR $channel_settings['text_content_url'] == ''))
{
return $this->EE->lang->line('msg_no_channel_settings');
}
else
{
    ...

```

The statement is correct: the code goes into the 'if' segment ( and stays out of the 'else' ) but it doesn't print the error, and it doesn't prevent the module from loading the tab & fields when it shouldn't.

Any ideas ?
**EDIT:**

nico suggested to reset the publish layout, which works. But I would rather solve this without having to reset and rebuild the publish layout of a few dozen channels.

# Answer
This looks like a bug which has plagued me since the early days of EE 2.0 beta, which is caused by a corrupted publish page layout. As far as I know, there hasn't been a fix, and I'm not even sure if there is a bug report for it.

It's quite hard to predict when it will happen. However, I've noticed these conditions are the perfect storm:

* An add-on you have installed adds a custom tab to the publish page (EE Forums, Solspace User, Champagne etc)
* You have customized the publish page (doesn't have to be the same channel the add-on adds a tab to)
* You upgrade either EE or the add-on in question (doesn't happen on every upgrade, seems to happen about 50% of the time for me).

Generally, the symptoms are a completely messed up publish page, and if you are a super admin, lots of PHP errors at the top of the page like this (depending on which add-on you have installed):

```
A PHP Error was encountered
Severity: Notice
Message: Undefined index: rsvp__rsvp_total_seats
Filename: content/publish.php

```

Also sometimes javascript on the page is broken (e.g. client complains that Playa has stopped working).

Basically, the only fix I have found is to reset the publish layout. If you can still see those buttons, just use the EE interface. Otherwise, you can empty out the `exp_layout_publish` database table.

Now, this isn't particularly good news, since the bug is only caused when you have customized the publish layout, and re-customizing it every time you upgrade EE isn't very fun. Unfortunately, I've never spent the time to work out why this happens, or see whether it has been reported to EllisLab (I always figured it would probably take years for a fix so wouldn't be worth my time).

Because of this, I tend to avoid customizing the publish layout where possible. I've also stopped writing add-ons which add a tab to the publish page, since generally it triggers this bug and ends up with people complaining about PHP errors.

Sorry for the bad news if this is the same bug you're running into. Hopefully someone else here might know a real fix for the issue.
> 2 votes

# Answer
I suggest uninstalling 'Champagne', upgrade to latest version of EE, then reinstall 'Champagne'.

There was a bug in EE that was causing the Publish Layouts to error when addons added a new tab after a layout was customized.

I believe a new 'Champagne' tab will be added to each channel publish layout so you will most likely have to remove it from each layout that doesn't need it.
> 3 votes

# Answer
I've never used this addon but it sounds to me as though you *might* be running into a bug whereby addon JS is cached when it shouldn't be. If you aren't already running EE 2.5.4 or greater then an update might fix this (or you can apply the patch from the bug report manually).
> 0 votes

# Answer
I did not look into actual Champagne code, but try making this change:

```
if ( ! isset($channel_settings['html_content_url']) OR ($channel_settings['html_content_url'] == '' OR $channel_settings['text_content_url'] == ''))
{
$tab_settings = array('string_override' => lang('msg_no_channel_settings'));
return $tab_settings;
}
else
{
    ...

```
> 0 votes

# Answer
Were you able to get this plugin working on EE2? The developer's blog talks as if they've gotten out of the add-on writing and supporting business (which kind of stinks, because I was looking at this as a possible quite-nice solution to the project I'm working on.)

From the blog, entry dated Mar 7 2013:

> We got out of the ExpressionEngine add-on business in order to focus more on web consulting.

EDIT: Oh, wait, did a little search and found it. Champagne 2 is being supported by the different dev company.
> 0 votes

---
Tags: add-on, ee2, champagne, mightybigrobot
---


# Question
Title: Stash: How can I preset a channel var in the right stage of the parse order?
I'm trying to use Stash embeds on a pretty complex site and can 'see' a way to make things more DRY but can't actually figure out how to 'do'.

I have a collection of viewModal templates, that handle the various channels, and a lot of these channels share a naming convention for their right column meta data. In a perfect world, I would've shared these fieldgroups across the channels, but as that's not possible, I had to repeat myself a lot in the fields.

An example (stripped down slightly):

/editorial.html (viewModal template)

```
{!-- Set the page layout --}
{stash:embed:layouts:standard}

{!-- Right side area [inject the rightcol_meta partial into the {stash:page_meta} region] --}
{exp:stash:set_value name="st_page_meta" value="{exp:stash:embed:partials:rightcol_meta}"}

{!-- Main content area --}
{exp:channel:entries limit="1" channel="editorial|structure_editorial" disable="member_data|pagination|categories" require_entry="yes"}
    {exp:stash:st_page_title}{title}{/exp:stash:st_page_title}
    {exp:stash:st_page_body}{cf_editorial_body}{/exp:stash:st_page_body}

    {!-- (make all the meta fields snippets) --}
    {!-- Related links --}
    {exp:stash:set_list name="st_rel_links" parse_tags="yes"}
        **{cf_editorial_rel_links}**
            {stash:st_rel_link_title}{title}{/stash:st_rel_link_title}
            {stash:st_rel_link_url}{page_url}{/stash:st_rel_link_url}
        **{/cf_editorial_rel_links}**
    {/exp:stash:set_list}

    {!-- Related publications --}
    {exp:stash:set_list name="st_rel_pubs" parse_tags="yes"}
        **{cf_editorial_rel_publication}**
            {stash:st_rel_link_title}{title}{/stash:st_rel_link_title}
            {stash:st_rel_link_url}{page_url}{/stash:st_rel_link_url}
        **{/cf_editorial_rel_publication}**
    {/exp:stash:set_list}

    {!-- featureboxes (make all the meta fields snippets --}
    {exp:stash:set_list name="st_fbox_list" parse_tags="yes"}
        **{cf_editorial_fbox}**
            {stash:st_fbox_type}{cf_fbox_type}{/stash:st_fbox_type}
        {!-- Heading style --}
            {stash:st_fbox_heading}{cf_fbox_heading}{/stash:st_fbox_heading}
            {stash:st_fbox_heading_body}{cf_fbox_body}{/stash:st_fbox_heading_body}
        {!-- Image --}
            {cf_fbox_img}
                {stash:st_fbox_img_src}{url}{/stash:st_fbox_img_src}
                {stash:st_fbox_img_alt}{alt_text}{/stash:st_fbox_img_alt}
            {/cf_fbox_img}
            {stash:st_fbox_img_link}{cf_fbox_img_link}{/stash:st_fbox_img_link}
        **{/cf_editorial_fbox}**
    {/exp:stash:set_list}

{/exp:channel:entries}

```

I've surrounded the parts I'm talking about in \*s (turns out I can't bold inside a code snippet). I want to be able to change these sections into snippets, and instead of `{cf_editorial_rel_links}` etc I would like to use `{cf_{channel_short_name}_rel_links}` so that in each viewModal I could just include 1 snippet. Even if I had to use `{cf_{exp:stash:get name="channel_name"}_rel_links}` it would be fine.

Is this possible? I think it is, but can't seem to get it to parse the channel short name (with stash or otherwise) in time for it to be processed correctly.

Thanks in advance for any help!

Rob

# Answer
OK, so I managed to solve this.

In the viewModel template, I've set a preload replace variable:

```
{!-- Used for right column meta data --}
{preload_replace:pr_channel="editorial"}

```

At the top of the page, and then put the **entire** meta fields section, including the `stash:set_list` tags in one snippet: `{sp_st_fields_page_meta}`.

Inside that I can just use {pr\_channel} and it will parse at the correct time, meaning that all these variables (21 in the real site) can be set for each viewModel (15, it is a huge site) with only one snippet :)

Hope this helps someone!
> 0 votes

# Answer
I'm afraid that won't work, because those relationship variable pairs are parsed by the channel entries tag *before* being captured by Stash. As the value of `{channel_short_name}` cannot be known until the channel entries tag has been parsed you cannot dynamically determine the name of the variable pairs.

What you could do however is make the code inside the variable pairs into a snippet:

```
    {stash:st_rel_link_title}{title}{/stash:st_rel_link_title}
    {stash:st_rel_link_url}{page_url}{/stash:st_rel_link_url}

```
> 1 votes

---
Tags: stash
---


# Question
Title: Modify the 'forgot password' email template
When a user fills a 'forgot password' form, he or she receives an email like this:

```
username,

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

[link to reset password]

Your password will be automatically reset, and a new password will be
emailed to you.

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

```

Works well for me, except my site is in french. Where is this template or where can I change it?

# Answer
> 2 votes
You can edit the copy in the **Message Pages** area of the Control Panel... specifically edit the "Password Reset Notification" template.

**Control Panel Location:** Design ‣ Message Pages

---
Tags: members, email, login, password, forgot-password
---


title: EE, MSM, SSL and Multiple Domains

text:
# Question
Title: EE, MSM, SSL and Multiple Domains
So I have a challenge, here's the setup:

* 3 Sites, each with it's own domain, managed by MSM.
* Each site has a small e-commerce implementation requiring SSL
* Multi-Domain SSL certs are prohibitively expensive, so I intend to get 3 single domain certs.

The server that these sites are hosted on requires a separate CPanel instance for each site w/ SSL due to limitations with adding multiple IP addresses to each instance. I don't entirely understand the details of this, but they assure me that while it would be possible to set up all 3 sites in one instance it would be prohibitively challenging to set up and maintain.

Which leads me to the question - how can I set up 3 sites in 3 separate CPanel instances all running off the same MSM install? Is there other alternatives I'm not considering here? How would you handle this setup?

# Answer
> 1 votes
GoDaddy offers a **5 domain multi-domain SSL** for $89.99/yr. I'd go with that. The cost is less if you signup for 3+ years which I would suggest so you don't have to install it again each year.

---
Tags: multi-site-manager, ssl
---


title: Playa conditionals/embeds

text:
# Question
Title: Playa conditionals/embeds
Having a bit of trouble getting my head round something in Playa...

I have code which is a bit like this to deal with multiple channels from a single Playa field:

```
{exp:channel:entries channel="my_channel" limit="1"}
    <h1>{title}</h1>
    {exp:playa:children field="my_playa_field"}
        {if '{channel_short_name}' == 'channel_one'}
        <section>
            <h1>{title}</h1>
            {channel_one_specific_field}
        <section>
        {if:elseif '{channel_short_name}' == 'channel_two'}
        <section>
            {title}
            {channel_two_specific_field}
        </section>
        {/if}
    {/exp:playa:children}
{/exp:channel:entries}

```

There are more than two channels, and each has a number of custom fields, but the basic idea is the same. It works, but what I'd like to do to make maintenance a bit easier is take all the code between the if statements and call them as embeds instead:

```
{exp:channel:entries channel="my_channel" limit="1"}
    <h1>{title}</h1>
    {exp:playa:children field="my_playa_field"}
        {if '{channel_short_name}' == 'channel_one'}
            {embed="templates/template_one"}
        {if:elseif '{channel_short_name}' == 'channel_two'}
            {embed="templates/template_two"}
        {/if}
    {/exp:playa:children}
{/exp:channel:entries}

```

I've tried this, and it doesn't work. The right templates are being called, but the tags aren't being parsed as I would like, e.g. {title} echoes '{title}' rather than 'Entry title.'

So really I have three questions:

1. Is this a sensible approach to take to using Playa fields?
2. What am I missing with the embed template code?
3. Will calling embedded templates harm performance, or would I be better keeping all the code in one template (which is what I'm doing now)?

# Answer
> 0 votes
Moving the code to an embed will not work without coding a channel:entries tag in the embed as well and telling it what to load. For example:

```
{embed="templates/template_one" id="entry_id" channel="{channel_short_name}"}

```

In the embed you need:

```
{exp:channel:entries channel="{embed:channel}" entry_id="{embed:id}" limit="1"}
    {title}
{/exp:channel:entries}

```

---

With that said, you WILL harm performance by making this change... It's generally accepted that embeds should be used as little as possible and I'd say absolutely shouldn't be used just to make code more readable.

You are best leaving your code in the template and commenting heavily to make the code more readable/maintainable.

---
Tags: playa
---


# Question
Title: What may cause a GeoRequest:Can't connect to source; error in Expression Engine?
One of the clients the company I work for uses Expression Engine for their custom site. It was built roughly 2+ years before I hired in, and it’s our only EE site. The person who built it left the company a few months ago, and never trained anyone to maintain the site, so fixing/updating the site has been a task for everyone involved.

It turns out they utilize MX Google Map to display locations for the client. The initial location page loads fine, with several locations, and when I navigate to individual locations, those pages load fine. The search\_results page, however, throws this error: GeoRequest : Can’t connect to source;

A few things about this situation:

* No one has updated the site in roughly a month.
* Client does not have access to control panel.
* PHP, MySQL and other server settings have not changed.
* The error just appeared this morning…

Long story short, the client is being vocal about wanting a fix asap. Since nothing has changed, site settings or server settings, I can only imagine that it’s a problem with Google’s Map API? Perhaps?

Any help would be appreciated. Thanks!

# Answer
please check next patch for mx google map
> 0 votes

---
Tags: google-maps, mx-google-map
---


# Question
Title: Show item options in Cartthrob order email
I'm trying to get Item Options to show in Cartthrob's order email. I'm using the code from the documentation but it doesn't seem to work;

```
{exp:cartthrob:order_items order_id="{entry_id}" }
    <tr class="{item:switch="odd|even"}">
        <td><span style="font-size:12px;">{item:entry_id}</span></td>
        <td><span style="font-size:12px;">
            {item:title}
                <p>
                    <span style="font-size:9px;">
                {item_options}
                     <strong>{option_label}</strong> {option_name}: {option_value}
                {/item_options}
                </span>
                </p>
            {if is_package}
                <p>
                    <span style="font-size:9px;">
                {packages}
                    {sub:title}<br />
                {/packages}
                </span>
                </p>
            {/if}
            </span></td>
        <td align="right"><span style="font-size:12px;">{item:quantity}</span></td>
        <td align="center"> </td>
        <td align="right"><span style="font-size:12px;">{item:price}<br />(w/ tax: {item:price_plus_tax})</span></td>
        <td align="right">
            <span style="font-size:12px;">
                {item:subtotal}<br />(w/ tax: {item:subtotal_plus_tax})
            </span>
        </td>
        <td align="right">
            {if item:product_download_url}
            <span style="font-size:12px;"><a href="{exp:cartthrob:get_download_link field='product_download_url' entry_id='{item:entry_id}'}">Download</a></span>
            {/if}
        </td>
    </tr>
{/exp:cartthrob:order_items}

```

The item options are definitely captured because when I view the order entry it shows all the selected options.

Has anyone else had this trouble?

# Answer
> 2 votes
try to modify your template next way:

```
         {item_options}
             {if selected}<strong>{option_label}</strong> {option_name}: {option_value}{/if}
        {/item_options}

```

---
Tags: cartthrob
---


title: Config setting clarification

text:
# Question
Title: Config setting clarification
Is there a difference between the config variables $config\['compress\_output'\] and $config\['gzip\_output'\]?

I was getting some errors with a particular add-on while having $config\['compress\_output'\]= FALSE; set in config.php. Adding $config\['gzip\_output'\] = "n"; to config.php made the error go away.

# Answer
> 1 votes
It is the same setting actually. In case if you have gzip\_output = y, compress\_output will be = TRUE. I think it possible some legacy from EE1 (gzip\_output) and and CI (compress\_output)

**EE\_Output.php**:

```
// Compress the output
// We simply set the ci config value to true

if ($EE->config->item('gzip_output') == 'y' AND REQ == 'PAGE')
{
    $EE->config->set_item('compress_output', TRUE);
}

```

# Answer
> 0 votes
I believe that EE requires gzip\_output to be set and not compress\_output. There are several places in the EE system files that are using/referencing gzip\_output but make no mention of compress\_output, most tellingly in Template.php. Compress\_output may be limited to just CodeIgniter itself.

expressionengine/libraries/Template.php

```
2869        // GZip mode: {gzip_mode}
2870:       $str = str_replace(LD.'gzip_mode'.RD, ($this->EE->config->item('gzip_output') == 'y') ? $this->EE->lang->line('enabled') : $this->EE->lang->line('disabled'), $str);
2871
2872        // App version: {version}

```

expressionengine/models/admin\_model.php

```
75              'output_cfg'        =>  array(
76                  'send_headers'              => array('r', array('y' => 'yes', 'n' => 'no')),
77:                 'gzip_output'               => array('r', array('y' => 'yes', 'n' => 'no')),
78                  'force_query_string'        => array('r', array('y' => 'yes', 'n' => 'no')),
79                  'redirect_method'           => array('s', array('redirect' => 'location_method', 'refresh' => 'refresh_method')),

258                         'template_debugging'        => array('template_debugging_explanation'),
259                         'max_caches'                => array('max_caches_explanation'),
260:                        'gzip_output'               => array('gzip_output_explanation'),
261                         'server_offset'             => array('server_offset_explain'),
262                         'default_member_group'      => array('group_assignment_defaults_to_two'),

```

---
Tags: config
---


# Question
Title: Simple HTML file field uploads with Assets and Safecracker
The release notes for Assets 2 says "Added support for simple HTML file field uploads via SafeCracker".

Does anyone have any example template code of how this should work, including how to remove the file if necessary? I can't see anything in the docs.

# Answer
If you have an Assets field called “article\_images”, you can create a simple HTML upload input like so:

```
<input type="file" name="article_images">
<input type="hidden" name="article_images_filedir" value="1">

```

The first input is the actual File input, and the second tells Assets which upload directory to place it in.

In time, Assets will also support the `multiple="multiple"` attribute on the File input, for uploading multiple files at once, but for that we need a small SafeCracker patch to make it to an official EE release.
> 5 votes

---
Tags: safecracker, assets
---


# Question
Title: Expression Engine Rich Text Editor Tools
I'm trying to follow along with the rich text editor documentation in expression engine, but it's a little unclear to me:

http://ellislab.com/expressionengine/user-guide/development/rte\_tools.html

I created a php file like this:

```
Class center_text {

    public $info = array(
        'name'        => 'Center Text',
        'version'     => '1.0',
        'description' => 'Center Aligns Text',
        'cp_only'     => 'y'
    );

    private $EE;

    /**
     *  Constructor
     */
    function __construct()
    {
        // Make a local reference of the ExpressionEngine super object
        $this->EE =& get_instance();
    }

    /**
     *  Globals we need defined
     */
    function globals()
    {
        $this->EE->lang->loadfile('center_text');
        return array(
            'rte.center_text.label' => lang('center_text')
        );
    }

    /**
     *  RTE tool Definition
     */
    function definition()
    {
        return '

        WysiHat.addButton('center_text', {
            label: EE.rte.center_text.label,
            handler: function()
            {
                // Button Logic
            }
        });

        ';
    }

}
// END center_text_rte class

/* End of file rte.center_text.php */
/* Location: ./system/expressionengine/third_party/center_text/rte.center_text.php */

```

Named and placed as mentioned in the comments. I realize that this wouldn't exactly do anything just yet (I still don't know how to make that happen) - but I would expect it to show up as an option now in the toolset of the rich text editor, but it's not.

Does anyone have an example tool they've built for the RTE, or can point me to the default tools so I can see how they're set up. All I really want to do is define some very simple styles that CMS users can apply to their text, and the css will handle the rest (such as center, left, or right aligning text).

Thanks for any help or clarification on this.

* + UPDATE - -

I found the rte\_tools folder in the system \> expressionengine directory, and copied the "bold" example, and just changed the names to center\_text, then saved to that same directory, but still nothing shows up.

Here's the revised code:

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

/**
 * ExpressionEngine - by EllisLab
 *
 * @package     ExpressionEngine
 * @author      Mike Heavers
 * @copyright   Copyright (c) 2012, Mike Heavers
 * @license     http://expressionengine.com/user_guide/license.html
 * @link        http://expressionengine.com
 * @since       Version 2.5
 * @filesource
 */

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

/**
 * ExpressionEngine Bold RTE Tool
 *
 * @package     ExpressionEngine
 * @subpackage  RTE
 * @category    RTE
 * @author      Mike Heavers
 * @link        http://mikeheavers.com
 */
class Center_text_rte {

    public $info = array(
        'name'          => 'Center Text',
        'version'       => '1.0',
        'description'   => 'Centers Text',
        'cp_only'       => 'n'
    );

    private $EE;

    /**
     * Constructor
     *
     * @access  public
     */
    function __construct()
    {
        // Make a local reference of the ExpressionEngine super object
        $this->EE =& get_instance();
    }

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

    /**
     * Globals we need
     *
     * @access  public
     */
    function globals()
    {
        $this->EE->lang->loadfile('rte');
        return array(
            'rte.center_text'  => array(
                'add'       => lang('center_text'),
                'remove'    => lang('remove_center_text')
            )
        );
    }

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

    /**
     * JS Definition
     *
     * @access  public
     */
    function definition()
    {
        ob_start(); ?>

        WysiHat.addButton('center_text', {
            label:          EE.rte.center_text.add,
            'toggle-text':  EE.rte.center_text.remove
        });

<?php   $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }

} // END Center_text_rte

/* End of file rte.center_text.php */
/* Location: ./system/expressionengine/third_party/center_text/rte.center_text.php */

```

# Answer
> 9 votes
Ok, this is something it looks like Ellis is not ready to really let people do even though it's in documentation, except perhaps developers who would provide via a full add-on installer and handling. However, it is possible.

a. First, there is an EE interface to install new button features, but it is not called anywhere, Addons\_installer:install\_rte\_tool. All it does is add a record to the database table exp\_rte\_tools, which you can do manually via phpMyAdmin or similar, comparable to other records in the table.

Here we've added Mytool:

However, you'll want to have your Mytool\_rte class source code in place before you do this, as there is a feature in EE that automatically removes these tool records when the Rich Text field starts up, if the source isn't present. You can read about that here.

So let's get everything else set up, and then you can to add your database record before testing.

b. Where should you put your source code, and what are particulars it needs?

* You put your button source folder in system/third\_party
* You name your source folder with a single lowercase base name; example mytool
* The tool filename is rte. plus this name; example rte.mytool.php
* The class inside is the name with initial cap, plus \_rte; example Mytool\_rte

At this point, go through the file and change all references to the example you copied from so that they match mytool, or My Tool, etc., instead of the original. Also put what you like in the $info array values.

c. locate the function definition(). This is going to insert JavaScript into the user interface as your button is added. You're on your own as far as discovering what may be necessary to put in it as far as events, etc., but I want to warn on one point. Do not have a line defining 'name:' within WysiHat.addButton('mytool'){}. It's a possible WysiHat feature, but if you use it, you'll blank the entire RTE button bar. Something Ellis.

I would just stick with using a label: at first. Here's an example, with a label line instead, and a name line commented out to remind:

```
function definition()
    {
        ob_start(); ?>

        WysiHat.addButton('mytool', {
            // name:        'MyTool'
            label:      'MyTool'
        });

<?php   $buffer = ob_get_contents();
        ob_end_clean();
        return $buffer;
    }

```

d. Ok, now add your database record as in item 1. When you are successful, then you can go to Add-Ons\>Modules\>Rich Text Editor in the Control Panel, and click on the default Toolset, to get a drag-drop panel which should contain your MyTool on the left side. Drag it to the right side and position it in the order where you want it, then Submit.

e. At this point, you should be able to try a Publish page with a Rich Text field, and see your button in position. It will be blank, grey, and small.

f. Can we get an appearance as Ellis has for the stock RTE buttons? Actually, we can, and more easily than I had thought, as their interface and behavior is sensible.

Most buttons use CSS background images, defined in a multi-image sprite here: themes\cp\_themes\default\images\rte\_images\button-sprite.png. The appropriate images (note there are two per button, one a greyed version) are selected by background-position CSS.

There's one button which doesn't use an image, but shows its label text, the one on the right end to View Code. Let's emulate that one, as you can build your own pngs or sprite later if you want image buttons.

g. Alter or add a function as the following in your class. Note that it's attuned to mytool, and don't forget the 'b', as it's targeting what will be bold text markup on your label. This function will stack CSS in with what the CP already provides. In this case the markup removes the background image, and makes some minor placement for your label's text:

```
        function styles()
        {
            ob_start(); ?>

            .WysiHat-editor-toolbar .mytool b {
                background-image: none;
                            text-indent: 0;
                            padding-top: 1px;
            }

    <?php   $buffer = ob_get_contents();
            ob_end_clean();
            return $buffer;
        }

```

Now reload the Publish page in the CP, and you should have a Rich Text menubar like this, with your mytool button nicely showing. Notice that the button auto-sized to fit your text, and that you could add a line borrowed from the View Code style function CSS if you wanted it all capitalized, etc. Spaces in the original label:, as 'My Tool', would also have been fine:

Ok, I think we're complete. If you made the images for your buttons, you can alter the CSS here to use them, following the examples in themes\cp\_themes\default\css\rte.css, and being sure to allow for the greyed versions and so forth by defining :hover, :disabled, aria-pressed=true etc. as is done there.

I'd put the full source here, but as it's derivative of Ellis, and given their recent legalities even though their intent is to be copied in this case, seems better not.

Good fortune with this, and it's been a good exercise to see what's going on in today's EllisLab work.

---
Tags: module, php, wysiwyg, richtext, rte
---


title: Exempt GoogleBot from throttling (1.x)

text:
# Question
Title: Exempt GoogleBot from throttling (1.x)
Old school knowledge needed:

The IP-based method of exempting GoogleBot from throttling (as detailed in the MIA EE wiki) no longer works - GoogleBot doesn't have a fixed IP range.

I need Google to be able to constantly and reliably index a news site, but would like to keep throttling active, to help deal with weak DOS nonsense.

Ideas?

# Answer
You might look at changing this in Google's configs directly. If you set up a Webmaster Tools account and connect the domain, you can adjust the **Crawl Rate** to something that will work better for your site.
> 1 votes

---
Tags: ee1
---


# Question
Title: Percentage discount for X number of item options in Cartthrob
I have products in a channel that each have a CartThrob Price Modifier to choose a size.

What I would like to do is to give a customer 10% off if they buy more than 10 of any of those options in the Price Modifier.

I was wondering if it's possible to have a discount like this?

Thanks

# Answer
> 1 votes
I don't think if its possible with any existing feature of CartThrob, It might be implement with discount plugin.

You can take a reference for developing discount plugin from here : http://cartthrob.com/docs/developers/discount\_plugins/index.html

---
Tags: cartthrob
---


title: "?feed=rss2" in Pagination URL

text:
# Question
Title: "?feed=rss2" in Pagination URL
I have a blog listing set up with Structure, Zoo Triggers, AB Pagination, & CE Cache. Here's an abridged version of the template:

```
    {exp:ce_cache:it}
        {embed='_embeds/document_head'}

        {snippet:header}

        {exp:channel:entries
            channel='blog'
            dynamic='no'
            disable='member_data'
            limit='10'
            {triggers:entries}
        }
            {if count == 1}
            <ul class="vertical-block entries resetlist">
        {/if}

          <li class="clearfix">
            {!-- Entry Data --}
          </li>

        {if count == total_results}
          </ul>

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

      {snippet:footer}

      {exp:minimee:js}
        {snippet:global_scripts}
      {/exp:minimee:js}

        {snippet:document_foot}

    {/exp:ce_cache:it}

```

And the pagination snippet:

```
{paginate}
  <div class="pagination">
    <ul class="resetlist">
      {if abp_has_previous}
        <li>
          <a href="{abp_previous_link}">«</a>
        </li>
      {/if}
      {abp_pages}
        <li{if abp_is_current} class="current"{/if}>
          <a href="{abp_link}">{abp_num}</a>
        </li>
      {/abp_pages}
      {if abp_has_next}
        <li>
          <a href="{abp_next_link}">»</a>
        </li>
      {/if}
    </ul>

    <p>Page {abp_current_page_num_liber} of {abp_total_pages}</p>
  </div><!--/.pagination-->
{/paginate}

```

So occasionally when you advance to the next page in the listing using pagination, the URL looks like this: `/blog/?feed=rss2/P10` and breaks pagination.

Clearing/disabling CE Cache fixes the problem, but I'm not sure if it's a CE Cache problem or AB Pagination or what. There is a link to an RSS feed on the page, but its url is `feeds/blog`, not a query string.

* EE 2.5.5
* Structure 3.3.8
* CE Cache 1.9.2
* Zoo Triggers 1.1.13
* AB Pagination 1.6

# Answer
kgrote, try and download the latest release of AB Pagination from devot-ee, there was a bugfix about a month ago dealing with this issue.

Also, if you're interested in passing that ?feed=rss2 query string with the pagination links you can use the {abp\_query\_string} variable, more info here: https://getsatisfaction.com/addonbakery/topics/does\_not\_work\_with\_query\_strings#reply\_6709038
> 1 votes

# Answer
What do you mean "breaks pagination"? EE might think that string is an extra segment. Our official support is available here: https://structure.tenderapp.com
> 0 votes

---
Tags: structure, pagination, ce-cache, zoo-triggers, ab-pagination
---


# Question
Title: CSV format file generated from a template, how to prevent Safari on Mac downloading as html file?
I have an Exp Eng template that generate a .csv format file using a channel tag. I also insert the headers of the file using php, as shown below (those are the fist lines of the template). In Firefox the file downloads with a simple click on a link to the template and everything seems fine.

```
<?php
header("content-type: text/csv");
header("content-disposition: attachment; filename=filename.csv");
header("Pragma: no-cache");
header("Cache-Control: private");
header("Expires: 0");

```

It all seems to be working but Safari on the Mac will insist on downloading it with an .html extension as in 'filename.csv.html'. I've researched this on the Internet at many say it is just a peculiarity with Safari. But another person accessing the file says it happens no matter what browser they are using.

In Exp Eng I have the template settings as an "html" template. The other choices don't seem to work, like RSS/feed, and static would disable the channel tag. Any ideas on how to get around this problem?

Thanks, Bob.

# Answer
Per this **StackOverflow answer**, try adding the following to your .htaccess file:

```
AddType application/octet-stream .csv

```

Also, try changing your Content-Type header code to:

```
header('Content-Type: application/csv');

```
> 1 votes

# Answer
Depending on the data you want to export, you might be able to accomplish your goal with the AJW Export plugin. Could be worth looking at if you haven't already.
> 0 votes

# Answer
try next header:

```
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename=filename.csv');
header('Content-Transfer-Encoding: binary');
header('Accept-Ranges: bytes');
header('Cache-control: no-cache, pre-check=0, post-check=0');
header('Cache-control: private');
header('Pragma: private');
header('Expires: 0');c

```
> 0 votes

---
Tags: csv
---


# Question
Title: How can Playa combine multiple category filters in the CP?
I have a site with many similarly-named article entries that are organized by multiple categories. When selecting these articles in a Playa field in the control panel, I'd like to be able to select more than one category filter to narrow down the results.

Right now, adding multiple category filters displays entries that are in either one category or the other (e.g., it shows entries that are in either cat\_1 OR cat\_2). I want it to select entries that are in cat\_1 AND cat\_2. Is this possible?

Using Playa 4.3.3 on EE 2.3.1. Thanks!

EDIT: This doesn't seem to be built in to Playa, but if anyone knows how to hack it so this works, I'd accept that as an answer!

# Answer
You can't do this natively with Playa filters - you'd have to hack-in and change how it builds the query there (which would not be upgrade-safe).
> 1 votes

---
Tags: ee2, categories, playa, filter
---


title: Cannot user php in Playa tags

text:
# Question
Title: Cannot user php in Playa tags
So I'm running into a issue and I'm completely stuck. I'm trying to use Php in the playa tags to get my associations. But, no matter what I do, I always get a mysql error, as if the php variable isn't set yet. In my template, I even created a plugin, to set that variable to the entry\_id that I need to associate on.

Here's some sample code:

This is my plugin, I can echo out $categoryEntryId and the value is correct:

```
$categoryEntryId = '{exp:getcategoryentryid category="{segment_3}" parse="inward"}';

```

Below is some sample code where the mysql error is happening.

```
{exp:playa:parents entry_id="<?php echo $categoryEntryId;?>" backspace="10"}

```

This will result in the following error:

```
Error Number: 1064

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

SELECT DISTINCT(rel.parent_entry_id) AS entry_id FROM exp_playa_relationships rel WHERE rel.child_entry_id =
Filename: third_party/playa/mod.playa.php

Line Number: 701

```

Now, if I change it to the following, it works fine.

```
{exp:playa:parents entry_id="328" backspace="10"}

```

Anyone have any ideas on how I can resolve this issue? I started down the path on using the plugin, because earlier today, I was doing a query within the template, but had an issue with a naming conflict on the {title} tag for the result I just searched on, and the content within the {exp:playa} which also had to use the {title} tags.

# Answer
> 1 votes
What I'd suggest instead is that you use your plugin as a tag pair with one variable - `category_entry_id` \- then put your Playa tag inside of it.

```
{exp:getcategoryentryid category="{segment_3}" parse="inward"}
    {exp:playa:parents entry_id="{category_entry_id}" backspace="10"}
        ...
    {/exp:playa:parents}
{/exp:getcategoryentryid}

```

Right now your plugin probably does this:

```
$this->return_data = $categoryEntryId;

```

Instead, you need to do this:

```
$this->return_data = $this->EE->TMPL->parse_variables_row($this->EE->TMPL->tagdata, array('category_entry_id' => $categoryEntryId));

```

---
Tags: templates, playa
---


# Question
Title: Php warnings after moving site (preg_match() expects parameter 2 to be string , Cannot modify header information )
Need some advice on what is going on here - move my site to a new server and now I'm getting these two errors/warnings. EE should have write access. So not sure what is causing it. EE running version v2.5.3. ( PHP Version 5.2.17 , apache 2.0 or 2.2 )

```
A PHP Error was encountered
Severity: Warning

Message: preg_match() expects parameter 2 to be string, array given

Filename: libraries/File_field.php

Line Number: 437

```

And this

```
A PHP Error was encountered
Severity: Warning

Message: Cannot modify header information - headers already sent by (output started at /home/governme/public_html/sys/codeigniter/system/core/Exceptions.php:170)

Filename: core/Common.php

Line Number: 408

```

Code in line 437

```
> public function parse_field($data)    {       // If the file field is in the
> "{filedir_n}image.jpg" format         if (preg_match('/^{filedir_(\d+)}/',
> $data, $matches))         {           // Set upload directory ID and file name
>           $dir_id = $matches[1];          $file_name = str_replace($matches[0], '',
> $data);
>                       $file = $this->get_file($file_name, $dir_id);       }       // If file field is just a file ID      else if (! empty($data) &&
> is_numeric($data))        {           $file = $this->get_file($data);         }
> .............

```

code in line 408.

```
if (substr(php_sapi_name(), 0, 3) == 'cgi')
        {
            header("Status: {$code} {$text}", TRUE);
        }

```

Any ideas on what is causing this ?

Did the varDump .. this is the output.

```
string(77) "{filedir_4}From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
array(29) {
  ["file_id"]=>
  string(3) "192"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(66) "From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(136) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(66) "From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
  ["file_size"]=>
  string(5) "60559"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360412744"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360412744"
  ["file_hw_original"]=>
  string(7) "441 310"
  ["raw_output"]=>
  string(77) "{filedir_4}From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(62) "From_Customer_Satisfaction_Measurement_to_Customer-Centricity_"
  ["url"]=>
  string(129) "http://www3.governmentsummituae.com/assets/images/publications/From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
  ["width"]=>
  string(3) "310"
  ["height"]=>
  string(3) "441"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(77) "{filedir_4}From_Customer_Satisfaction_Measurement_to_Customer-Centricity_.png"
string(115) "{filedir_4}Harnessing_the_Power_of_Publicâ€“Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
array(29) {
  ["file_id"]=>
  string(3) "193"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(104) "Harnessing_the_Power_of_Publicâ€“Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(174) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Harnessing_the_Power_of_Publicâ€“Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(110) "Harnessing_the_Power_of_Public%E2%80%93Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
  ["file_size"]=>
  string(5) "47688"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360413196"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360413196"
  ["file_hw_original"]=>
  string(7) "438 312"
  ["raw_output"]=>
  string(115) "{filedir_4}Harnessing_the_Power_of_Publicâ€“Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(106) "Harnessing_the_Power_of_Public%E2%80%93Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments"
  ["url"]=>
  string(173) "http://www3.governmentsummituae.com/assets/images/publications/Harnessing_the_Power_of_Public%E2%80%93Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
  ["width"]=>
  string(3) "312"
  ["height"]=>
  string(3) "438"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(115) "{filedir_4}Harnessing_the_Power_of_Publicâ€“Private_Partnerships_in_Healthcare-_Imperatives_for_GCC_Governments.png"
string(80) "{filedir_4}Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
array(29) {
  ["file_id"]=>
  string(3) "225"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(69) "Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(139) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
  ["mime_type"]=>
  string(15) "application/pdf"
  ["file_name"]=>
  string(69) "Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
  ["file_size"]=>
  string(7) "5467402"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360519816"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360519816"
  ["file_hw_original"]=>
  string(1) " "
  ["raw_output"]=>
  string(80) "{filedir_4}Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "pdf"
  ["filename"]=>
  string(65) "Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare"
  ["url"]=>
  string(132) "http://www3.governmentsummituae.com/assets/images/publications/Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
  ["width"]=>
  string(0) ""
  ["height"]=>
  string(0) ""
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(80) "{filedir_4}Harnessing_the_Power_of_Public-Private_Partnerships_in_Healthcare.pdf"
string(79) "{filedir_4}Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
array(29) {
  ["file_id"]=>
  string(3) "194"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(68) "Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(138) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(68) "Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
  ["file_size"]=>
  string(5) "53832"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360413462"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360413462"
  ["file_hw_original"]=>
  string(7) "440 313"
  ["raw_output"]=>
  string(79) "{filedir_4}Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(64) "Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy"
  ["url"]=>
  string(131) "http://www3.governmentsummituae.com/assets/images/publications/Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
  ["width"]=>
  string(3) "313"
  ["height"]=>
  string(3) "440"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(79) "{filedir_4}Taking_a_more_sophisticated_Approach_to_GCC_labour_Marjet_Policy.png"
string(69) "{filedir_4}Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
array(29) {
  ["file_id"]=>
  string(3) "211"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(58) "Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(128) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
  ["mime_type"]=>
  string(15) "application/pdf"
  ["file_name"]=>
  string(58) "Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
  ["file_size"]=>
  string(7) "1035735"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360488189"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360488189"
  ["file_hw_original"]=>
  string(1) " "
  ["raw_output"]=>
  string(69) "{filedir_4}Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "pdf"
  ["filename"]=>
  string(54) "Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG"
  ["url"]=>
  string(121) "http://www3.governmentsummituae.com/assets/images/publications/Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
  ["width"]=>
  string(0) ""
  ["height"]=>
  string(0) ""
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(69) "{filedir_4}Taking_a_More_Sophisticated_Approach_to_GCC_Labour_ENG.pdf"
string(36) "{filedir_4}Government_Efficiency.png"
array(29) {
  ["file_id"]=>
  string(3) "195"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(25) "Government_Efficiency.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(95) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Government_Efficiency.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(25) "Government_Efficiency.png"
  ["file_size"]=>
  string(5) "50657"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360413644"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360413644"
  ["file_hw_original"]=>
  string(7) "438 310"
  ["raw_output"]=>
  string(36) "{filedir_4}Government_Efficiency.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(21) "Government_Efficiency"
  ["url"]=>
  string(88) "http://www3.governmentsummituae.com/assets/images/publications/Government_Efficiency.png"
  ["width"]=>
  string(3) "310"
  ["height"]=>
  string(3) "438"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(36) "{filedir_4}Government_Efficiency.png"
string(27) "{filedir_4}Deloitte_ENG.pdf"
array(29) {
  ["file_id"]=>
  string(3) "206"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(16) "Deloitte_ENG.pdf"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(86) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Deloitte_ENG.pdf"
  ["mime_type"]=>
  string(15) "application/pdf"
  ["file_name"]=>
  string(16) "Deloitte_ENG.pdf"
  ["file_size"]=>
  string(7) "1140040"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360485441"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360485441"
  ["file_hw_original"]=>
  string(1) " "
  ["raw_output"]=>
  string(27) "{filedir_4}Deloitte_ENG.pdf"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "pdf"
  ["filename"]=>
  string(12) "Deloitte_ENG"
  ["url"]=>
  string(79) "http://www3.governmentsummituae.com/assets/images/publications/Deloitte_ENG.pdf"
  ["width"]=>
  string(0) ""
  ["height"]=>
  string(0) ""
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(27) "{filedir_4}Deloitte_ENG.pdf"
string(41) "{filedir_4}Citizen_Centric_Government.png"
array(29) {
  ["file_id"]=>
  string(3) "196"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(30) "Citizen_Centric_Government.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(100) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Citizen_Centric_Government.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(30) "Citizen_Centric_Government.png"
  ["file_size"]=>
  string(5) "62054"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360413858"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360413858"
  ["file_hw_original"]=>
  string(7) "438 312"
  ["raw_output"]=>
  string(41) "{filedir_4}Citizen_Centric_Government.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(26) "Citizen_Centric_Government"
  ["url"]=>
  string(93) "http://www3.governmentsummituae.com/assets/images/publications/Citizen_Centric_Government.png"
  ["width"]=>
  string(3) "312"
  ["height"]=>
  string(3) "438"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(41) "{filedir_4}Citizen_Centric_Government.png"
string(41) "{filedir_4}AT_Kearny_Report_-_english.pdf"
array(29) {
  ["file_id"]=>
  string(3) "229"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(30) "AT_Kearny_Report_-_english.pdf"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(100) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/AT_Kearny_Report_-_english.pdf"
  ["mime_type"]=>
  string(15) "application/pdf"
  ["file_name"]=>
  string(30) "AT_Kearny_Report_-_english.pdf"
  ["file_size"]=>
  string(7) "5125939"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360571001"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360571001"
  ["file_hw_original"]=>
  string(1) " "
  ["raw_output"]=>
  string(41) "{filedir_4}AT_Kearny_Report_-_english.pdf"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "pdf"
  ["filename"]=>
  string(26) "AT_Kearny_Report_-_english"
  ["url"]=>
  string(93) "http://www3.governmentsummituae.com/assets/images/publications/AT_Kearny_Report_-_english.pdf"
  ["width"]=>
  string(0) ""
  ["height"]=>
  string(0) ""
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(41) "{filedir_4}AT_Kearny_Report_-_english.pdf"
string(60) "{filedir_4}Building_Citizen_Trust_in_Government_Entities.png"
array(29) {
  ["file_id"]=>
  string(3) "197"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(49) "Building_Citizen_Trust_in_Government_Entities.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(119) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Building_Citizen_Trust_in_Government_Entities.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(49) "Building_Citizen_Trust_in_Government_Entities.png"
  ["file_size"]=>
  string(5) "53832"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360414308"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360414308"
  ["file_hw_original"]=>
  string(7) "440 310"
  ["raw_output"]=>
  string(60) "{filedir_4}Building_Citizen_Trust_in_Government_Entities.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(45) "Building_Citizen_Trust_in_Government_Entities"
  ["url"]=>
  string(112) "http://www3.governmentsummituae.com/assets/images/publications/Building_Citizen_Trust_in_Government_Entities.png"
  ["width"]=>
  string(3) "310"
  ["height"]=>
  string(3) "440"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(60) "{filedir_4}Building_Citizen_Trust_in_Government_Entities.png"
string(41) "{filedir_4}Building_Citizen_Trust_ENG.pdf"
array(29) {
  ["file_id"]=>
  string(3) "205"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(30) "Building_Citizen_Trust_ENG.pdf"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(100) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Building_Citizen_Trust_ENG.pdf"
  ["mime_type"]=>
  string(15) "application/pdf"
  ["file_name"]=>
  string(30) "Building_Citizen_Trust_ENG.pdf"
  ["file_size"]=>
  string(7) "1053860"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360484412"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360484412"
  ["file_hw_original"]=>
  string(1) " "
  ["raw_output"]=>
  string(41) "{filedir_4}Building_Citizen_Trust_ENG.pdf"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "pdf"
  ["filename"]=>
  string(26) "Building_Citizen_Trust_ENG"
  ["url"]=>
  string(93) "http://www3.governmentsummituae.com/assets/images/publications/Building_Citizen_Trust_ENG.pdf"
  ["width"]=>
  string(0) ""
  ["height"]=>
  string(0) ""
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(41) "{filedir_4}Building_Citizen_Trust_ENG.pdf"
string(81) "{filedir_4}Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
array(29) {
  ["file_id"]=>
  string(3) "198"
  ["site_id"]=>
  string(1) "1"
  ["title"]=>
  string(70) "Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
  ["upload_location_id"]=>
  string(1) "4"
  ["rel_path"]=>
  string(140) "/data/sites/web/governmentsummituaecom/www/assets/images/publications/Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
  ["mime_type"]=>
  string(9) "image/png"
  ["file_name"]=>
  string(70) "Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
  ["file_size"]=>
  string(5) "54180"
  ["description"]=>
  NULL
  ["credit"]=>
  NULL
  ["location"]=>
  NULL
  ["uploaded_by_member_id"]=>
  string(2) "28"
  ["upload_date"]=>
  string(10) "1360414548"
  ["modified_by_member_id"]=>
  string(2) "28"
  ["modified_date"]=>
  string(10) "1360414548"
  ["file_hw_original"]=>
  string(7) "439 308"
  ["raw_output"]=>
  string(81) "{filedir_4}Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
  ["path"]=>
  string(63) "http://www3.governmentsummituae.com/assets/images/publications/"
  ["extension"]=>
  string(3) "png"
  ["filename"]=>
  string(66) "Achieving_Excellence_via_Data-driven_Decision_Making_in_Government"
  ["url"]=>
  string(133) "http://www3.governmentsummituae.com/assets/images/publications/Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
  ["width"]=>
  string(3) "308"
  ["height"]=>
  string(3) "439"
  ["image_pre_format"]=>
  string(0) ""
  ["image_post_format"]=>
  string(0) ""
  ["file_pre_format"]=>
  string(0) ""
  ["file_post_format"]=>
  string(0) ""
  ["image_properties"]=>
  string(0) ""
  ["file_properties"]=>
  string(0) ""
}
string(81) "{filedir_4}Achieving_Excellence_via_Data-driven_Decision_Making_in_Government.png"
string(85) "{filedir_4}Achieving_Excellence_via_Data-Driven_Decision_Making_in_Government_ENG.pdf"

```

............. had to crop because of post length

# Answer
Chances are the error reporting is different on the new server. Do a phpinfo() on each server and see what the difference is. Or check the php.ini files on each server.

If you don't have access to the ini files, you'll need to break down the error reporting value, which can be a pain.

http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting

You'll be happy to hear you can override the php.ini error\_reporting value in your code.

http://www.php.net/manual/en/function.ini-set.php
> 1 votes

---
Tags: php-errors
---


title: Switchee | Matrix and MX Calculator

text:
# Question
Title: Switchee | Matrix and MX Calculator
I'm trying to use MX Calculate to perform a percentage calculation of each row in a matrix column and the percentage is based on the value that's in each row which I'm trying to get Switchee to recognize but I think my problem lies somewhere in the parse order but I can't figure it out. Here's the code:

```
{exp:switchee variable="{event_fee}" parse="inward"}

     {case value=">=1000"}
     <strong>
     $ {exp:mx_calc parse="inward" expression="{event_fee}/100*40"}
     </strong>
     {/case}

     {case value="<=999"}
     <strong>
     $ {exp:mx_calc parse="inward" expression="{event_fee}/100*30"}
     </strong>
     {/case}

 {/exp:switchee}

```

Thanks.

# Answer
> 1 votes
According to a forum post on Devot:ee, you can't do less thans or greater thans inside the case values.
You'll need to use a regular expression.

http://www.regular-expressions.info/numericranges.html explains how to define numeric ranges.

But for your example, `case value="#^([0-9]|[1-9][0-9]|[1-9][0-9][0-9])$#"` should match 0-999. (Your regex needs to be enclosed with hashes).

If you are only using the two cases you mention, you might be better off using IfElse. I'm pretty sure you can use greater than and less than.

# Answer
> 0 votes
In this instance you'd probably be better off using Ifelse rather than Switchee. While you can certainly bodge all sorts of things with regular expressions, a switch statement isn't generally the way to go if you just want a simple `n < y` check.

```
{exp:ifelse parse="inward"}
    {if event_fee < 1000}
        <strong>
        $ {exp:mx_calc parse="inward" expression="{event_fee}/100*30"}
        </strong>
    {if:else}
         <strong>
         $ {exp:mx_calc parse="inward" expression="{event_fee}/100*40"}
         </strong>
    {/if}
{/exp:ifelse}

```

The ifelse plugin will remove non-matching conditions before they're parsed, so you'll still only have one mx\_calc call per row.

Edit: I've just noticed Jason's mentioned ifelse in his response already. I'll leave my answer here since the sample code might be useful.

---
Tags: matrix, switchee, mx-calculator
---


# Question
Title: Why am I getting 4 results in reverse_related_entries?
EE 2.5.5. I've got a {exp:channel:entries} on products channel. Inside I have a {reverse\_related\_entries id="reviews"}. I'm getting 4 reviews, when there are only 2. The first 2 are blank. I have 2 products entries, but only displaying 1 product based on URL.

When I go to the other product, I still get 4 reviews, but they're all blank.

Thanks for your help.

Update: Here's the full code for the product page:

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

{exp:channel:entries channel="products" limit="1" }
<div id="hero"><img src="{hero_image}" /></div>
{embed='includes/topnav'}
{if no_results}
<p>Unknown product.</p>
{/if}
<div id="prodinfo">
    <h1>{title}</h1>

    <div id="description" class="desc">{product_description}</div>
    <div id="ulimagescontainer">
    <ul class="prodimages">
        {reverse_related_entries }
        <li>
        <a href="{product_image_video:large}"><img src="{product_image_video:tiny}" /></a>
        </li>
        {/reverse_related_entries}
    </ul>
    </div> <!-- END #ulimagescontainer -->
    <div class="clearboth"></div>

    {if product_features > ''}
    <div id="productfeatures">
    <h3>Features</h3>
    {product_features}
    </div> <!-- END #productfeatures -->
    <div class="clearboth"></div>
    {/if}

    {if vehicle_callouts > ''}
    <div id="vehicle_callouts">
    <img src="{vehicle_callouts}" />
    </div>
    <div class="clearboth"></div>
    {/if}

    {reverse_related_entries id="product_reviews" }
    {if no_reverse_related_entries}
    {if:else}
    {if count == 1}
    <div id="product_reviews">
        <h3>Reviews</h3>
    {/if}

    <div class="reviewitem">
        <div class="synopsis">
        {review_synopsis}
        </div>
        <div class="author">{review_author}</div>
        <div class="link"><a href="{review_link}" target="_blank">{review_publication}</a></div>
    </div>

    {if count == total_results}
    </div>
    <div class="clearboth"></div>
    {/if}
    {/if}
    {/reverse_related_entries}

</div> <!-- END #prodinfo -->
{/exp:channel:entries}

{embed='includes/footer'}

```

# Answer
> 2 votes
You're confusing the syntax for `related_entries` and `reverse_related_entries`. It's `related_entries` which gets the `id` parameter (to signify which field you're asking for). `reverse_related_entries` expects a `channel` parameter (among other options).

(See docs.)

So your lower `reverse_related_entries` tag should look more like this:

```
{reverse_related_entries channel="reviews"}
{if count == 1}
    <div id="product_reviews">
    <h3>Reviews</h3>
{/if}

<div class="reviewitem">
    <div class="synopsis">
        {review_synopsis}
    </div>
    <div class="author">{review_author}</div>
    <div class="link"><a href="{review_link}" target="_blank">{review_publication}</a></div>
</div>

{if count == total_results}
    </div>
    <div class="clearboth"></div>
{/if}
{/reverse_related_entries}

```

(Your `{if no_reverse_related_entries}` conditional was superfluous.)

Likewise, your first `reverse_related_entries` tag pair should follow the same format (it currently has no `channel` parameter).

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


# Question
Title: Embedded template channel entries tag inexplicably breaking in some host templates
I've got an embedded template called \_sidebar that contains (surprise surprise) the site's sidebar content. It contains a heading and a channel:entries tag, all wrapped in a container div. In some templates (eg. the index template of the 'news' template group) the C:E tag works as expected. However, when I embed \_sidebar into the news/view template \*and access a particular news article via a {url\_title\_path} link\* the C:E tag fails to generate any content.

However, I can see that \_sidebar *is* getting embedded, because the heading and the container div appear in the sidebar region as expected. It's just that none of the content that should be called in by the C:E tag is there.

Both the 'news' and 'news/view' host templates have identical structures. There are no nested C:E tags either in the host template or in the embedded template. If I go to the URL domain.com/news/view (without selecting a specific article) then the sidebar displays correctly. It is only when the same template is used for a specific article (e.g.. domain.com/news/view/my-article-title that the glitch occurs.

BTW, I have no conditionals relating to segment\_3 in my templates. There are some conditionals acting on the value of segment\_1 in the \_sidebar template, but if they were being triggered then the heading and container div would be removed from the template also.

I'm a bit stumped. Without getting into the whole template code (yet) does anyone have any immediate thoughts, or has anyone run across this phenomena?

# Answer
> 0 votes
Semi-educated guess: You need to set `dynamic="no"` on the channel entries tag. If that's not the issue then I'd suggest posting some template code so that people can see what's going on.

---
Tags: channel-entries, templates, embeds
---


# Question
Title: How to pull and host an image file pulled from DataGrab[EE module] instagram feed
I am having trouble pulling images into my site using the DataGrab module. I am pulling in all the data just fine- including the image URL. But I need to take that url and pull the image to my own server. What is the easiest way to do this?

# Answer
> 1 votes
If you want an easy way of importing and manipulating remote images it's hard to beat CE Image. You might want to take a look at the `ce_image_remote_cache_time` config setting so that you can keep repeated remote requests to a minimum.

---
Tags: file-manager, channel-images, datagrab
---


# Question
Title: In Profile:Edit edit page add text with Matrix
i've a big challenge. I'm trying to replicate this form from behance in my edit profile page made with Profile:Edit add-on by mightybigrobot. Users can add manually their own social URL selecting from a fixed dropdown list.

I would something like that attached http://www.behance.net/portfolio/profile/info

In the Member profile fieldgroup i add a Matrix fieldtype, in the first column i choose PT Dropdown, and in second i choose text.

But now i don't know how i can display in the front-end form in members edit page.

Somebody can help me?

Thank you Guys

# Answer
The edit tag for Profile:Edit is a descendant of the SafeCracker module and so you can use all of Safecracker's parameters and variables. If there's ever anything missing in the Profile:edit docs you can normally find it in the Safecracker docs within the EE user guide.

For fieldtypes that have complex markup like Matrix, you need to use the `field:my_field_name` variable.

Docs: http://ellislab.com/expressionengine/user-guide/modules/safecracker/index.html#field-my-field-name

So the (very) basic template code would be:

```
{exp:profile:edit
    safecracker_head="yes"
}
    {field:matrix_field}
{/exp:profile:edit}

```

You'll probably need to include more parameters than that but I've include the `safecracker_head` one to show that it is required for Matrix because it'll load in the required Javascript. You'll also need to include the `include_jquery` parameter and set it to either yes or no depending on whether you're already loading it on the page.

More docs:

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

# Answer
I haven't worked with profile:edit, but it's like going to be something like:

```
{exp:profile:edit}
{matrix_field}
{pt_dropdown}
{/matrix_field}
{/exp:profile:edit}

```

Replace matrix\_field and pt\_dropdown with your field and column short names, respectively.
> 0 votes

# Answer
I'm doing the same thing the only difference is my dropdown in the matrix field is a playa field which is displayed via safecracker.

First, create another embed template and place your PT Dropdown code in it so you would have something like this:

```
<select name="mymatrixfield[selections][]" id="mymatrixfield">
    <option value="mymatrixfield">Add Additional Website</option>
    {exp:channel:entries dynamic="no" channel="portfolio"}
    <option value="{entry_id}">{title}</option>
    {/exp:channel:entries}
</select>

```

> You would replace the my matrixfield with your matrix field name and change the channel name.

Next, add embed the template into your profile:edit template and you should be good to go e.g.

```
{embed="includes/.templatename" selected="{mymatrixfield:child_ids}"}

```

> Again you would replace mymatrixfield with your matrix field name and .templatename with your corresponding template name.
> 0 votes

---
Tags: safecracker, matrix, profile-edit
---


# Question
Title: How do I embed a slide deck from Slideshare
what´s the best way to embed an iframe from Slideshare into an entry? Here´s an example.

```
<iframe src="http://de.slideshare.net/slideshow/embed_code/17368866" width="427"
height="356" frameborder="0" marginwidth="0" marginheight="0" scrolling="no"
style="border:1px solid #CCC;border-width:1px 1px 0;margin-bottom:5px" allowfullscreen
webkitallowfullscreen mozallowfullscreen> </iframe>

```

I use Content Elements, but non ofthe sub fields CE offers will show the deck. So, I assue, that I need to add an extra field. Which one would be the best?

# Answer
You can insert the iFrame code into a normal Content Elements textarea field.
> 2 votes

---
Tags: fieldtype, embeds
---


# Question
Title: Safecracker related(?) error: "Unable to load the requested language"
I'm using a safecracker form for guests to submit entries. When I'm logged out and I visite the page with the safecrackerform I get this error thrown at me:

"Unable to load the requested language file: language/dutch/upload\_lang.php"

This happens also when I change the language settings in the general config to English. The member\_id to use for guests also uses English settings. The upload\_lang.php file I can only find in system \> codeigniter \> system \> language \> english.

Any suggestions? Thanks in advance!

# Answer
Sounds like you're missing a language pack, looks like there's one for Dutch http://ellislab.com/expressionengine/user-guide/general/languages.html

You could also try copying the upload\_lang.php file from another langauge directory and modify it to translate the text to Dutch. But I would try the lang packs first.
> 1 votes

# Answer
The upload\_lang.php is being asked for somewhere so try creating an empty php file named "upload\_lang.php" and place it in the dutch language directory. That should get rid of the error.
> 0 votes

---
Tags: safecracker, system-messages
---


# Question
Title: Assets 2 There was an error uploading your file: Your upload directory isn’t writable
After deploying my site to a production server I am encountering errors when uploading files in Assets. Uploads in the native File Manager work fine.

Running EE 2.5.5 and Assets 2.0.5 on Windows 2008 IIS.

Error Message: There was an error uploading your file: Your upload directory isn’t writable.

I've checked permissions for the expressionengine/cache folder and they are ok. Thumbnails and such get generated in the assets cache folder.

I was also running into a duplicate folder listing which was resolved by following this thread: https://getsatisfaction.com/pixelandtonic/topics/not\_indexing\_correctly?utm\_content=topic\_link&utm\_medium=email&utm\_source=reply\_notification

I have tried with and without the following config overrides without success:

```
/*-- Assets --*/
//$env_config['assets_site_url'] = '/index.php';
//$env_config['assets_cp_path'] = './';

```

I'm not sure what else to try here... help!

# Answer
Nuno,

Can you make sure that /system/expressionengine/cache/ and its Assets subfolders are set to the equivalent of 777 permissions? You'll also need to check that for your individual file upload preference locations on your server.

You may also want to make sure your temporary folder is writable. A sys admin could help you with that.

-Lisa
> 0 votes

---
Tags: assets
---


title: How to delete entries via SafeCracker

text:
# Question
Title: How to delete entries via SafeCracker
How do people go about deleting entries via SafeCracker? I've got an extranet where I'd like to allow staff admins to delete entries, but I'm not sure how to go about this.

I've searched around and one suggestion is to set the entry status to 'closed' in order to fake the deletion, whilst another is to check out this third party add-on: Delete Entries and Comments.

Just wondering if there's any other ideas or suggestions for this? I'm not sure if the above add-on will do the job for me (as it says it only allows users to delete *their own entries*, not allow 'admin' users to *delete other user's entries*), and setting the status to 'closed' seems like a last resort type of workaround. Thanks.

# Answer
The plugin "Delete entries and comments" uses the channel API for deleting the entries so it respects the logged in member's group preferences. It would be fine for you to set the member's preferences for deleting entries from Control Panel according to your requirements.
> 3 votes

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


# Question
Title: Pagination links on CP module's view are not clickable
I have a problem quite similar to the one found here, where I am trying to form a table using the tutorial found on Ellis Lab's site. I found some of their guide totally lacking on pagination, and as a result when I implement it, I lose my table sorting and have links for pagination that do not work when clicked.

After looking on StackExchange I found the helpful post above, so that now I am at the same starting state as the OP's problem. My code looks like this:

```
$method_url = BASE.AMP.'C=addons_modules'.AMP.'M=show_module_cp'.AMP.'module=my_module'.AMP.'method=my_method';
return array(
        'rows' => array_slice($rows, $offset, 5),
        'pagination' => array(
        'page_query_string'     => TRUE,
        'base_url'      => $method_url,
        'per_page'          => 5,
        'total_rows'        => count($rows)
        )
    );

```

However, adding $this-\>EE-\>table-\>set\_base\_url() does not solve it for me. Although I may need to add it in a place that I did not try - the solution post did not specify.

Perhaps the best way I could summarize would be this: What is the EllisLab tutorial missing from making a functional pagination/sorting table?

# Answer
> 1 votes
I used `set_base_url()` in my `index()` function, where I set up the table.

```
$this->EE->load->library('table');
$this->EE->table->set_columns(array(
// columns
));
$this->EE->table->set_base_url('C=addons_modules&M=show_module_cp&module=my_module');
$data = $this->EE->table->datasource('_datasource');
$data['base_url'] = $this->base_url; // Available in my View
return $this->EE->load->view('mcp_my_module', $data, TRUE);

```

And in my `_datasource` function, which needs to give the pagination array a `base_url`:

```
$base_url = $this->_full_url();

function _full_url()
{
    $s = empty($_SERVER["HTTPS"]) ? '' : ($_SERVER["HTTPS"] == "on") ? "s" : "";
    $sp = strtolower($_SERVER["SERVER_PROTOCOL"]);
    $protocol = substr($sp, 0, strpos($sp, "/")) . $s;
    $port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);

    $non_offset_uri = explode('&tbl_offset=',$_SERVER['REQUEST_URI']);
    $non_offset = $non_offset_uri[0];

    return $protocol . "://" . $_SERVER['SERVER_NAME'] . $port . $non_offset;
}

```

Yes, I wrote my own function to set the base\_url for pagination.

Also - I have this as the return for my `_datasource` function:

```
return array(
    'rows' => $rows,
    'pagination' => array(
        'page_query_string' => TRUE,
        'base_url'    => $base_url,
        'per_page'   => $per_page,
        'total_rows' => $total_rows
    )
);

```

I start it with this:

```
function _datasource($state)
{
    //var_dump($state['offset']);
    $offset = 0;
    if ($state['offset'] != 0)
        $offset = (int)$state['offset'];
    $per_page = 20;
    $base_url = $this->_full_url();

```

And use those values in my query:

```
LIMIT ?,?",array($offset,$per_page));

```

To get the current page records.

Note that I have **TWO** queries in my `_datasource` function: One returns all rows to get the `$total_rows` value. The other uses `LIMIT` to get the current page's records.

```
$count_results = $this->EE->db->query("SELECT * FROM exp_audit_log ORDER BY timestamp desc");
$total_rows = $count_results->num_rows();

```

---
Tags: control-panel, add-on-development, module, pagination, table
---


# Question
Title: Can I use ExpressionEngine core for a portfolio site
I need to CMS-ify my friends design portfolio.

Can I use expressionengine core, or would I need a licenced? I've had a look at the terms and conditions for the Core version but I'm still not quite sure.

Really hope I can use ee, absolutely love working with it.

Thanks dave

# Answer
Presumably her portfolio site is there to sell her services, so that would qualify it as commercial use. Feel free to email EllisLab, but I'm pretty sure that this falls outside of the intent of the "core" license.

From the EE software license:

> Users of the Core License may use the Software only on a website engaging in personal, non-commercial, or non-profit activities.
> 4 votes

---
Tags: license, core
---


# Question
Title: EE1 Site Not Parsing Custom Fields Locally
I've just finished the local setup of a site running EE 1.7.1.

I have one issue... custom fields inside the `exp:weblog:entries` tag are not parsing at all. The title does show correctly.

I've check all paths and they are correct. I've disabled extensions, still no parsing. I stripped my template to the bare minimum and still no parsing.

**QUESTION:** Does anyone know why the entries tag isn't parsing custom fields on this local install?

---

**Debugging output:**
http://pastie.org/private/5qrbdhd95hn28sf3zfg

---

**My test template:**

```
{exp:weblog:entries weblog="static" limit="1" url_title="{segment_2}" dynamic="off" disable="category_fields|categories|member_data|pagination|trackbacks"}
    <h1>Title: {title}</h1>
    <h2>Copy: {s-copy}</h2>
{/exp:weblog:entries}

```

---

**The template output:**

# Answer
> 0 votes
Looks like this is because of import issues with the `exp_weblog_data` database table..

When I try to edit this entry, I see this error in the CP "You have tried to access a section that does not exist."

Going to reimport the `exp_weblog_data`.

---
Tags: ee1, entries, parsing
---


title: Embeds with single page design?

text:
# Question
Title: Embeds with single page design?
I'm creating a single-page portfolio site using jquery scrollto and easing, etc. For ease of editing, I'm seriously considering creating each "Section" on the main page as its own template and then embedding them on one main index page. I'm concerned about the increase in load & processing by doing this. Does this seem like a good or a bad idea, all in all?

# Answer
> 4 votes
A few embeds never hurt anyone, despite the hype! Yes they can have a performance hit on busy or content heavy/intensive sites but for smaller sites you'd probably barely even notice, save for a few extra queries on page load.

You can always use Snippets instead of embeds if you want to segmentate your code into smaller chunks.

Saying that, as you're only running a single page, I'd still consider one template with no embeds/snippets to maximise performance to the max, so long as your code was tidy you should have no editing issues.

# Answer
> 1 votes
It really depends on your site. I've built plenty of sites with embeds. Sometimes the only way to get something complex to work is with embeds. And in the case of Stash, you can even make embeds work for you.

If you don't need to pass any data between your index page and your embedded "sections," snippets will do what you want without the overhead of embeds.

Here's a comparison of the two: How to choose between an Embedded Template and a Snippet

Stash now has an embed feature that gives you a lot more control. It's like the best of snippets and embeds combined:

https://github.com/croxton/Stash#stashembed

But it's hard to say how it will impact speed without trying it out and seeing how long it takes the page to process and how many queries it uses.

---
Tags: templates, embeds, loading-time
---


# Question
Title: mod_fcgid: read data timeout in 45 seconds --> Premature end of script headers: admin.php
I'm getting a 500 Error when trying to save a rather large entry. (By "rather large" I mean it includes a 4x9 Matrix, 31x4 Matrix, 5x3 Matrix, Tag, and few text fields.) The Publish screen hangs for several seconds after I click Save and then goes to the error, without saving the entry (as far as I can tell).

The error logs include the following messages:

```
[Mon Mar 18 16:44:18 2013] [warn] [client 75.148.191.126] mod_fcgid: read data timeout in 45 seconds, referer: http://xxx/admin.php?S=dd4fca62fd66ca80ad02acde5f1ae08bb8e947d0&D=cp&C=content_publish&M=entry_form&channel_id=3&entry_id=1512&filter=YToxOntzOjE1OiJyZXR1cm5fdG9femVuYnUiO3M6MToieSI7fQ==
[Mon Mar 18 16:44:18 2013] [error] [client 75.148.191.126] Premature end of script headers: admin.php, referer: http://xxx/admin.php?S=dd4fca62fd66ca80ad02acde5f1ae08bb8e947d0&D=cp&C=content_publish&M=entry_form&channel_id=3&entry_id=1512&filter=YToxOntzOjE1OiJyZXR1cm5fdG9femVuYnUiO3M6MToieSI7fQ==

```

I Googled around a bit and couldn't find anything very conclusive. Have any of yall seen this before? Is it akin to a MySQL "server has gone away" error?

# Answer
That error is specific to mod\_fcgid, not PHP itself. If you're using the current version of mod\_fcgid then you will need to set the `FcgidIOTimeout` directive (ref), otherwise you'll need the old directive, `IPCCommTimeout`.
> 1 votes

# Answer
Thanks for the pointers, all. In this case, I ended up having to increase several timeout limits:

First, to address the original fastCGI error:

*/etc/httpd/conf.d/fcgid.conf*

```
FcgidIOTimeout 90

```

This fixed the PHP/fastCGI error, but revealed a 500 Error coming from Nginx timing out. The fix:

*/etc/nginx/nginx.conf*

```
keepalive_timeout  125;
proxy_read_timeout 125;
proxy_connect_timeout 125;
fastcgi_read_timeout 125;

```

This fixed the issue some of the time, but intermittently I would get the MySQL **"MySQL server has gone away"** error, which required one more tweak:

*/etc/my.conf*

```
wait_timeout = 120

```

Then, just for funsies, I went ahead and upped my PHP memory limit, just in case:

*/etc/php.ini*

```
memory_limit = 256M

```
> 7 votes

# Answer
For most cases solutions is incising max\_execution\_time as Anna told (you can also setup it in php.ini as max\_execution\_time 120).

But you can also try to add next lines into your .htaccess

```
<IfModule mod_fcgid.c>
IdleTimeout 3600
ProcessLifeTime 7200
MaxProcessCount 64
DefaultMaxClassProcessCount 8
IPCConnectTimeout 300
IPCCommTimeout 7200
BusyTimeout 300
</IfModule>

```

in case if is will not helps - try to add it into you vhost, because on many hosting this option is closed in .htaccess
> 0 votes

---
Tags: error
---


# Question
Title: Can I use custom map image tiles with Google Maps for ExpressionEngine?
I need to display a Google Map with markers generated from Channel Fields, **using a custom map tile instead of Google's satellite imagery**. If I know where corners/points of my image map to exact lat/long coordinates, is there a way to load in my image to be the map image?

(A nice elegant "use my image as the map" solution would be great if there is one, but I'd be equally open to a hacky "stick my image on top of the map" sort of solution as well...)

# Answer
> 2 votes
The Google Maps api provides a way for you to supply your own image for the map.

https://developers.google.com/maps/documentation/javascript/maptypes#ImageMapTypes

# Answer
> 0 votes
Also maybe check out Stamen, which seems super cool. :) http://maps.stamen.com

---
Tags: google-maps, google-maps-for-ee, mx-google-map
---


# Question
Title: Is there an alternative to using file manager for this scenario?
Here is the scenario:

* I want to store files (PDFs, DOCX, etc.) using Amazon S3 or similar
* I want members to login to my site and download these files via a url
* The link needs to be scrambled ie. www.mydomain.com/fdsfjksdksdasd
* The site runs on HTTPs / SSL
* The URLs can NOT be shareable i.e. members must be logged in (so deny hotlinks)
* There are multiple files per entry

I currently have a version of this using the file manager, the files stored behind the root and Intoeetive's Protected Links to manage the urls (which prevents hotlinking). The problem I have is that the file manager is awkward for the users of the site.

Ideally, the users would be able to search for a document in Amazon S3 or similar and attach it to an entry.

At the moment, we're FTPing documents to the server, running the sync in EE file manager 9slow when you have a lot of files), then attaching the file to the entry (we're using Matrix to handle multiple files) and a few other admin tasks to satisfy Protected Links. It is also difficult when we want to move files into different folders (as that breaks the links).

I've looked at Assets, as the interface for the users will be easy to adopt, but has limitations.

Is there an alternative to using file manager that would handle what I am looking for a bit more out of the box?

Note: I understand this is more of a subjective question, but I was pointed here form Pixel & Tonic and I also posted on the forums but got no responses.

# Answer
> 1 votes
Just to follow up I ended up going with this solution:

"I want to store files (PDFs, DOCX, etc.) using Amazon S3 or similar"

* I built an addon that creates Signed URLs for private Amazon S3 files

"The link needs to be scrambled ie. www.mydomain.com/fdsfjksdksdasd"

* I used Intoeetive's Protected Links add-on

"The URLs can NOT be shareable i.e. members must be logged in (so deny hotlinks)"

* Covered by Protected Links

"There are multiple files per entry"

* I used Pixel&Tonic's Matrix module

Works well. Links below.

# Answer
> 0 votes
If Assets suits your needs for the file-management part of the equation, maybe Devot-ee's own Link Vault would fit the bill for your security-needs...

Does that help?

---
Tags: file-uploads, file-manager, ssl, sync
---


# Question
Title: ed_imageresizer not working with second site in Multisite Manager
I am using ExpressionEngine 2.5.2 and I'm having trouble getting my ed\_imageresizer to work on my second site, setup through Multisite Manager. ed\_imageresizer is installed and working on my primary site, however, when I try to use it on my second site, I see broken images where the resized image should be. In my system's config.php file, I have the paths to my first site setup correctly (these are paths located on my local environment):

```
$config['ed_server_path'] = '/Users/cplaptop/Sites/site1/html/';
$config['ed_cache_path'] = '/Users/cplaptop/Sites/site1/html/images/resizer_cache/';

```

In my template, I am including the ed\_imageresizer code to find the image:

```
{exp:ed_imageresizer
image="{image}"
maxWidth="400"
cropratio="400:225"
quality="100"
alt="Portfolio Artwork"}

```

I tried swapping out those paths just to test if they are directing anything to the second site like this (which didn't work):

```
$config['ed_server_path'] = '/Users/cplaptop/Sites/site2/html/';
$config['ed_cache_path'] = '/Users/cplaptop/Sites/site2/html/images/resizer_cache/';

```

When I try directing the plugin to the second site, in my browser I no longer see broken images, I just don't see anything at all.

I have also tried the suggestion found here to create a conditional in my config.php, but I haven't been able to get that to work. When I try using conditionals, here is the code that I'm using in my config.php:

```
$host = $_SERVER[‘HTTP_HOST’];
if($host == ‘domain.com’ or $host == ‘www.domain.com’) {
$config[‘ed_server_path’] = ‘/Users/cplaptop/Sites/site1/html/’; // Server path to        your site’s web root
$config[‘ed_cache_path’] = ‘/Users/cplaptop/Sites/site1/html/images/resizer_cache/’; // Server path to where your resized images should be stored
}

$host = $_SERVER[‘HTTP_HOST’];
if($host == ‘domain.com’ or $host == ‘www.domain.com’) {
$config[‘ed_server_path’] = ‘/Users/cplaptop/Sites/site2/html/’; // Server path to        your site’s web root
$config[‘ed_cache_path’] = ‘/Users/cplaptop/Sites/site2/html/images/resizer_cache/’; // Server path to where your resized images should be stored
}

```

Am I missing anything here? When I try this route, neither my primary or secondary sites show images. I'm willing to try any way that works, so all suggestions are appreciated!

# Answer
what does the template debugger tell you? Most likely, I would remove the config variables from the config.php and into the index.php for each site respectively and using assign\_to\_config global vars instead.
> 0 votes

# Answer
I had trouble like this with ed\_image when I first starting using 2.x. I found CE Image to be far better and easier to work with. It's fairly easy to convert to CE Image too.
> 3 votes

# Answer
I came across a similar problem with ed\_imageresizer and MSM. I wanted to be able to use ed\_imageresizer on both MSM sites but ran into problems with the server paths. I solved the problem by installing two versions of the ed\_imageresizer plugin and using one version for each site, with different path configurations stored in each plugin.

I used ed\_imageresizer for site1 and kai\_imageresizer for site2. You can find kai\_imageresizer on this devot-ee.com forums thread: http://devot-ee.com/add-ons/support/ed-imageresizer/viewthread/460#8479

Kai\_imageresizer is a forked version of ed\_imageresizer that allows resizing of remote images. You don't need the remote image function for resizing images for site2, but you can use this plugin so you can have two versions of ed\_imageresizer installed, each with different server and cache paths.
> 1 votes

---
Tags: multi-site-manager, config, image-path
---