Published by Mijingo

tips icon image

EE Insider Tips
Sponsored by Mijingo's EE 2 Screencasts

ExpressionEngine mini-howtos created by the EE Insider community.

Tips tagged “Php”

Config Overrides for EE 1 and 2

Posted on June 17, 2010 by Ryan Irelan

I don’t think I’ve seen this one before, but the EE Wiki contains a full list of config.php overrides, which are easily found by doing the following in a EE 1.6.x template with PHP enabled:

<?php 
    
global $PREFS;
    
print_r($PREFS);
?> 

The list in the wiki is only for 1.6.7, so some may have

Read this tip

AJAX Request Code

Posted on June 02, 2009 by Kenny Meyers

In many frameworks there is a way to test if a request is AJAX or not. Sometimes I need to request partial templates with some EE code on them that I want to be accessible via AJAX only. I turn on PHP parsing on “before” and use the following.

<?php
    $AJAX 
= (isset($_SERVER[

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

Make assign_variable conditional

Posted on June 01, 2009 by johnniefp

I’m sure we all use assign_variable at the top of our templates, with a name like assign_variable you’d think you could do something like this:

{if segment_2 == ""}
  {assign_variable
:my_weblog="apples"}
{if
:else}
  {assign_variable
:header_image="{segment_2}"}
{
/if} 

Well you can’t! if you read

Read this tip

Search EE Insider Tips
Sponsored By