Your friends at Viget present Inspire, a Design & Interaction Blog

Notes From Our Default ExpressionEngine Build

This post is intended to build off of Doug’s Post: ExpressionEngine on Multiple Machines. So if you haven’t read that, I’ll wait for you.

All caught up? Ok, let’s go.

I’ve been lucky enough to build 3 EE sites in the past few months, so it’s given me time to look at our setup, make changes, and even to build some add-ons. I was hoping to share more about our default build, and maybe there are a few tips and tricks you might find useful.

Changes

Not that much has changed for us in our default build and process since Doug’s post, but here are the things that have:

Templates & Assets

Instead of keeping assets in the themes folder and templates in the EE system folder, we now have an assets folder at the root of the site. Here is what that folder looks like:

/assets
  - /build
  - /images
    - /structure
  - /scripts
  - /stylesheets
  - /templates

The build folder is for your raw markup before you move everything into EE. We have found out that it is super super useful to be able to go back and reference these files.

Moving the templates folder outside of the system folder makes updating EE easier, one less thing to worry about. Now if we can just get the ability to move the third_party folder…

We also have some basic listing and show templates in the template folder which makes it easy to get up and running.

Since I’ve been using Sass and Compass lately (have a look at Doug’s post about Sass and Compass), I have been adding a compile folder into assets too. So my assets folder has been looking like this:

/assets
  - /build
  - /compile
    - /pngquant
    - /sass
  - /images
    - /structure
  - /scripts
  - /stylesheets
  - /templates

Add-ons

The following are the third party add-ons that we have in our default build:

Freeform
This one is a no-brainer. Virtually every site we build has some sort of form on it.

Structure
Although we don’t use it on every site (I haven’t needed it in the three I’ve built), there is no doubt that Structure is brilliant and makes adding pages much simpler for clients.

Wygwam
In our opinion, the best WYSIWYG add-on.

Rest
Not used on every site, but anytime we need to interact with an API, Rest makes it much easier. Though it’s somewhat poorly documented, it’s still our preferred method for making REST requests.

Fix-ee
A little something something I just cooked up the other night. Ever notice that when you are adding a new text custom field, you ALWAYS set the formatting to None? This automatically selects None when you are creating a custom field in the hope that it will save you a few clicks. It also turns off the “Automatically turn URLs and email addresses into links?” setting when editing Channel Preferences.

Health Check
Gives a nice snapshot of the installation as well as any potential issues.

NSM Morphine Theme
We have slightly modified the free version of this add-on to make a few CP adjustments.

Template Variables
Makes it easy to access all custom fields, snippets, and global variables.

Direct to Structure
When we are using Structure, we like to bypass the useless “Preview"”page and go right to the Structure view.

Freebie
If we are using Structure, Doug’s add-on gives some flexibility back to your URLs.

Matrix
It’s hard to imagine building a site without Matrix.

Cache Buster
Since we took our CSS and JS out of EE templates, sometimes it’s helpful to cache bust those assets.

CE Image
Since Image Sizer (our previous image resizing add-on) fell off the face of the planet, we have been more than than happy with CE Image and all of it’s additional functionality. I LOVE being able to add configuration into the config.php instead of in the DB.

// CE Image
$config['ce_image_cache_dir'] = '/cache/images/made/';
$config['ce_image_remote_dir'] = '/cache/images/remote/';
$config['ce_image_memory_limit'] = 64;
$config['ce_image_remote_cache_time'] = 1440;
$config['ce_image_quality'] = 100;

EE Hive Hacksaw
Our preferred add-on for stripping tags and truncating text.

Switchee
Switchee supercharges your conditionals and improves performance. I have been using the nestable beta version.

Here are a few others that we have used more than once:

Stash
I have used the template partials approach on 2 of the 3 EE sites, and I have been very very happy with the way it works. This has allowed my templates to be so nice and clean, example of a news/index:

{exp:stash:set_value name="body_controller" value="news"}
{exp
:switchee variable="{segment_2}" parse="inward"}
  {
!-- Index and pagination request --}
  {case value
="#^P(\d+)$#|''"}
    {if {exp
:is_ajax} == "true"}
      {embed
="news/_entries"}
    {if
:else}
      {embed
="_layout/base"}
      {exp
:stash:set_value name="title" value="News"}
      {exp
:stash:set_value name="body_action" value="index"}
      {exp
:stash:set name="content"}
        {embed
="news/_listing"}
      {
/exp:stash:set}
    {
/if}
  {
/case}
  {
!-- Single --}
  {case 
default="Yes"}
    {embed
="news/_single"}
  {
/case}
    
{
/exp:switchee} 

Hon-ee Pot Captcha
I hate captcha. Like a lot. This add-on gives you the ability to add honey-pot captcha to Freeform, Comment, and Safecracker forms.

Minimee
This is my preferred method for minimizing JS (not necessary for CSS since I’m compressing with Sass). Again, I love having settings in the config.php:

// Minimee
$config['minimee_cache_path'] = $config['base_path'] . 'cache/assets';
$config['minimee_cache_url'] = $config['site_url'] . 'cache/assets';
$config['minimee_disable'] = ($_SERVER['SERVER_NAME'] === 'site.local') ? 'y' : 'n';

Is Ajax?
Another add-on that I created to detect whether something is an AJAX request. There was already a similar add-on out there, but I didn’t like how the tags were used.

DataGrab
This has been a lifesaver for importing content from previous EE or WP installs.

CP Menu Master
Very useful for removing one-entry channels. There are plenty of times where I have created a separate homepage channel just to publish one single entry.

Snippets

Here are a couple of useful snippets in our default build:

channel_disable_all
disable="categories|custom_fields|category_fields|member_data| pagination|trackbacks"

channel_disable_most
disable="categories|category_fields|member_data|pagination|trackbacks"

channel_disable_basic
disable="category_fields|member_data|trackbacks"

The previous three snippets make it easy to include the disable parameter in the channel entries tag:

{exp:channel:entries
    channel
="news"
    
{channel_disable_basic}
}
    
...
{/exp:channel:entries} 

date_format
%F %d, %Y

Does anyone actually remember all of the date formatting variables? Not me. Using a snippet makes it easy to have a consistently formatted date across the site:

{entry_date format="{date_format}"}

“Functional” Templates

In one instance when we were using Image Sizer on a site, we pushed the site to the live server, and for some reason, Image Sizer didn’t work on that server. So, we ended up making the switch the CE Image. But, the reason this was such an easy switch is because we had a single template for resizing images:

{if embed:src}
  {exp
:ce_img:pair
    src
="{embed:src}"
    
max_height="{embed:height}"
    
max_width="{embed:width}"
    
crop="yes"
  
}
    
<img src="{made}" alt="{embed:alt}" class="{embed:class}" width="{width}" height="{height}" />
  
{/exp:ce_img:pair}
{
/if} 

And then we just embed that template and pass in the image as an embed variable wherever we wanted to display it. Thinking of templates like this can be useful at times. Just think of it like a function that you pass parameters (embed variables) too.

What about you?

Are you guys using a default build? What do you have in it? Anything we can learn from yours? If you aren’t using a default built, I would put it at #1 on your todo list. We can get a new EE site ready to go locally in about 5 minutes now.


Get More From Viget

Subscribe to get our monthly newsletter and occasional special announcements.