title: Using url segments to display content

text:
# Question
Title: Using url segments to display content
I am building a newsletter template that will display between 5 and 7 articles. My client will get to choose which articles will display by putting the entry\_id's in the url (ex. http://site.com/newsletter/111/222/333/444/555/666). How can I do this? Also, I am using an older verion of EE (hence the use of 'weblog'). Below is my code, which only works if there's 1 article (ex. http://site.com/newsletter/111)

```
{if segment_1 != "" }

{exp:weblog:entries entry_id="{segment_1}" limit="1" dynamic="no" disable="member_data|pagination|categories"}

            <tr>
                <td valign="top" width="150">
                    {if image != ""}<a href="{url_title_path="/article"}" alt="{title}" title="{title}" target="_blank">{image}</a>{/if}
                </td>
                <td valign="top" width="14"></td>
                <td valign="top" width="380">
                            <a href="{url_title_path="/article"}" alt="View {title}" title="View {title}" target="_blank">{title}</a>
                            <br /><br />
                            {if alt_summary != ""}
                                {exp:strip_p}{alt_summary}{/exp:strip_p}
                            {if:else}
                                {exp:strip_p}{summary}{/exp:strip_p}
                            {/if}
                </td>
            </tr>
{/exp:weblog:entries}

{/if}

{if segment_2 != "" }

{exp:weblog:entries entry_id="{segment_2}" limit="1" dynamic="no" disable="member_data|pagination|categories"}

            <tr>
                <td valign="top" width="150">
                    {if image != ""}<a href="{url_title_path="/article"}" alt="{title}" title="{title}" target="_blank">{image}</a>{/if}
                </td>
                <td valign="top" width="14"></td>
                <td valign="top" width="380">
                            <a href="{url_title_path="/article"}" alt="View {title}" title="View {title}" target="_blank">{title}</a>
                            <br /><br />
                            {if alt_summary != ""}
                                {exp:strip_p}{alt_summary}{/exp:strip_p}
                            {if:else}
                                {exp:strip_p}{summary}{/exp:strip_p}
                            {/if}
                </td>
            </tr>

{/exp:weblog:entries}

{/if}

```

# Answer
I never used EECMS 1, but I gonna try to help you.

There are some errors on your code.

* The `segment_1` is always `newsletter`. You never could use it on `{exp:weblog:entries entry_id="{segment_1}" [...]`;
* if your second conditional evaluates as true, both your conditionals will evaluate, because you need a `segment_1` to have a `segment_2`;
* if both codes are the same, you don't need two conditionals;
* if you want to pass more than one `id`, you can't use the `limit` parameter;
* EECMS 1 used `on` and `off` as parameter values; not `yes` and `no`;
* `trackbacks` was also a possible value for the `disable` parameter on EECMS 1.

Why not `http://site.com/newsletter/111|222|333|444|555|666`?

You could use:

```
{if segment_2 != "" }

    {exp:weblog:entries entry_id="{segment_2}" dynamic="off" disable="categories|custom_fields|member_data|pagination|trackbacks"}

        <tr>
            <td valign="top" width="150">
                {if image != ""}<a href="{url_title_path="/article"}" alt="{title}" title="{title}" target="_blank">{image}</a>{/if}
            </td>
            <td valign="top" width="14"></td>
            <td valign="top" width="380">
                        <a href="{url_title_path="/article"}" alt="View {title}" title="View {title}" target="_blank">{title}</a>
                        <br /><br />
                        {if alt_summary != ""}
                            {exp:strip_p}{alt_summary}{/exp:strip_p}
                        {if:else}
                            {exp:strip_p}{summary}{/exp:strip_p}
                        {/if}
            </td>
        </tr>
    {/exp:weblog:entries}

{/if}

```

Even better, you could put the conditional around the embed, to prevent its parsing:

```
{if segment_2 != "" }
    {embed="newsletter/articles"}
{/if}

```

I hope it helps.
> 1 votes

---
Tags: segments, entryid, newsletter
---


title: EE Core alternative to {exp:query}?

text:
# Question
Title: EE Core alternative to {exp:query}?
I have a website which until yesterday was running EE v1.6.7. Other than occasional defacing due to unpatched security vulnerabilities it was working well enough {/tongue-in-cheek}. Forced by system php upgrade to v5.4 I've upgraded the site to EE Core v2.9.2, only to discover that the `{exp:query}` relied on heavily throughout the templates no longer work, because the query module is now part of the upgrade version.

I only want to limp the site along long enough to replace it with a new design using an entirely different software stack, without Expression Engine. Paying $300 for a to-be-discarded program is not attractive. I've nothing against EE, it's just not the right tool for this site or a good match for the rest of our organization and it's processes.

In EE Core, what can I use as an alternative to the kinds of queries below while the new site is incubating?

```
{if segment_3 == "1"}
    {exp:query sql="SELECT * FROM exp_categories WHERE parent_id = '1' ORDER BY cat_name ASC"}
{/if}

```

# Answer
> 1 votes
if you don't mind of to write the queries as Active Record, you can use the Active Record Plugin.

But maybe you don't need that so much as you think. Sometimes, the default tags can do the job.

---

### UPDATE

For completeness sake, here is the working Active Record equivalent to the exp:query; nothing else in the templates needed to be changed.

```
{if segment_3 == "1"}
    {!--exp:query sql="SELECT * FROM exp_categories WHERE parent_id = '1'
         ORDER BY cat_name ASC"--}
    {exp:activerecord
        select="*"
        from="exp_categories"
        where:parent_id="1"
        order_by:"cat_name"
        }
{/if}

```

---
Tags: core, query-module
---


title: Style sheet CSS not showing

text:
# Question
Title: Style sheet CSS not showing
I cannot get style sheets, template type CSS, to display. All I get is a 404 error when I attempt to view a CSS file, js works fine.

http://mydomain.com/?css=style/mycss

Displays a 404 error

Running under Apache2, error log appears to be no help. I was thinking this looks like a permission error, but no seeing that js works.

ExpressionEngine v2.9.0 - Build Date: 20140715

Has anyone seen this before?

# Answer
> 1 votes
Your url adress is not correct, to display your css file, you have to set the related path:

Mydomain/path/file.css

An example: Domain.com/main/color.css

No need to put ?css=, it will give you a 404 error.

But why do you want to display a css file?

If you use a css template you have to insert the template path inside the page header.

href="{stylesheet='channel/channel\_css'}"

# Answer
> 0 votes
Now i understand your css path. It's html code created by EE. So i've created a template too inside the html header:

No problems related, when i show the code source it appears:

http://domain.com/?css=essai/essai\_css

So your problem could be a SERVER PATH TO SITE'S TEMPLATES, that you can set in template/global preferences. Or perhaps a redirect problem isnside .htaccess. Check the template path too.

# Answer
> 0 votes
I ran into the same issue with v2.9.2. The only thing that worked for me was to

* hard code the full path to the css files into the head template,
`href="/system/expressionengine/templates/default_site/stylesheets/base-css"` instead of `href="{stylesheet='stylesheets/base-css'}"`
* enable "Save Template as File" in the stylesheet template group.

---
Tags: css
---


# Question
Title: How to update database templates from files?
I am working on an Expression Engine site where the "save templates as files" has been disabled.

```
// config/config.master.php
$env_config['save_tmpl_files'] = 'n';

```

I'm assuming this means that the templates are stored in the database instead of being served from the files. I have made changes to some template files (header and footer partials). How can I load those changes into the production database?

Part 2 of this question is whether or not this is the right approach and how best can I deploy these changes.

# Answer
1. Download a production database dump and import it to your local database. You will want to make sure your templates are up-to-date with the templates in production.
2. Enable "save template files" config:

```
// config/config.master.php
$env_config['save_tmpl_files'] = 'y';

```
3. Locally, go to the admin control panel, go to `Design > Templates > Synchronize Templates` and sync all the templates. This will try to create/update the template files using data from the database. You may need to adjust file/directory permissions if there are errors while trying to sync.

If the template you will be working on is not listed, then you will need to make sure the template is set to save as file before syncing. Navigate to the file in the `Template Manager` and check the box to "save template as file".
4. **Now you can make your changes to the template files**
5. Repeat step 3 to sync your file changes to the database.
6. Commit your changes to your git repo.
7. Deploy to production. The config change should have also been deployed.
8. In production, repeat step 3 by going to the admin control panel `Design > Templates > Synchronize Templates` and sync all the templates. Again, if you don't see the template you updated in the list, you need to go find the template and enable "Save Template as File". However, in this step, you want to sync changes from your files to the database. **You'll probably need to deploy a second time** (or `touch` the file) so that the template file's modified time is newer than your database change. Then try again to sync the template change.
9. Now, locally, you can return your config file to the original state:

```
// config/config.master.php
$env_config['save_tmpl_files'] = 'n';

```
10. Commit this change to your git repo.
11. Redeploy the config change.
> 1 votes

# Answer
You have to enable the save templates as files back and then synchronize the templates. After that, you can disable it again.

Yeah, it's annoying.
> 0 votes

---
Tags: templates
---


# Question
Title: WYGWAM failing to initialize ... one just one entry
I’m running into something that isn’t making sense to me … I have a client that has created this page: http://teamthroughmywindow.org/about-our-project/faqs

The questions and answers are all anchor links, etc. and they used WYGWAM to create all of them. The rest of the site uses WYGWAM as well and they CAN edit other pages successfully right now (meaning CKEditor initializes just fine.) On this page the editor doesn’t initialize and it freezes up the browser.

My question is this … are there any size limits / issues with the link tool when so many anchors are used? They were able to save the revised page (there is a lot more content now). If not, can you offer some insight into where I may look to resolve this. I’ve tried clearing the cache in EE and in the browser (ran into a similar issue during EE upgrades in the past and that was a browser cache issue but that doesn’t appear to be the case here as I would expect them all to fail).

I look forward to your reply.

# Answer
> 1 votes
Have this figured out. Steven's fix he mentioned with changing the field from TEXT to LONGTEXT was part of the fix. The other part was that there was some bad HTML in the field that caused WYGWAM to choke. (Found this by pulling the field content from the DB and dumping it into coda and syntax highlighting showed errors). Specifically it was this (double quote closing a element):

After I changed the double quoted to single quotes on "Rio's Brain" it worked perfectly.

Thanks for everyone's help on this one.

# Answer
> 0 votes
Depending on the content of the field, you may be hitting a limit.

I've seen this happen with thesis like articles for a client. This resolved it for us Wygwam character limit?

---
Tags: pixelandtonic, wygwam
---


# Question
Title: Expresso Store: Extension to exclude modifier amounts when calculating tax
I'm developing an extension for Expresso Store that updates the tax calculation for items to exclude any amounts in the modifiers as for this application they are tax free. For example, if the price is say $10 for a physical credit card and then through a modifier they add $20 of credit to the card. I need to total to still be $30, however the tax to be calculated just on the base $10. e.g. tax @10% would result in $31 including tax.

So far in the extension I am using the Store hooks "store\_order\_recalculate\_end" & "store\_order\_item\_add\_end" and I can loop through removing the modifier prices to get the base price of the item, however I am unsure how to then :

* calculate the tax with the new item
* update the item price in the db
* recalculate the totals for the order

My current method is below.

```
public function modify_gst($order){
    foreach ($order->items as $item) {
        $pricefortax = $item-> item_subtotal;
        //Modifier amounts are not subject to tax
        foreach ($item->modifiers as $modifier) {
            $pricefortax = $item->item_subtotal - $modifier["price_mod"];
        }
       // $pricefortax is now the amount excluding any modifiers
       // NEED TO: calculate item_tax based of $pricefortax
       // NEED TO: Update item_tax and item_total for the item
    }

    //NEED TO: calculate order_tax and order_total
    //NEED TO: update order_tax and order_total
}

```

Any help would be greatly appreciated, I can't see in the Store docs how to achieve this, It's basically my first time working with an extension in EE or dealing int the internals of Store.

# Answer
> 2 votes
A concern would be that whatever you do to adjust price calculation, you have to be sure it's being adjusted in all instances - not just display of a product, but basket addition, basket display, quantity adjustments, right through to handshaking with the payment provider. You may even have to lookup the tax adjustments if you're dealing with differing tax amounts depending on customer location.

I would try to keep it simple and use Store to try to achieve what you need. In my answer I'm going to focus on your objective, rather than the approach you're currently taking. Prices in Store should already include tax:

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

By having the card as one taxable product and the credit as another non-taxable product, the solves the entire problem with tax calculation and you don't then need to write an extension to modify price. But your concern was customer journey.

I expect you're already using the Product Tag to display and allow the customer to add a product to their basket - change this instead to the Product Form tag, which will allow for multiple products to be added to the basket at the same time. So on the frontend, you display the card ($10) and then list credit options next to it with one "credit" pre-selected (e.g. $20). Upon adding to basket, both are added together. When displaying tax in the basket, it will only be shown for the taxable product (the cards) and because the prices already include tax, it won't adjust the customers total price of $30 (using your example), but will show total order tax as $1 already included in the total.

But there's a flaw - what if the customer purchases 2 cards with $30 credit on one and $20 credit on the other? If your "credit" product is $10 and you rely on quantity, then this approach will hit problems, As the basket will show 2xcard ($20) and 5xcredit ($50) with no idea of the distribution of credit across the 2 cards.

So to avoid this, approach the "credit" product as having a multiplier for "Size" (or similar label) which has the values of $10, $20, $30, etc and used price modifiers for each of these options, then the basket would show 2xcard ($20), 1x$30 credit, 1x$20 credit. Problem solved.

---
Tags: expresso-store, extension, expresso, tax
---


# Question
Title: Looping through channels, outputting field name, field type, field value
Given any Channel, is it possible to loop through all the entries and output the following:

* field name
* field type
* field value

Assume that the Channel is unknown and can be any Channel. This means that I don't know ahead of time what fields there are in the Channel.

For the field values, I assume that I would need extra logic to display its corresponding values (e.g. a grid might need to have a nested loop, etc.).

# Answer
Whilst not available for front end, this is a must for all installs: http://devot-ee.com/add-ons/template-variables
> 1 votes

# Answer
Just a quick answer but exp:query could handle most of this - certainly listing channel fields and types would be easy...I do something similar to help build stash models for channels, like this:

```

{exp:query sql="SELECT field_name FROM exp_channel_fields WHERE group_id = '47' "}
       {exp:stash:set name="{field_name}"}{{field_name}}{/exp:stash:set}
{/exp:query}

```

exp\_channel\_fields has the type as well.

The content will be harder, I'd look to one of the APIs lie RSANs DEEP or maybe OpenAPI to do that maybe?
> 0 votes

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


# Question
Title: Too many redirects when forcing https on a template group
I'm having some trouble with forcing https on a given template group. If I use the following, I get the "too many redirects" error. If I comment out my "force SSL" conditions, everything else works fine (removal of www, removal of index.php, etc.). Can anyone point out what's out of place here? This is for a site hosted with EngineHosting (if that plays any role here) and I am using the Charge add-on with "force SSL" turned on (which forces https:// on the post value on the module's generated form)

```
<IfModule mod_rewrite.c>

# Enable Rewrite Engine
# ------------------------------
RewriteEngine On
RewriteBase /

# Redirect www Requests
# ------------------------------
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/my_system_folder/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

# Forse SSL on Donate Section Requests
# ------------------------------
RewriteCond %{HTTPS} off
RewriteCond $1 ^(donate) [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

# Standard ExpressionEngine Rewrite
# ------------------------------
RewriteCond $1 !\.(css|js|gif|jpe?g|png) [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]

</IfModule>

#add Expires
# ------------------------------
FileETag MTime Size
<IfModule mod_expires.c>
  <filesmatch "\.(jpg|png|css|js|jpeg|woff|ttf|svg|eot|gif)$">
       ExpiresActive on
       ExpiresDefault "access plus 1 year"
   </filesmatch>
</IfModule>

```

I just want to force SSL on any /donate URI.

# Answer
> 0 votes
Whilst not answering directly, I've always used force SSL module and it just works: http://devot-ee.com/add-ons/dm-force-ssl

# Answer
> 0 votes
I think I ended up hard coding the domain into the redirect. Everything else seemed to cause issues or not work 100% of the time.

```
# Remove www
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
  RewriteRule ^(.*)$ http://%1%{REQUEST_URI} [R=301,QSA,NC,L]
</IfModule>

# Always secure
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteRule (.*) https://domain.com%{REQUEST_URI}
</IfModule>

# Remove index.php
<IfModule mod_rewrite.c>
  RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php?/$1 [L]
</IfModule>

```

# Answer
> 0 votes
The following code works great for me, and utitlizes a 301 redirect so that you can keep any existing pagerank for SEO! I add this before the code that removes index.php.

```
<IfModule mod_rewrite.c>

    RewriteEngine On

    #force SSL
    RewriteCond %{HTTPS} !=on
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

</IfModule>

```

---
Tags: htaccess, ssl, charge
---


title: Sub domain serving ce-img 'made' images

text:
# Question
Title: Sub domain serving ce-img 'made' images
Basically I want to serve "made" images from the subdomain for one of my File Upload locations.

I've seen a couple of posts on how you can use ce-img to handle local sub domains but they weren't fully on my wavelength and hence haven't had the "light bulb" moment.

I have setup a sub domain where the folder lives at the primary domains root folder:

var/myhost/mywebsite/ = mysite.com

var/myhost/mywebsite/siteassets/ = assets.mysite.com

Have configured one of the 'file' paths to use the sub domain to upload images to and it works - upload myimage.jpg and it appears at assets.mysite.com/folder1/myimage.jpg

```
$config['ce_image_src_regex'] = array( 'http://assets.mysite.com/' => var/myhost/mywebsite/.'/' );
$config['ce_image_made_regex'] = array( '^/' => 'http://assets.mysite.com/' );

```

It seems no matter which configuration I use, it never really works, I've experimented that much I've now forgotten where I started.

Can someone enlighten me pls :)

# Answer
> 0 votes
I ended up changing things slightly to enable me to serve specific folders from a sub domain rather then all image folders.

Using a config-override I set the specific folder to point towards a folder in the sub-domain like this standard treatment:

```
4 => array(           // ID of upload destination
        'name'        => 'Heroes',   // Display name in control panel
        'server_path' => 'var/server/html/file-assets/assets/heroes/',
        'url'         => 'subdomain.domain.com/assets/heroes/',
        'allowed_types' => 'img', //Only allow images
        'max_width' => '2000' //Set a max width for image
    )

```

I then changed the cache\_dir to reside under the subdomain server path, all assets will be cached to this folder which is fine, it's still relative.

```
$config['ce_image_cache_dir'] = '/file-assets/data/';

```

The folder structure is this:

/var/server/html **(domain.com)**

/var/server/html/file-assets **(subdomain.domain.com)**

/var/server/html/file-assets/assets/heroes/ **(Is the base path for the files set above)**

We then strip the subdomain part from any URL that includes a subdomain:

```
$config['ce_image_src_regex'] = array( 'subdomain.domain.com/' => '/var/server/html' );

```

The image gets manipulated and saved to the `/file-assets/data` folder declared above, which coincidentally can be served from a normal domain or subdomain.

We then check the made source to see if it comes from our "heroes" folder which is where we want subdomain images served from.

```
$config['ce_image_made_regex'] = array(
        '^/file-assets/data/assets/heroes/' =>  'http:subdomain.domain.com/data/assets/heroes/');

```

Whilst somewhat convoluted to follow, this allows me to serve only one particular set of assets from a subdomain decreasing page load by a significant factor.

# Answer
> 1 votes
Think you're missing some key CE Image config variables - ce\_image\_current\_domain and ce\_image\_document\_root.

I've got this setup using static.domain as the URL. Here's my config settings...

Set some variables...

```
$config['static_url']   = "http://static.${_SERVER['HTTP_HOST']}";
$config['static_path']   = "/...path-to.../static-ar/www/";

```

Set the upload paths in the config...

```
//###   Override existing Upload Settings   ###
$config['upload_preferences'] = array(
    1 => array(                                                             // ID of upload destination
        'name'        => 'Content Pages',                                    // Display name in control panel
        'server_path' => $config['static_path'].'images/content-pages/',  // Server path to upload directory
        'url'         => $config['static_url'].'/images/content-pages/'      // URL of upload directory
    ),
    2 => array(                                                             // ID of upload destination
        'name'        => 'Blog Content',                                    // Display name in control panel
        'server_path' => $config['static_path'].'images/blog/',  // Server path to upload directory
        'url'         => $config['static_url'].'/images/blog/'      // URL of upload directory
    ),
    3 => array(                                                             // ID of upload destination
        'name'        => 'Guide Imagery',                                    // Display name in control panel
        'server_path' => $config['static_path'].'images/guides/',  // Server path to upload directory
        'url'         => $config['static_url'].'/images/guides/'      // URL of upload directory
    )
);

```

Now the CE Image stuff...

```
$config['ce_image_current_domain']  = $config['static_url'];
$config['ce_image_document_root']   = $config['static_path'];
$config['ce_image_cache_dir']       = "images/generated/";
$config['ce_image_made_regex'] = array( '^/images/generated' => $config['static_url'].'/images/generated');

```

---
Tags: ce-image, config-overrides, image-path
---


# Question
Title: ExpressionEngine and Online Photo Service
I'm really sorry if I repeat somebody else's question but I could not really find any information on it for days. My deadlines are approaching and I am a little frustrated.

I am building a website for an online photo editing service. I never really thought about it before but I have to admit that I am actually stuck :(

The question is, if there is any ExpressionEngine Extension/Add-on that would suit me in order to provide this functionality (this is how it works):

A user selects a photo editing option \[i.e. a shopping item\] and adds it to their cart, then when they proceed to checkout they are offered to upload the photo that they would like to have edited \[this is what I have no idea of how to implement\], then they checkout via PayPal or any other method, I, therefore receive their order \[that comes with the actually uploaded images/image links\], then, when the photos are edited and I've received their payment, I mark the order as 'Complete' and they receive an invoice along with download links to their updated images OR they login to their account and access their updated images.

Could somebody who might have probably done something similar before give me a right direction? :(

So much appreciated, thank you guys.

# Answer
The shopping Cart add-on Cartthrob can do this, and possibly the other e-commerce add-ons such as store or BrilliantRetail too (but i haven't checked). All you do on the checkout page is add a file upload field.

See this docs page that shows you can do that - http://cartthrob.com/docs/tags\_detail/add\_to\_cart\_form/

Everything else you have asked to do is simple enough in ExpressionEngine if you know the basics of how it all works.
> 2 votes

---
Tags: file-uploads, ecommerce, ee, users, orders
---


title: Freeform form not showing

text:
# Question
Title: Freeform form not showing
Really odd problem.

Upgraded an EE site to latest version (2.9 from 2.5.2) with Freeform upgraded from 3.14 to 4.2.0. I've migrated all the relevant data using Freeform's built-in utility and updated the relevant parameters but the form is not showing in the template.

Even if I create a new template with the following code nothing is returned to the screen:

```
{exp:freeform:form}
    THIS IS A FORM
{/exp:freeform:form}

```

Any thoughts on how to debug or resolve?

Cheers

Cole

# Answer
Got to the bottom of this, thanks.

The templates had a form\_id attribute to create the html id attribute of the form. This should of course have been the numeric id of the form it was referencing.

Thanks all for responding!

Cheers

Cole

https://gist.github.com/cole007/fe14b74f8e760d180c61
> 2 votes

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


# Question
Title: Viewing a published post in which its status is not open
I have created a custom status which is titled "Completed". The application I am building allows for users to view courses they have attended or our attending in the future. All upcoming courses have a status of open and all courses that have been attended have a status of Completed.

I can only view posts that have a status of open, I am getting a white screen each time I try and view a post with the Completed status. If I change the status to open the post displays. Can anyone tell me if this is normal and is there a resolve for this?

Thanks

# Answer
> 3 votes
that is perfectly normal and expected behaviour.

To view content with status completed you need to add that to the "status" parameter in the channel entries tag, like so:

```
{exp:channel:entries status='open|Completed'}

```

More info here: https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html#status

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


title: Pagination via get variables?

text:
# Question
Title: Pagination via get variables?
I'm trying to use GET variables to apply pagination to a channel entries request (so can access via URL/AJAX).

Is there a variable that would work, eg ?P=10 or ?page=10

Tried offset but obviously that just reduces the number of entries available to query against.

# Answer
> 1 votes
Just use the standard pagination with AJAX. /P10 etc. works fine.

---
Tags: pagination, get
---


# Question
Title: More than one relationship field per entry not working on tempate
I have a channel set up where it's necessary to relate 2 other channels using two different relationship fields.

The relationship set up works OK within the CP.

The problem is that I don't seem to be able to output both relationship fields within my template. One or the other works fine but as soon as I put both on the template then neither work and the template tags are shown instead.

Has anyone run into this problem or have a suggestion as to how I can fix it?

Doesn't seem to work with an embed either. When using an embed and passing it the entry id I can display the related entry title but custom fields don't work.

# Answer
I got around this by using an embed an passing the entry id of the *related* entry to it like so.

```
{embed="my-embed" entry="{related-field:entry_id}"}

```
> 0 votes

---
Tags: templates, relationships
---


# Question
Title: Unique number/ID in each URL Title Field
Is it possible to auto insert a unique number/ID in each URL Title Field? For example:

Title: "article of the day" URL Title: article-of-the-day-123

Thanks

# Answer
> 1 votes
EE will do this automatically if you publish an entry with a title already in that channel.

---
Tags: url, title
---


title: v2.8.1 CP login loop issue

text:
# Question
Title: v2.8.1 CP login loop issue
I recently upgraded a local EE setup to 2.8.1 and now I cannot login to the CP. The page just refreshes.

I'm pretty sure that I've searched and read everything on EESE to find a fix but I'm still stuck. Here's what I've tried:

* Clearing cache
* Clearing cookies
* Restarting Chrome
* Also have used Incognito mode in Chrome
* Deleting sessions in the DB (exp\_sessions table)
* Changing session types between cookies, sessions, and cookies + sessions

I'm using Focus Lab's Master Config and have this in my config.master.php file:

```
    // Session Preferences
$env_config['admin_session_type']       = 'c'; // cs|c|s
$env_config['user_session_type']        = 'c'; // cs|c|s
$env_config['cp_session_ttl']           = 86400;

// Cookie Settings
$env_config['cookie_domain']            = '.' . preg_replace('#^www\.(.+\.)#i', '$1', $_SERVER['HTTP_HOST']);
$env_config['cookie_path']              = '';
$env_config['cookie_prefix']            = ENV . '_';

```

Add-ons installed (in case it matters):

* Draggable
* Lovely Sorted Addons
* Show Me My Assets
* Single Entry
* Snippet Sync
* Stash
* Superfish Admin
* Custom System Messages
* VZ Bad Behavior
* VZ URL
* Zoo Flexible Admin

\[EDIT\] I've also tried in Firefox and Safari; same thing.

Again, this is on my local setup and does not live anywhere else on the Interwebz. Everything was working before the upgrade to 2.8.1 (was previously on 2.7.2).

Help!

# Answer
> 2 votes
Try disabling extensions and turn on debugging. Could be a PHP error getting in the way of the login.

Also, I'd try the login in a browser you don't use often to eliminate a browser cookie issue. Chrome is not exactly good about letting go of cache I find.

# Answer
> 0 votes
What happens if you set $env\_config\['cookie\_domain'\] = the domain for your local setup manually?

# Answer
> 0 votes
I just finished dealing with a similar issue... make sure you upgrade Zoo Flexible Admin to the latest version (v1.82+)

# Answer
> 0 votes
I have another potential idea to throw into the pot. We've just experienced the same issue with **Stash** and **Custom System Messages**.

I've experienced similar issues on the frontend where an incorrect path to the stash embed on the custom system message template led to some sort of looping issue.

I would disable **Custom System Messages** and see if you're experiencing the same issue. If that is the case then you can check the assigned template for anything that may cause a problem.

To disable one extension, jump into the database find the extension (should be listed under the column class) and change the last row(s) to "n". As always, take a backup of your DB first.

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


# Question
Title: How to display current date in loop while inside {exp:calendar:cal} tag
I feel like this should be a very simple solution (and probably is!), but I have been looking around for a while and still have not found any resolution. Maybe someone here can help me out!

I am displaying events for the next 6 months for a night club and some days have more than one event. The end result should follow this format:

```
September 5, 2014
   8pm Event 1 Title, Price + Summary
   10pm Event 2 Title, Price + Summary
September 6, 2014
   8pm Event 1 Title, Price + Summary
September 7, 2014
   8pm Event 1 Title, Price + Summary
   10pm Event 2 Title, Price + Summary
(etc.)

```

My issue is that I can't seem to figure out a way to display the 'date' value that dynamically changes based on the current event in the loop. The only thing that I can think that would be accurate is the "event\_dates\_and\_options" tag, but I can't figure out how to get any information out of that other than a single digit (presumably number of items in the array?).

My code is as follows:

```
<div id="content-wrapper">
    <div id="content">
        <div class="eventcontainer">
            {exp:calendar:cal
                date_range_start="tomorrow"
                show_months="6"
                pad_short_weeks="n"
                }

                <div class="clear">
                    <div class="clear">
{!-- THIS IS WHERE I WANT THE DATE TO DISPLAY --}
                    </div>

                    <div class="floatleft">
                        {event_image}
                            <img class="eventimage" src=website-images/event-images/_thumbnails/{filename}.{extension} />
                        {/event_image}
                    </div>

                    <div class="floatleft">
                        {title}<br />
                        {event_dates_and_options} •
                            {if price}${price}{if:else}Free{/if}<br />
                        {event_summary}
                    </div>

                    <div class="floatright">
                        SHARE ICONS
                    </div>
                </div>
            {/exp:calendar:cal}
        </div>
    </div>
</div>

```

Thank you for taking a look! Best, Victor

# Answer
> 0 votes
The event\_dates\_and\_options is not a custom fieldtype that can be used as-is.

In your case, you would loop through each day using `{display_each_day}...{/display_each_day}`. Then, at each day loop, use `{events}...{/events}` to display the events of that day. Eg.

```
{exp:calendar:cal
    date_range_start="tomorrow"
    date_range_end="+6 months"
    pad_short_weeks="n"
}

    {display_each_day}
        <h3>Events on {day format="%F %j, %Y"}</h3>

        {events}
           {event_start_date format="%g%a"}, {event_title}, {event_summary}<br />
        {/events}
    {/display_each_day}

{/exp:calendar:cal}

```

---
Tags: solspace-calendar
---


title: Solspace User: notify admin of signup

text:
# Question
Title: Solspace User: notify admin of signup
Is it possible? Have a second reg form with User that goes to a specific group as opposed to main site signup. Is it possible to specify on this reg form alone that an Admin gets a mail on new signups?

# Answer
Unfortunately this isn't possible with User. I recommend submitting this as a Feature Request under the specific add-on category: http://support.solspace.com/support/discussions

The only option for notifying to a specific email address when a registration is completed is through EE's native settings under *Member =\> Preferences =\> Notification Preferences*: "**Send new member notifications?**" and "**Email Address for Notification**". However, this is of course not specific per-registration form.
> 0 votes

---
Tags: solspace, solspace-user
---


title: Manual Relationship query

text:
# Question
Title: Manual Relationship query
I have a page that I want to list the entries in a channel, but I ONLY want the entry to be listed IF it has a relationship. So I am populating the filter with the following:

```
<h4>SHOW BY SERVICE</h4>
<ul>
    <li class="segment-1 selected-1 active"><a href="#" class="all">All</a></li>
    {exp:channel:entries
        channel='service'
        orderby='title'
        sort='asc'
        disable='categories|member_data|pagination'
    }
        <li class="segment-{count}">
            <a href="#" class="{url_title}" style="text-transform: capitalize;">{title}</a>
        </li>
    {/exp:channel:entries}
</ul>

```

I don't mind writing a custom query to do it, but I tried this:

```
SELECT DISTINCT(title) AS parent_title FROM exp_channel_titles WHERE entry_id IN ( SELECT DISTINCT(parent_id) AS parent FROM exp_relationships )

```

with no luck. Maybe I am over complicating things with this one. The rest of the page is under an entry loop in another channel:

```
{exp:channel:entries
    channel='success_story'
    disable='categories|member_data'
    orderby='date'
    sort='desc'
}
    ...

```

The field is in the `Success Stories` channel as a relationship field named `{services_used}` which is pointing to the `Service` channel to relate it to the various services used.

I just need to be able to list the `Service` channel entries (distinctly) if they are referenced as used by a `Success Story` entry.

# Answer
> 0 votes
I was able to get what I needed using a query. I wasn't looking at the entries correctly in their relationships. I needed the children instead of the parents.

This is what I ended up with:

```
{exp:query sql="SELECT title, url_title FROM exp_channel_titles WHERE entry_id IN ( SELECT DISTINCT(child_id) FROM exp_relationships ) ORDER BY title"}
    <li class="segment-{count}">
        <a href="#" class="{url_title}" style="text-transform: capitalize;">{title}</a>
    </li>
{/exp:query}

```

---
Tags: ee2, relationships
---


title: Broken Accessory Link

text:
# Question
Title: Broken Accessory Link
I'm building an accessory based on one I built & use on another site that works without trouble. For some reason the URL's in my view are getting mangled in this new version.

This

```
<a href="<?=BASE . "&C=addons_accessories&M=process_request&accessory=the_addon&method=the_mthod" ?>">

```

Turns into this

```
http://siteurl.dev/admin.php?/cp/addons_accessories/process_request?accessory=the_addon&method=the_method&S=1234567890

```

Anyone know why that might happen?

# Answer
This is part of the clean control panel URLs introduced in version 2.8. Its purpose is to make CP URLs more legible, and easier for developers to build.
> 1 votes

---
Tags: accessory
---


title: Parse order question

text:
# Question
Title: Parse order question
I have a fairly complicated sequence of queries that I need run in order as later queries rely on results from a previous query and I'm using PHP to help refine and save data. I need to pass in a PHP value into two of my EE queries but I can't get a result and I'm presuming it's a parse order issue. Can anyone advise me on how to fix this? I need to make the "category" parameter in the 2nd EE query dynamic, its currently hardcoded as 51.

```
    {!-- get category for approved skill --}
{exp:channel:entries
    channel="skills"
    status="open"
    entry_id="{segment_2}"
    limit="1"
    dynamic="no"
    disable="member_data|pagination"
}
    {categories}
        <?php $cats[] = "{category_id}"; ?>
    {/categories}

    <?php $cat = end($cats);?>

{/exp:channel:entries}

{!-- get total number of skills belonging to category --}
{exp:channel:entries
    channel="skills"
    status="open"
    category="51"
    dynamic="no"
    disable="member_data|pagination"
}

    <?php $skill_count = "{total_results}";?>

{/exp:channel:entries}

```

# Answer
Well... You can't do that in a easy way, because the first `exp:channel:entries` need a PHP parsing on output, but the second one need it on input.

You can, of course use an embed.

```
[...]
    {embed="all/categories" ids="{categories}{category_id}|{/categories}"}
[...]

```

But is simpler to use the `related_categories_mode` on the second `exp:channel:entries`.

```
{!-- get total number of skills belonging to category --}
{exp:channel:entries
    channel="skills"
    status="open"
    related_categories_mode="yes"
    limit="100"
}
    {total_results}
{/exp:channel:entries}

```
> 1 votes

---
Tags: parse-order
---


title: DevDocs no longer working

text:
# Question
Title: DevDocs no longer working
Is anyone still using the DevDocs add-on? A recent update of EE to 2.9.2 broke it.

> Call to undefined method Cp::set\_variable() in /chroot/home/mydomainhere/cp/expressionengine/third\_party/dev\_docs/mcp.dev\_docs.php on line 125

I thought there was an easy fix for this but can't find it.

# Answer
replace

```
    $this->_EE->cp->set_variable('cp_page_title', $current_page->heading);

```

with

```
    $this->_EE->view->cp_page_title =  $current_page->heading;

```
> 4 votes

---
Tags: add-on
---


# Question
Title: Solspace Supersearch - Searching entries based on a checkbox field
I'm using the Solspace Supersearch add-on and am trying to search entries based on a checkbox field. Currently I'm getting all entries within the results. I've tried using name="users-exact" and this doesn't help to filter the returned data either. Suggestions appreciated, Thanks!

```
<form method="post" action="{path='search/results'}/">
    {exp:super_search:search}
    <input type="hidden" name="csrf_token" value="{csrf_token}" />
    <input type="hidden" name="inclusive_keywords" value="no" />
    <input type="hidden" name="redirect_post" value="no" />
    <label><input type="checkbox" value="Under 16" name="users[]"/> Under 16</label>
    <label><input type="checkbox" value="16-18" name="users[]"/> 16 - 18</label>
    <label><input type="checkbox" value="18 and over" name="users[]"/> 18 and over</label>
    <label><input type="checkbox" value="Women" name="users[]"/> Women</label>
    <label><input type="checkbox" value="Men" name="users[]"/> Men</label>
    <input type="submit" name="submit" value="Search"/>
    {/exp:super_search:search}
    </form>

{exp:super_search:results channel="zoo_visitor" inclusive_keywords="no" status="Services-id5"}
    <a href="{site_url}directory/view/{if visitor:member_id}{visitor:member_id}{if:else}{entry_id}{/if}">{firstname}</a>
    <p>{building}, {street}, {town}, {county}</p>
    {/exp:super_search:results}

```

# Answer
I managed to solve the issue by allowing the use of keywords and using javascript to enter the checkbox values into a hidden supersearch "keywords" input. While I still don't know why the checkbox inputs are not filtering the results, this approach is giving me the correct output. Thanks!
> 0 votes

---
Tags: solspace, supersearch
---


# Question
Title: Exp:resso Store - Checkout listing and Matrix Images - bug?
In the Expresso Store channel, my images are in a Matrix array, and while I can see it on the product page, the first checkout page ignores the matrix wrapping fields:

```
 {store_preview limit="1"}
    <img src="{img}">
 {/store_preview}

```

which generates this on the checkout listing:

```
{store_preview limit="1"} (broken image graphic) {/store_preview}

```

(this also gets pushed through CE Image, so I need to wrap the entire element). It appears it's being parsed as text - so no image gets called. Bah.

Has anyone seen this? Could this a bug the `{exp:store:checkout}` pair, or am I missing something?

# Answer
> 1 votes
You will need to add a channel entries tag to get custom fields to show up on in the cart, checkout, & order tags. Something along the lines of:

```
{exp:store:checkout}
 {items}
  {exp:channel:entries limit="1" entry_id="{entry_id}"}
   {store_preview limit="1"}
    <img src="{img}">
   {/store_preview}
  {/exp:channel:entries}
 {/items}
{/exp:store:checkout}

```

Basic things such as the Title, Entry ID, URL Title, and store related tags do not need the channel entries tags to be shown though.

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


title: Strange Stash & redirect issue

text:
# Question
Title: Strange Stash & redirect issue
I'm having an odd issue with Stash and a 404 redirect. When an entry isn't found the "layout" template is getting rendered twice around the main Stash content. Anyone seen this before? I can kinda see why it is happening, but can see any way around it. Thoughts?

**The page template**

```
{!-- Layout --}
{embed="shared/_layout"}

{!-- Set main content --}
{exp:stash:set
    name="main_content"
    parse_tags="yes"
    parse_depth="2"
    no_results_prefix="nested"}

  {exp:channel:entries limit="1" url_title="{segment_3}"}
    {if nested:no_results}{redirect="404"}{/if}
  {/exp:channel:entries}

{/exp:stash:set}

```

**The 404 template**

```
{!-- Layout --}
{embed="shared/_layout"}

{!-- Set main content --}
{exp:stash:set name="main_content"}
  <h1>Page not found</h1>
{/exp:stash:set}

```

**The layout template**

```
<body>
  HEADER GOES HERE!!!
  {exp:stash:get name='main_content'}
  FOOTER GOES HERE!!!
</body>

```

**The resulting output to browser**

```
<body>
  HEADER GOES HERE!!!
<body>
  HEADER GOES HERE!!!

  <h1>Page not found</h1>

  FOOTER GOES HERE!!!
</body>
  FOOTER GOES HERE!!!
</body>

```

**EDIT:** Seems I can get around the issue by removing the Stash/layout stuff from the 404 template and just having it as...

```
<h1>Page not found</h1>

```

But then a 404 generated by some means other than no\_results won't get the layout. Hmm. Ideas?

# Answer
If you look at function no\_results() in ./system/expressionengine/libraries/Template.php you will see that when a 404 template is defined as simply `"404"` within a redirect tag, then the 404 template referenced by the config value `site_404` is fetched and parsed. The template is not returned by the function but my guess is that it populates the property $EE-\>template-\>tagdata with the 404 template tagdata, which Stash will subsequently capture. Hence the apparent recursion.

The solution to this rather odd problem is to simply reference the 404 template by template\_group/template, e.g. `"site/404"` in which case the no\_results functions will send a redirect header via $EE-\>functions-\>redirect.
> 3 votes

# Answer
OK. I think I have a solution. Anyone know a better way?

**The Page Template**

```
{!-- Layout --}
{embed="shared/_layout"}

{!-- Set main content --}
{exp:stash:set
    name="main_content"
    parse_tags="yes"
    parse_depth="2"
    no_results_prefix="nested"}

  {exp:channel:entries limit="1" url_title="{segment_3}"}
    {if nested:no_results}
      {exp:stash:set_value name="no_results" value="true"}
    {/if}
  {/exp:channel:entries}

{/exp:stash:set}

```

**Inside of the layout template**

```
{if {exp:stash:not_empty name="no_results"}}
  {exp:stash:unset name="no_results"}
  {redirect="404"}
{/if}

```
> 1 votes

# Answer
You should turn on your template debug and look for:

Stash: SET or Stash: RETRIEVED

Figuring out if Stash is being called twice is probably where I'd start. If it's a duplicitous call to Stash vs. some Stash internal thing that would be good to know. I have a feeling it's an internal thing that doesn't play nice with the 'redirect' global. I'd have to start commenting out code in Stash to try and nail it down.
> 1 votes

# Answer
Just looked a little more. I'm betting it's a parse order thing (http://ellislab.com/expressionengine/user-guide/templates/template\_engine.html). Likely the simple conditional is parsing the redirect before Stash is parsed causing some sort of double loop. You're solution is certainly a functional work around.

You might want to try using parse="inward" in the Stash tag, that would probably change the order Stash and the nested elements are parsing and might fix the issue.
> 1 votes

# Answer
This could be a documented EE bug which causes the home page template to be rendered after the 404 content. It can be fixed with a small change to a core file.

https://support.ellislab.com/bugs/detail/20471/site-index-template-is-rendered-after-the-404-template

I do note that it says this is fixed in the released version but it was present up to 2.9.0
> 0 votes

---
Tags: stash, redirects, 404
---


# Question
Title: Basic question re creating sectioned lists
Please pardon the basic question, but I'm rather new to ExpressionEngine and hoping to be pointed in the right direction in using the proper tags for creating lists of items separated into sections by headers. The markup for each section would be along the lines of the following:

```
<section id="coffee-shops">
    <h3>Coffee Shops</h3>
    <div class="item">
        <div class="logo">Coffee Shop 1 logo image</div>
        <p class="description">Coffee shop 1 description text</p>
    </div>
</section>

```

My questions for creating the proper EE markup are as follows: (1) With which tag pairs can I achieve this sort of list divided by section? (2) How can I specify the order of the sections? (3) For each bit of information for each item, I'm using a separate block level element with a class, e.g. `<div class="logo">` or `<p class="description>` corresponding to each relevant channel field-- is it possible to *not* have one of these blocks appear if the corresponding image/info is not entered for the field? For example, if a logo image is not available, and thus not entered/published for the channel field, that the div with class `logo` would be omitted altogether from the entry?

Thanks for any guidance here.

# Answer
> 0 votes
There are a couple of different questions here and they are quite broad but the following may be of help;

If I understand you correctly, you wish to loop through all the Coffee shops and output some information about each one. Assuming that coffeeshops is a channel and each Coffee Shop is an entry within it. To do this you would use the channel:entries tag pair like so;

```
<section id="coffee-shops">
    <h3>Coffee Shops</h3>
    {exp:channel:entries channel="coffeeshops" dynamic="no"}
        <div class="item">
            <div class="logo">{my-image-field}</div>
            <p class="description">{my-description-field}</p>
        </div>
    {/exp:channel:entries}

</section>

```

Because we have set the dynamic parameter to "no" everything within the channel:entries tags will be repeated for each open entry in your channel. Note that we have replaced the actual content with fields representing the fields used in coffeeshop entries. (the image field depends on how you are setting that up).

To avoid outputting information for entries that don't have an image you could use a conditional to test if there is anything set.

```
<section id="coffee-shops">
    <h3>Coffee Shops</h3>

    {exp:channel:entries channel="coffeeshops" dynamic="no"}

            <div class="item">
                {if my-image-field}<div class="logo">{my-image-field}</div>{/if}
                {if my-description-field}<p class="description">{my-description-field}</p>{/if}
            </div>

    {/exp:channel:entries}

</section>

```

In this case the HTML inside the conditional will only be output IF there is something in the image field.

I'm not sure what you mean by "section" and with regards to the ordering of the sections. By default EE will output things in the entry ID order but you can change this to order by other fields if you wish by use of the orderby and sort parameters.

For example

```
{exp:channel:entries channel="coffeeshops" orderby="title" sort="asc" dynamic="no"}

```

Will display the coffeeshops in ascending alphabetical order based on the title field of the entry.

Relevant documentation can be found at https://ellislab.com/expressionengine/user-guide/add-ons/channel/channel\_entries.html

**To delineate the sections using categories:**

```
{exp:channel:categories category_group="1" style="linear" show_empty="no"}
    {embed="shops" cat="{category_id}"}
{/exp:channel:categories}

```

Then your shops.html embed file would contain a channel entries loop as shown above but with the addition of a category parameter and the value passed to it from the embed tag;

```
{exp:channel:entries channel="shops" category="{embed:cat}" dynamic="no"}

```

Which would loop through the shops entries and output everything that was in the relevant category.

**To delineate the sections using related entries:**

Assuming there is a "types" channel which contains the different types of shop, and then in the shops channel a relationship field to assign each shop to a particualr type.

You would loop through the types channel's entries then for each one use the {parents} tag pair to get the related entries. Note the parents: prefix on the field names.

```
{exp:channel:entries channel="types" dynamic="no"}
    {parents field="shop-type"}
        <div class="item">
            {if parents:my-image-field}<div class="logo">{parents:my-image-field}</div>{/if}
            {if parents:my-description-field}<p class="description">{parents:my-description-field}</p>{/if}
        </div>
    {/parents}
{/exp:channel:entries}

```

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


title: Supersearch for categories and keywords

text:
# Question
Title: Supersearch for categories and keywords
I can't seem to get the behaviour I want out of a search result using Solspace Supersearch.

Here's the scenario:

I want a keyword search on some specific fields and on category names. I have 2 channel fields (in the same channel, all set to searchable) that look like this:

```
street_name (example: "Boylston")
map_address (example: "100 Boylston Street, Boston, MA")

```

and category names that look like this:

```
"Downtown" ... "Jamaica Plains" ... "West End" etc...

```

my Solspace result tag and URL look like this:

```
url: search&keywords=West+End

{exp:super_search:results
        paginate="bottom"
        limit="10"
        inclusive_keywords="no"
        keyword_search_category_name="yes"
        search_in="map_address|street_name"
        relevance="street_name=5"
        }
Output results here...
{/exp:super_search:results}

```

Now searching for street names/addresses seems to work fine. And searching for categories actually works fine too, **unless** the category name is in two segments. For example, when searching for "West End", I get no results, but if I search for "West", I'll get some mixed results but they will include entries (there are only two in my channel) with the category "West End" (both of which do not have the term "West" or "End" in any of their fields, so the category\_name search must have worked). Same result when searching for "End", mixed results but those two do show up.

I have the same issue with all of my two segment category names, ex: "Jamaica Plains" gets no results, but "Jamaica" or "Plains" does.

I tried using a combination of the category-like and keywords search, but category-like is too fuzzy ("North End" results are very mixed with "South End", "West End", "South Boston", etc...). It almost works if I force category-like and keywords to search the same terms, but then they only include results that have A) The first word of the search term is found in the category name B) any part of the search term is found street\_name or map\_address.

When turning on debug, any time I use this parameter in my result tag

```
keyword_search_category_name="yes"

```

and my keyword search is more than one segment ("Jamaica+Plains") I get this PHP error:

```
A PHP Error was encountered
Severity: Notice

Message: Array to string conversion

Filename: super_search/mod.super_search.php

Line Number: 8408

```

We're using EE 2.9.0 and Supersearch 2.2.1. I've poured through the docs trying to find a way to search for colloquial location names as categories ("North End",etc) and addresses as just text fields. It might be a bug, but I'd take any suggestions on how to make this work.

# Answer
Unfortunately, as of this writing, this is a known issue (both the PHP error and the keyword\_search\_category\_name="" parameter not working as expected). We have noted the issue, but we do not have an ETA for a fix.

By the way, the latest info about add-on releases are announced on Twitter and are available in the add-on's changelog.
> 0 votes

---
Tags: solspace, supersearch
---


title: Relatively formatting edit_date

text:
# Question
Title: Relatively formatting edit_date
I'm inside this loop:

`{exp:channel:entries channel="people" disable="categories|member_data|pagination" status="open|closed" show_expired="yes" show_future_entries="yes" sort="asc" orderby="people_last_name" limit="999"}`

Just about everything I'm displaying is working as expected. At one point, I have:

```
{edit_date format="%m/%d/%y"} - {edit_date:relative}

```

`{edit_date format="%m/%d/%y"}` works fine. `{edit_date:relative}` gets passed through as literal text. So I get results like:

```
12/02/12 - {edit_date:relative}

```

Anyone know what I’m doing wrong, and how I can fix it?

# Answer
> 3 votes
Relative Dates have been introduced to (native) Expression Engine in Version 2.8.

Have you checked if your Site is running on EE 2.8 or newer?

---
Tags: edit-date
---


title: Solspce Tag and pagination

text:
# Question
Title: Solspce Tag and pagination
Based on Solcpase Tag documentation

> Pagination is available for this tag and works just like regular EE pagination, but each variable/variable pair is prepended with tag\_ (except for any variables/variable pairs inside of the tag\_pagination\_links variable pair). Used in conjunction with the paginate parameter.

so I have converted working pagination snippet to one which has added `tag_` to each variable pair, but it looks like like `{first_page}`,`{pagination_url}`,`{previous_page}` etc are not working with that trick.

Any clue?

# Answer
> 0 votes
Not all of the variable pairs are prepended with "tag\_" :)

This is what your code should look like:

```
{tag_paginate}
    <ul class="pagination">
    {tag_pagination_links}
    {first_page}
        <li><a href="{pagination_url}">First</a></li>
    {/first_page}
    {previous_page}
        <li><a href="{pagination_url}">« Previous</a></li>
    {/previous_page}
    {page}
        <li{if current_page} class="active"{/if}><a href="{pagination_url}">{pagination_page_number}</a></li>
    {/page}
    {next_page}
        <li><a href="{pagination_url}">Next »</a></li>
    {/next_page}
    {last_page}
        <li><a href="{pagination_url}">Last</a></li>
    {/last_page}
    {/tag_pagination_links}
    </ul>
{/tag_paginate}

```

---
Tags: solspace-tag, pagination
---


# Question
Title: Is there a way to customise the product dimension subfields in Expresso?
By default products have subfields for width, height, length etc. Is there a way to change these on the admin side? I'd like to change length to 'overall width' and weight to 'overall height'. Any clues would be great.

# Answer
No.

But, try using this add-on to inject custom JS into the control panel then modify the labels via JS. Something like...

```
// Publish/Edit Entry
$('#publish #store_product_field thead th:eq(2)').text("Overall Width (mm)");
$('#publish #store_product_field thead th:eq(5)').text("Overall Height (mm)");

```

Do something similar for the Store Control Panel page(s). On the frontend you control the labelling anyway.

The alternative is just to create custom fields in your entry to handle the information.
> 1 votes

---
Tags: expresso-store
---


title: Exp:resso Store tax exempt customers?

text:
# Question
Title: Exp:resso Store tax exempt customers?
Is there a way in Exp:resso Store to allow certain customers to be marked tax-exempt and then omit tax based on their status? Ideally a customer would contact us with their tax-exempt number and we would mark them tax-exempt in their member account. Or a member could include their tax-exempt number in a custom field when registering? Once that is filled in for their account, though, how could I omit tax for their orders?

# Answer
There is nothing out of the box that I know that would allow you to do this. Your best bet would be to create an extension that uses the `store_order_taxes` hook to see if the member has a certain field of their profile populated.

Having said that you would probably need to either have only an admin be able to fill out that field or have some logic to make sure that the tax-exempt number is valid so that the end user doesn't just enter a random number.
> 1 votes

---
Tags: expresso-store
---


# Question
Title: Set country as parameter in Checkout tag
To make the checkout tag more user friendly, I would like to set a country parameter in the Checkout tag. Making it display the correct shipping cost using the ip-to-nation functionality.

Installation details:

* Expresso Store 2.4.1
* MC Country 1.0.1
* Expression Engine 2.9.2 (with ip2nation module enabled)

# Answer
> 0 votes
I am not familiar with MC Country and have not used IP2Nation in a long time but you would need to use a conditional for the `shipping_country` field against the data returned from IP2Nation.

```
<select name="shipping_country">
 <option value="US" {if ip2nation_tag_here == "US"}selected="selected"{/if}>United States</option>
 <option value="CA" {if ip2nation_tag_here == "CA"}selected="selected"{/if}>Canada</option>
</select>

```

and so on for each of the countries that you might ship to.

The other thing is that either you will need to update the cart with JS or have the user update the cart before you will get rates calculated.

---
Tags: expresso-store
---


# Question
Title: Possible to upload to S3 when using Assets field in channel form as file input?
Within a channel form, I'm using an Assets field that points to an S3 external source. I'm using the `<input type="file" name="assets_field_name">` method (from http://docs.pixelandtonic.com/assets/templating/channel\_form.html). When I submit the form, the entry is created, but the image is not uploaded. If I use the `{field:assets_field_name}` method, the image is uploaded, however I need to maintain my form's visual style, so I can't use this method.

The S3 credentials are valid, and I'm able to upload and manage photos from the backend.

Using the `<input type="file" name="assets_field_name">` method, is it possible to upload directly to S3 from a channel form?

# Answer
Yes, but you need to add the hidden field with the remote source's ID as the value attribute.

```
<input type="hidden" name="assets_field_name_source" value="1">

```
> 0 votes

---
Tags: assets, channel-form, s3, amazons3
---


# Question
Title: Upgrading Stash from 2.3.6 to 2.5.9 breaks a template
I am running ExpressionEngine 2.7.2 with Stash 2.3.6. I tried updating Stash to 2.5.9 but found one of my templates using Stash now does not obtain the stashed variables. Here is the salient portion of my template:

```
{exp:stash:set_list name='mystash' parse_tags='yes' parse_depth='1'}
{exp:channel:entries channel="group_photo_tags" entry_id="2078"}
{group_photo_entry}
{stash:my_height}{exp:math formula='([1] * [3]) / [2]' params='{img-width}|{group_photo_entry:file_name}{width}{/group_photo_entry:file_name}|{group_photo_entry:file_name}{height}{/group_photo_entry:file_name}' round='up'}{/stash:my_height}
{stash:my_scale}{exp:math formula='[1] / [2]' params='{img-width}|{group_photo_entry:file_name}{width}{/group_photo_entry:file_name}' decimals='4'}{/stash:my_scale}
{stash:my_file}{group_photo_entry:file_name}{/stash:my_file}
{/group_photo_entry}
{/exp:channel:entries}
{/exp:stash:set_list}

{exp:stash:get_list name='mystash' parse_tags='yes' parse_conditionals='yes' parse_depth='1'}
{exp:channel:entries channel="group_photo_tags" entry_id="2078"}

<h3>{title} - {group_photo_entry}{group_photo_entry:title}{/group_photo_entry}</h3>
  {group_photo_entry}

<!--[if lt IE 9]> <p>Note: for older browsers, the person's face will not be circled</p><div id="mydiv" style="width: {img-width}px; height:{my_height}px;"><img src="{my_file}" width="{img-width}" height="{my_height}" /> <![endif]-->
<!--[if gt IE 8]><!--> <div id="mydiv" style="width: {img-width}px; height:{my_height}px;"> <!--<![endif]-->
<canvas id="mycanvas" width="{img-width}" height="{my_height}">
</canvas>

{/group_photo_entry}

<script type="text/javascript">

var c=document.getElementById("mycanvas");
var ctx=c.getContext("2d");
ctx.clearRect(0, 0, c.width, c.height);
drawphoto(c, ctx, drawcircle);

function drawphoto(c, ctx, onload){
var photo = new Image();
   photo.onload = function(){
      ctx.drawImage(photo,0,0,{img-width},{my_height});
      onload(c,ctx);
   };
photo.src = "{my_file}";
}

function drawcircle(c,ctx){
ctx.beginPath();
ctx.arc(
{exp:math formula='[1] * [2]' params='{my_scale}|{x}'},
{exp:math formula='[1] * [2]' params='{my_scale}|{y}'},
{exp:math formula='[1] * [2]' params='{my_scale}|{radius}'}*2
,0,2*Math.PI);
ctx.strokeStyle = 'red';
ctx.lineWidth = 4;
ctx.stroke();
}
</script>
</div>
{/exp:channel:entries}
{/exp:stash:get_list}

```

A view of the page source after the update shows that the stash variables are now parsed as blank, leaving the formulas to calculate 0 and so rendering no image. I suspect a parse order issue, but do not see where this is occurring.

# Answer
> 1 votes
Happy it was a simple fix. For future reference, if a comment leads you to the solution, you should give the commentator an opportunity to post it as an 'answer'. The whole SE system is built on points and points are used to boost your credibility.

Whilst the comment was correct I'd likely go a step further as stash is of no use in your scenario as your stash a list then getting the list whilst also using exp:channel tags again.

```
//Rather then using set_list to capture 1 entry, use it to capture 100 (or all)
{exp:stash:set_list name='mystash' parse_tags='yes' parse_depth='2'}
{exp:channel:entries channel="group_photo_tags" limit="100"} //capture 100 entries
  {stash:entry_name}{title}{/stash:entry_name}//Record title of entry
  {stash:entry_url}{url_title}{/stash:entry_url}//Record the URL of the entry for matching
  //Use a nested list for recording the gallery matrix/grid
  {exp:stash:set_list:nested name="{entry_url}_gallery" parse_tags="yes"}
  {group_photo_entry}
        {stash:my_title}{title}{/stash:my_title}// Grab the title of the image
        {stash:my_width}{img-width}{/stash:my_width}
        {stash:my_height}{exp:math formula='([1] * [3]) / [2]' params='{img-width}| {group_photo_entry:file_name}{width}{/group_photo_entry:file_name}|{group_photo_entry:file_name}{height}{/group_photo_entry:file_name}' round='up'}
        {/stash:my_height}
        {stash:my_scale}{exp:math formula='[1] / [2]' params='{img-width}|{group_photo_entry:file_name}{width}{/group_photo_entry:file_name}' decimals='4'
        {/stash:my_scale}
        {stash:my_file}{group_photo_entry:file_name}{/stash:my_file}
  {/group_photo_entry}
  {/exp:stash:set_list:nested}
  {/exp:channel:entries}
{/exp:stash:set_list}

//Now we can use get list to spit out one particular entry using the match + against
variables. I'm assuming there will be a segment in the URL (say it's segment_3)
we can use to match a conditional against.
{exp:stash:get_list
   name='mystash'
   parse_tags='yes'
   parse_conditionals='yes'
   match="#^{segment_3}$#" against="entry_url"}

<h3>{entry_title} - {exp:stash:get_list:nested name="{entry_url}_gallery"} {my_title}</h3>

<!--[if lt IE 9]> <p>Note: for older browsers, the person's face will not be circled</p><div id="mydiv" style="width: {my_width}px; height:{my_height}px;"><img src="{my_file}" width="{my_width}" height="{my_height}" /> <![endif]-->
<!--[if gt IE 8]><!--> <div id="mydiv" style="width: {my_width}px; height:{my_height}px;"> <!--<![endif]-->
<canvas id="mycanvas" width="{my_width}" height="{my_height}">
</canvas>

<script type="text/javascript">

var c=document.getElementById("mycanvas");
var ctx=c.getContext("2d");
ctx.clearRect(0, 0, c.width, c.height);
drawphoto(c, ctx, drawcircle);

function drawphoto(c, ctx, onload){
var photo = new Image();
   photo.onload = function(){
      ctx.drawImage(photo,0,0,{my_width},{my_height});
      onload(c,ctx);
   };
photo.src = "{my_file}";
}

function drawcircle(c,ctx){
ctx.beginPath();
ctx.arc(
{exp:math formula='[1] * [2]' params='{my_scale}|{x}'},
{exp:math formula='[1] * [2]' params='{my_scale}|{y}'},
{exp:math formula='[1] * [2]' params='{my_scale}|{radius}'}*2
,0,2*Math.PI);
ctx.strokeStyle = 'red';
ctx.lineWidth = 4;
ctx.stroke();
}
</script>
</div>
{/exp:stash:get_list}

```

So basically we use the stash\_set\_list to capture **all** fields from a set number of entries. We use the `:nested` tag to create a related list from either a matrix or grid field within the parent entry.

With all that info now recorded, we can use stash\_get and stash\_get:nested along with `match=' and`against=\` to only return the valid stashed content from the list.

The code above is not guaranteed to work, I've simply refactored your code to illustrate how it should work. Once you've got it working, you can then start caching the results as stash can be saved to the DB in one blob saving a ton of queries, but thats for another time.

# Answer
> 0 votes
Stuartmcd69 got it right with the change in depth. Apparently, the update to Stash has parsing changes which caused this. When I changed the set\_list depth to '2' and removed the depth from get\_list, the template worked properly under the new version of Stash.

---
Tags: stash
---


title: apostrophe in username

text:
# Question
Title: apostrophe in username
Anyone able to provide what needs to be change in the core to allow this?

I was able to allow it in the email field by changing the regex in email\_helper.php but I am using zoo visitor and have email as username set and username is not allowing it.

I have read about every post on the matter out there but they are all for older versions of EE. I am running 2.8.

Please help, this might be a deal breaker for me at this point.

Thanks

Mike

# Answer
> 1 votes
You really shouldn't be allowing apostrophe's in the username field.

But assuming that you have some strange one-off reasoning behind it, you'll need to modify the logic involved with validating the username. The function you'll need to modify can be found in:

/system/expressionengine/libraries/EE\_Form\_validation.php

Simply look for this function:

```
function valid_username()

```

and modify it accordingly. Mine was on line 109.

---
Tags: ee2
---


# Question
Title: Permsissions error on cache dir on local server
I'm getting the following error on my local machine after installing EE...

**An Error Was Encountered**

**The following directory must be writable: /Applications/MAMP/htdocs/website.local/library/expressionengine/cache**

Using MAMP Pro and set all permissions to 777 to all directories, but still no luck. Any help is appreciated. Thanks

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

/*
|--------------------------------------------------------------------------
| ExpressionEngine Config Items
|--------------------------------------------------------------------------
|
| The following items are for use with ExpressionEngine.  The rest of
| the config items are for use with CodeIgniter, some of which are not
| observed by ExpressionEngine, e.g. 'permitted_uri_chars'
|
*/

$docroot = $_SERVER['DOCUMENT_ROOT'];
$address = ($_SERVER['SERVER_PORT'] == '443') ? 'https://'.$_SERVER['HTTP_HOST'] : 'http://'.$_SERVER['HTTP_HOST'];

$config['app_version'] = "273";
$config['install_lock'] = "y";
$config['license_number'] = "0000-0000-0000-0000";
$config['debug'] = "0";
$config['site_index'] = 'index.php';
$config['site_url'] = $address.'/';
$config['cp_url'] = $address."/manage.php";
$config['doc_url'] = "http://mywebsite.com/";
$config['theme_folder_url'] = $address."/themes/";
$config['theme_folder_path'] = $docroot.'/themes/';
$config['cp_theme'] = 'mcsquared';
$config['new_version_check'] = 'n';
$config['is_system_on'] = "y";
//$config['site_label'] = ''; // if you want to force the site_name
$config['cookie_prefix'] = 'website';

$config['enable_online_user_tracking'] = "n";
$config['enable_hit_tracking'] = "n";
$config['enable_entry_view_tracking'] = "n";
$config['dynamic_tracking_disabling'] = "";
$config['comment_word_censoring'] = "n";
$config['comment_moderation_override'] = "n";
$config['comment_edit_time_limit'] = "";
$config['allow_extensions'] = "y";

$config['tmpl_file_basepath'] = $docroot.'/views/templates/';

$config['template_debugging'] = 'n';

$config['snippet_file_basepath'] = $docroot.'/views/snippets/';
$config['snippets_sync_prefix'] = 'snippet:';

$config['ce_image_document_root'] = $docroot;
/*
|-----------------------------
| CE Image Basic Config Items
|-----------------------------
|
| The following items are for use with CE Image. They are all optional,
| as the defaults in the actual plugin will be used if not specified below.
*/
/*
| The *relative path* (to your web root) of the directory to cache images
| in. This path will override the $cache_dir variable in the plugin file,
| and can optionally be overridden via the cache_dir= plugin parameter.
*/
$config['ce_image_cache_dir'] = '/cache/';

/*
| The *relative path* (to your web root) of the folder to download remote
| images. This path will override the $remote_dir variable in the plugin
| file, and can optionally be overridden via the remote_dir= plugin
| parameter.
*/
$config['ce_image_remote_dir'] = '/cache/remote/';

/*
| The ce_image_memory_limit sets the amount of memory (in megabytes) PHP can
| use for the script (64 is generally sufficient). If the PHP memory_limit
| is set to a greater value, then this setting will not override it.
*/
$config['ce_image_memory_limit'] = 64;

/*
| If the plugin cannot determine the last change date of a remote image,
| wait this long (in minutes) before re-downloading the image:
*/
$config['ce_image_remote_cache_time'] = 1440;

/*
| The default quality to save a jpg/jpeg file. The quality can range from
| 0 (lowest) to 100 (highest) and should be a whole number.
*/
$config['ce_image_quality'] = 80;

/*
| You can optionally run images that are downloaded from remote sites
| through an XSS filter. The filter sometimes gives false negatives though.
| If you know and trust the source of your images, you can disable the
| filter by default. You can always override this per tag via the
| disable_xss_check= parameter.
*/
$config['ce_image_disable_xss_check'] = 'yes';

/*
| By default, CE Image will add in width and height attributes to the image
| tags it generates when using the ce_img:single tag. If you would like to
| disable this globally, you can use this setting. You can also change this
| on a per tag basis using the add_dims= parameter. The default is "yes".
*/
$config['ce_image_add_dims'] = 'no';

// file upload preferences
if ( !empty($docroot) )
{
    // Note: FCPATH is defined in index.php and manage.php -- where the app and view are init.
    $uploadpath = 'public/uploads';

    $config['upload_preferences'] = array(
        1 => array( # database id number
            'name'        => 'Default Directory', # display name in control panel
            'server_path' => FCPATH.$uploadpath.'/', # server path
            'url'         => '/'.$uploadpath.'/', # url path
            'allowed_types'=> 'all'
        ),
        2 => array( # database id number
            'name'        => 'Page Headers', # display name in control panel
            'server_path' => FCPATH.$uploadpath.'/pageheaders/', # server path
            'url'         => '/'.$uploadpath.'/pageheaders/', # url path
            'allowed_types'=> 'img'
        )
    );
}

/*
|--------------------------------------------------------------------------
| Base Site URL
|--------------------------------------------------------------------------
|
| URL to your CodeIgniter root. Typically this will be your base URL,
| WITH a trailing slash:
|
|   http://example.com/
|
*/
$config['base_url'] = '';

/*
|--------------------------------------------------------------------------
| Index File
|--------------------------------------------------------------------------
|
| Typically this will be your index.php file, unless you've renamed it to
| something else. If you are using mod_rewrite to remove the page set this
| variable so that it is blank.
|
*/
$config['index_page'] = "";

/*
|--------------------------------------------------------------------------
| URI PROTOCOL
|--------------------------------------------------------------------------
|
| This item determines which server global should be used to retrieve the
| URI string.  The default setting of "AUTO" works for most servers.
| If your links do not seem to work, try one of the other delicious flavors:
|
| 'AUTO'            Default - auto detects
| 'PATH_INFO'       Uses the PATH_INFO
| 'QUERY_STRING'    Uses the QUERY_STRING
| 'REQUEST_URI'     Uses the REQUEST_URI
| 'ORIG_PATH_INFO'  Uses the ORIG_PATH_INFO
|
*/
$config['uri_protocol'] = 'AUTO';

/*
|--------------------------------------------------------------------------
| URL suffix
|--------------------------------------------------------------------------
|
| This option allows you to add a suffix to all URLs generated by CodeIgniter.
| For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/urls.html
*/

$config['url_suffix'] = '';

/*
|--------------------------------------------------------------------------
| Default Language
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$config['language'] = 'english';

/*
|--------------------------------------------------------------------------
| Default Character Set
|--------------------------------------------------------------------------
|
| This determines which character set is used by default in various methods
| that require a character set to be provided.
|
*/
$config['charset'] = 'UTF-8';

/*
|--------------------------------------------------------------------------
| Enable/Disable System Hooks
|--------------------------------------------------------------------------
|
| If you would like to use the "hooks" feature you must enable it by
| setting this variable to TRUE (boolean).  See the user guide for details.
|
*/
$config['enable_hooks'] = FALSE;

/*
|--------------------------------------------------------------------------
| Class Extension Prefix
|--------------------------------------------------------------------------
|
| This item allows you to set the filename/classname prefix when extending
| native libraries.  For more information please see the user guide:
|
| http://codeigniter.com/user_guide/general/core_classes.html
| http://codeigniter.com/user_guide/general/creating_libraries.html
|
*/
$config['subclass_prefix'] = 'EE_';

/*
|--------------------------------------------------------------------------
| Allowed URL Characters
|--------------------------------------------------------------------------
|
| This lets you specify which characters are permitted within your URLs.
| When someone tries to submit a URL with disallowed characters they will
| get a warning message.
|
| As a security measure you are STRONGLY encouraged to restrict URLs to
| as few characters as possible.  By default only these are allowed: a-z 0-9~%.:_-
|
| Leave blank to allow all characters -- but only if you are insane.
|
| DO NOT CHANGE THIS UNLESS YOU FULLY UNDERSTAND THE REPERCUSSIONS!!
|
*/
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\\-';

/*
|--------------------------------------------------------------------------
| Enable Query Strings
|--------------------------------------------------------------------------
|
| By default CodeIgniter uses search-engine friendly segment based URLs:
| example.com/who/what/where/
|
| You can optionally enable standard query string based URLs:
| example.com?who=me&what=something&where=here
|
| Options are: TRUE or FALSE (boolean)
|
| The two other items let you set the query string "words" that will
| invoke your controllers and its functions:
| example.com/index.php?c=controller&m=function
|
| Please note that some of the helpers won't work as expected when
| this feature is enabled, since CodeIgniter is designed primarily to
| use segment based URLs.
|
*/
$config['enable_query_strings'] = FALSE;
$config['directory_trigger'] = 'D';
$config['controller_trigger'] = 'C';
$config['function_trigger'] = 'M';

/*
|--------------------------------------------------------------------------
| Error Logging Threshold
|--------------------------------------------------------------------------
|
| If you have enabled error logging, you can set an error threshold to
| determine what gets logged. Threshold options are:
|
|   0 = Disables logging, Error logging TURNED OFF
|   1 = Error Messages (including PHP errors)
|   2 = Debug Messages
|   3 = Informational Messages
|   4 = All Messages
|
| For a live site you'll usually only enable Errors (1) to be logged otherwise
| your log files will fill up very fast.
|
*/
$config['log_threshold'] = 0;

/*
|--------------------------------------------------------------------------
| Error Logging Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/logs/ folder.  Use a full server path with trailing slash.
|
*/
$config['log_path'] = '';

/*
|--------------------------------------------------------------------------
| Date Format for Logs
|--------------------------------------------------------------------------
|
| Each item that is logged has an associated date. You can use PHP date
| codes to set your own date formatting
|
*/
$config['log_date_format'] = 'Y-m-d H:i:s';

/*
|--------------------------------------------------------------------------
| Cache Directory Path
|--------------------------------------------------------------------------
|
| Leave this BLANK unless you would like to set something other than the default
| system/cache/ folder.  Use a full server path with trailing slash.
|
*/
$config['cache_path'] = '';

/*
|--------------------------------------------------------------------------
| Encryption Key
|--------------------------------------------------------------------------
|
| If you use the Encryption class or the Sessions class with encryption
| enabled you MUST set an encryption key.  See the user guide for info.
|
*/
$config['encryption_key'] = '';

/*
|--------------------------------------------------------------------------
| Global XSS Filtering
|--------------------------------------------------------------------------
|
| Determines whether the XSS filter is always active when GET, POST or
| COOKIE data is encountered
|
*/
$config['global_xss_filtering'] = FALSE;

/*
|--------------------------------------------------------------------------
| CSRF Protection
|--------------------------------------------------------------------------
|
| Determines whether Cross Site Request Forgery protection is enabled.
| For more info visit the security library page of the user guide
|
*/
$config['csrf_protection'] = FALSE;

/*
|--------------------------------------------------------------------------
| Output Compression
|--------------------------------------------------------------------------
|
| Enables Gzip output compression for faster page loads.  When enabled,
| the output class will test whether your server supports Gzip.
| Even if it does, however, not all browsers support compression
| so enable only if you are reasonably sure your visitors can handle it.
|
| VERY IMPORTANT:  If you are getting a blank page when compression is enabled it
| means you are prematurely outputting something to your browser. It could
| even be a line of whitespace at the end of one of your scripts.  For
| compression to work, nothing can be sent before the output buffer is called
| by the output class.  Do not "echo" any values with compression enabled.
|
*/
$config['compress_output'] = FALSE;

/*
|--------------------------------------------------------------------------
| Master Time Reference
|--------------------------------------------------------------------------
|
| Options are "local" or "gmt".  This pref tells the system whether to use
| your server's local time as the master "now" reference, or convert it to
| GMT.  See the "date helper" page of the user guide for information
| regarding date handling.
|
*/
$config['time_reference'] = 'local';

/*
|--------------------------------------------------------------------------
| Rewrite PHP Short Tags
|--------------------------------------------------------------------------
|
| If your PHP installation does not have short tag support enabled CI
| can rewrite the tags on-the-fly, enabling you to utilize that syntax
| in your view files.  Options are TRUE or FALSE (boolean)
|
*/
$config['rewrite_short_tags'] = TRUE;

/*
|--------------------------------------------------------------------------
| Reverse Proxy IPs
|--------------------------------------------------------------------------
|
| If your server is behind a reverse proxy, you must whitelist the proxy IP
| addresses from which CodeIgniter should trust the HTTP_X_FORWARDED_FOR
| header in order to properly identify the visitor's IP address.
| Comma-delimited, e.g. '10.0.1.200,10.0.1.201'
|
*/
$config['proxy_ips'] = "";

/* End of file config.php */
/* Location: ./system/expressionengine/config/config.php */

```

# Answer
> 1 votes
If a chmod 777 won't fix it, it could be a directory/file ownership issue.

First try letting OSX fix it. Open up Disk Utility app on your Mac, click on your primary partition (under your primary drive) and click "Repair Permissions".

If that doesn't work, you'll need to do a little homework to figure out the correct folder/file ownership permissions for your MAMP folder.

1) Open Terminal

2) cd into **/Applications/MAMP/htdocs/website.local/** via:

```
cd /Applications/MAMP/htdocs/website.local/

```

3) enter:

```
ls -la

```

4) observe the owner and group names which might look like this:

```
drwxrwxr-x  2 jarrett  staff   102 Mar 19  2014 library
drwxrwxr-x  2 jarrett  staff   102 Mar 19  241  themes
etc...

```

5) looking at the example above, jarrett would be the owner, staff would be the group

6) Now let's do a **chown** command to recursively update the directories and files within

```
chown -Rv root:admin /Applications/MAMP/htdocs/website.local/

```

or assuming you're already cd'd into the website.local directory, you can just do

```
chown -Rv root:admin .   (make sure to include that period)

```

6b) Alternatively, you can do a CMD + i and scroll to the bottom to view and update ownership as well. I usually trust **chown** more though. Using "Apply to enclosed items" should recursively perform the ownership update.

# Answer
> 0 votes
Can you confirm that is indeed the correct path to your cache folder?

Mine for example

/Users/username/Sites/sitename/system\_folder/expressionengine/cache

---
Tags: error, permissions, cache-folder
---


# Question
Title: Can Expresso Store or CartThrob be used without the shopping cart?
I'm preparing to redesign my employer's website that features more than 18,000 items. We're not ready to open the site for online sales but may do so in the future. I'm considering integrating an e-commerce system from the beginning for the benefits --- search, sort, filter, product-focused display --- and to make it much simpler to open the site for sales later. Do either Expresso or CartThrob allow the shopping cart and Buy Now functions to be turned off while the rest of the features are in use?

# Answer
Cartthrob uses regular channels and entries for products, orders etc. so it's perfectly possible to set up your site without Cartthrob and add the shopping cart functionality later.

If you aren't building an ecommerce site yet then you don't need Cartthrob yet. When you want to start selling, install Cartthrob, configure it (tell it which channels are for products, set up orders channel etc., configure the payment gateway) then add your checkout templates and away you go.
> 1 votes

# Answer
You shouldn't have a problem with using either of them without out actually using the shopping cart portion.

In Exp:resso Store you can simply add `disable_form="yes"` to the `{exp:store:product}` tag to prevent Store from creating a form that would allow the user to add the item to the cart. I would also recommend removing your submit button to make it less confusing for users.

CartThrob should have a similar functionality.

Either approach though the easiest way would be to just not include the template code to add an item to the cart.
> 0 votes

---
Tags: expresso-store, cartthrob, shopping-cart
---


title: Output custom author fields on entry

text:
# Question
Title: Output custom author fields on entry
I'm trying to output a custom field of the author of an entry. And no matter what I do, it wraps it in an `<a>` tag that I cannot do anything with. I just want to output that value, but ExpressionEngine keeps wrapping it.

All I do is this:

```
{exp:channel:entries channel="mychannel"}
    {custom_field}
{/exp:channel:entries}

```

And what comes out is this:

```
<a href="whatever is in this field">whatever is in this field</a>

```

And if I try to wrap it in an a tag myself, it wraps double.

```
<a href="<a href="whatever is in this field"></a>">Link here</a>

```

Do I really need to strip the output manually with either PHP or Javascript?

# Answer
> 1 votes
This sounds like the "auto hyperlink" feature built into each of the Channel preferences. This custom field doesn't happen to be a hyperlink or email address by chance?

If it is, simply disable this feature on a per channel basis by:

1. going to Admin \> Channels \> Edit Preferences (for whatever channel you want to edit),
2. Scroll down and set "Automatically turn URLs and email addresses into links" to NO.

--

You can also explore whether the custom field has a certain **Default Text Formatting** setting that's causing it to format differently on publish.

1. Admin \> Channel Fields
2. Click into a Group
3. Edit the field settings
4. Set **Default Text Formatting** to **no**

---
Tags: members, custom-fields
---


title: Tagger entries orderby

text:
# Question
Title: Tagger entries orderby
I'm using Tagger from devdemon and I wonder if it is possible to ordeby a customfield. It seems to me that the entries are orderby entry\_date and I can't find a way to change it.

# Answer
According to the documentation, there isn't one. However, looking at the add-on code, it appears you can either order by entry\_title, entry\_date, or random.

However, it would be quite easy for you to go into the logic and add another case statement to the existing switch/case statement. Look for this line:

```
switch ($this->EE->TMPL->fetch_param('orderby'))

```

in this file:

```
/system/expressionengine/third_party/tagger/mod.tagger.php

```

Then just add another case statement or modify the add-on to take any value:

```
    switch ($this->EE->TMPL->fetch_param('orderby'))
    {
        case 'entry_title':
            $this->EE->db->order_by('ct.title', $sort);
            break;
        case 'random':
            $this->EE->db->order_by('RAND()', FALSE);
            break;
        default:
            $this->EE->db->order_by('ct.entry_date', $sort);
            break;
    }

```

For instance, you could modify the default statement to accept any value; just know it will error if you provide a bad value (since this directly modifies the MySQL statement):

```
        default:
            $orderby = $this->EE->TMPL->fetch_param('orderby');
            $this->EE->db->order_by($orderby, $sort);
            break;

```
> 0 votes

---
Tags: devdemon-tagger
---


# Question
Title: DevDemon Updater not reading config overrides
Updater doesn't seem to be reading the Configuration File overrides that I'm setting in `config.php`.

Here's part of my config.php:

```
// $base_path and other variables defined above this
$config['updater_module_defaults']['path_map']['root'] = $base_path . '/';
$config['updater_module_defaults']['path_map']['backup'] = $base_path . '/updater_backup/';
$config['updater_module_defaults']['path_map']['system'] = $base_path . '/' . $system_folder . '/';
$config['updater_module_defaults']['path_map']['system_third_party'] = $config['third_party_path'];
$config['updater_module_defaults']['path_map']['themes'] = $config['theme_folder_path'];
$config['updater_module_defaults']['path_map']['themes_third_party'] = $config['theme_folder_path'] . 'third_party/';

```

And the Settings don't change as I update this file, nor are the input fields disabled. Updater appears to only use the settings in the database.

I'm using Updater 3.2.17 on EE 2.7.2

# Answer
> 1 votes
Have you tried:

```
// $base_path and other variables defined above this
$config['updater']['path_map']['root'] = $base_path . '/';
$config['updater']['path_map']['backup'] = $base_path . '/updater_backup/';
$config['updater']['path_map']['system'] = $base_path . '/' . $system_folder . '/';
$config['updater']['path_map']['system_third_party'] = $config['third_party_path'];
$config['updater']['path_map']['themes'] = $config['theme_folder_path'];
$config['updater']['path_map']['themes_third_party'] = $config['theme_folder_path'] . 'third_party/';

```

---
Tags: devdemon, devdemon-updater
---


# Question
Title: Is it possible to get a guest ticket for free?
I'm using cartthrob to sell tickets for events. For specific ticket types the user should have the possibility to create a guest ticket.

The guest ticket could be used by a user who is already registered or a new user. For me it's something like a cartthrob checkout for another user or a 100% coupon for this special event created after the successful payment.

Does somebody has any idea how to solve this problem?

Regards

# Answer
> 0 votes
That depends when the guest ticket gets added.

**Option1 - adding as a separate item**

Useful if offering as an option on cart page

Using the standard add to cart tag - http://cartthrob.com/docs/tags\_detail/add\_to\_cart\_form/index.html \- you could use the "on\_the\_fly" parameter to add a product that has no specific entry

**Option2 - adding on the event booking page**

Look at using the Multi add to cart tag - http://cartthrob.com/docs/tags\_detail/multi\_add\_to\_cart\_form/index.html \- that allows the customer to pick which items they want.

For the guest ticket you could hard code the values or pull in a channel entry, or use an "on\_the\_fly" tag. You could also use a custom field in the event channel to show/not show the guest ticket option.

---
Tags: cartthrob
---


# Question
Title: Matrix rows out of order when outputting
I'm outputting some images using a Matrix field, but they are outputting on frontend in a random order. I'm trying to output according to rows they are currently in.

I tried using `sort` and `orderby` Matrix field tags, but no luck.

Here's sample code:

```
{stash:content}
    {homepage_sliders}
        <li><img src="{image}" alt="{title}" /></li>
    {/homepage_sliders}
{/stash:content}

```

Ended up being a js issue with the flexslider script.

This wasn't working:

```
        $(window).load(function() {
            $('.flexslider').flexslider({
                animation: "slide"
            });
        });

```

Replaced with this and worked:

```
        $('.flexslider').flexslider({
            animation: "slide",
            start: function(slider){
              $('body').removeClass('loading');
            }
          });

```

# Answer
> 2 votes
Strange that you're getting a random output since orderby="id" is the default. Are you sure there isn't some kind of JavaScript that's reordering your fields on the front-end? You could try disabling JavaScript to verify that.

Otherwise you could try explicitly setting the id field as the orderby (which I've never had to do before).

```
{homepage_sliders orderby="id"}

```

but it definitely seems wrong.

There's also the fixed\_order="" parameter which let's you specify the order of the ids

```
{homepage_sliders fixed_order="1|3|2|4"}

```

---
Tags: matrix, templates, orderby, sort
---