This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{exp:stash:set_value name="tc" value="{exp:playa:total_children}" parse="inward" type="snippet"} | |
{exp:ifelse parse="inward"} | |
{if tc > 10} | |
... | |
{if:else} | |
.... | |
{/if} | |
{/exp:ifelse} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- file at stash_templates/my_context/my_template.html --} | |
{!-- standard embed syntax --} | |
{stash:embed name="my_context:my_template"} | |
{!-- shortcut embed syntax --} | |
{stash:embed:my_context:my_template} | |
{!-- set embed name dynamically from a Stash variable --} | |
{stash:embed name="{stash:layout}"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- handle language fields --} | |
{services_languages} | |
{!-- language switcher --} | |
{exp:stash:append name="page_languages" type="snippet"} | |
<option value="/{exp:cat2:url_title category_id='{language}'}{structure:page:uri}{exp:stash:get name='tab' type='snippet'}"{if "{global:lang}" == "{exp:cat2:url_title category_id='{language}'}"} selected="selected"{/if}>{exp:cat2:name category_id="{language}"} ({exp:cat2:url_title category_id="{language}"})</option> | |
{/exp:stash:append} | |
{!-- capture language fields --} | |
{exp:stash:set name="page_title_{exp:cat2:url_title category_id='{language}'}" type="snippet" parse="inward"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My Apache config for a VPS with 2Gb Ram and the following: | |
* CentOS | |
* cPanel | |
* Apache 2.x (MPM Prefork) | |
* Nginx as a reverse proxy for static files (Nginx Admin cPanel plugin) | |
* APC, or eAccelerator for opcode caching | |
* One or multiple ExpressionEngine websites | |
min spare servers 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
My Apache config for a VPS with 2Gb Ram and the following: | |
* CentOS | |
* cPanel | |
* nginx as a reverse proxy for static files | |
* APC opcode caching for PHP | |
min spare servers 2 | |
max spare servers 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); | |
/** | |
* Rewrite and extend the Loader class on the fly, to make some useful properties public again | |
* | |
* @package CodeIgniter | |
* @author Mark Croxton ([email protected]) | |
* @copyright Copyright (c) 2012 Hallmark Design | |
* @link http://hallmark-design.co.uk | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CI 2.1-stable Active Record tries to escape db tables, fields and aliases with backticks, however it can trip up on queries such as... | |
$this->CI->db->where("last_activity < {$expire}"); | |
... which is an example actually used in the Session class in 2.1-stable. | |
So out of the box you will get an SQL error when using database sessions. | |
Of course that should probably be rewritten: | |
$this->CI->db->where("last_activity <", $expire); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sometimes this value is blank | |
{exp:stash:get_list name='result_data'}{if '{cf_catentry_date}' != ''}{cf_catentry_date}{/if}{/exp:stash:get_list} | |
// find in mod.stash.php: | |
if ( $this->not_empty($matches[1]) || $matches[1] === '0') | |
{ | |
$stash_vars[substr($key, 6)] = preg_replace('/'.LD.'stash:[a-zA-Z0-9\-_]+'.RD.'(.*)'.LD.'\/stash:[a-zA-Z0-9\-_]+'.RD.'/Usi', '', $matches[1]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{!-- build result rows --} | |
{exp:stash:set parse_tags="yes"} | |
{stash:results_rows} | |
{exp:channel:entries | |
channel="my_channel" | |
limit="10" | |
paginate="bottom" | |
dynamic="no" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Put parameters on separate lines, and be consistent in the use of quotes: double quotes for params on the main tag, single quotes for params in the tag passed as a parameter: | |
{exp:stash:set_value | |
name="ref" | |
type="snippet" | |
output="no" | |
value="{exp:stash:get name='ref_{entry_id}' type='snippet'}" | |
parse="inward" | |
} |