tips icon image

EE Insider Tips
Sponsored by EE Screencasts

ExpressionEngine mini-howtos created by the EE Insider community.

Tips tagged “Templates”

Use conditionals to design your own URL structure

Posted on June 08, 2009 by JonnyUK

The EE docs state that URL’s at their simplest should be formatted using the following formula:

http://www.example.com/index.php/template_group/template/ 

But what if you want a more customised (or even dynamic) URL that doesn’t necessarily match the template name?

If you try to visit a URL

Read this tip

Custom counter for loops that don’t support {count}

Posted on June 01, 2009 by JonnyUK

Every now and then you might come across a situation where you want to count within a loop but unfortunately the {count} variable is not available.

This is a common problem when dealing with related entries because they are cached internally causing various dynamic statistical variables such as

Read this tip

Close PHP tags in your templates

Posted on June 01, 2009 by johndwells

If you’ve taken the time to learn some of PHP’s best coding practices, you may have come across the technique of omitting the PHP closing tag to avoid unintentional output of white space. For example, the Zend Framework’s coding standard has adopted this, explaining that:

“For files that contain

Read this tip

Save Templates to Files

Posted on May 30, 2009 by Sean Smith

if you prefer working on templates in your favorite text editor, and who doesn’t, you can still do that in ExpressionEngine.

Go to CP Home ›  Templates ›  Template Preferences

check “allow templates to be saved as files” and then enter the path to the folder on your server where the files

Read this tip

Use custom global variables in your templates

Posted on May 29, 2009 by Jason Morehead

While you can use sub-templates to contain common elements of your design (e.g., header, footer), you can also use custom global variables. For example, I often create a global variable called “analytics” that contains my Google Analytics code, and I insert this global variable throughout my

Read this tip

Create a “global” template group

Posted on May 29, 2009 by Jason Morehead

To take advantage of EE’s flexible templating system, I use “sub-templates” for aspects of my design that are common across the site (e.g., header, footer, menus, copyright info).

To keep these organized, I’ll create a “global” template group that contains all of these templates. Of course, you

Read this tip

Create a performance indicator

Posted on May 29, 2009 by Jason Morehead

When setting up a site, I often create a performance indicator that displays the number of queries and the time it took for EE to generate the page. This is helpful for debugging purposes, to test caching, etc.

I create a sub-template called something like “performance” (I use a sub-template so I

Read this tip

Clear the Caches

Posted on May 14, 2009 by Ryan Irelan

If you’re making changes to templates and the browser isn’t displaying what you think it should, try clearing the cache of your browser and the caches in ExpressionEngine. 

You can find the Clear Cache utility under Admin - Utilities. You can also manually delete the files from the cache

Read this tip

Search EE Insider Tips
Sponsored By