Skip to content

Instantly share code, notes, and snippets.

View croxton's full-sized avatar
💭
Up to my elbows, as usual

Mark Croxton croxton

💭
Up to my elbows, as usual
View GitHub Profile
@croxton
croxton / stash_full_page_cache.md
Last active April 8, 2018 02:24
Full page caching with Stash 2.3.8+ and @uri pointer
{!-- compile, parse and cache all nested Stash embeds --}
{stash:embed
    context="@URI"
    name="page_vm"
    file_name="viewmodels:page_vm"
    parse_stage="set"
    refresh="60"

}

@croxton
croxton / gist:4683017
Last active April 8, 2018 02:24
ExpressionEngine extension plugins
<?php
// Using __call() in the main extension
/**
* Call magic method
*
* @param string $name The method name being called
* @param array $arguments The method call arguments
*/
@croxton
croxton / gist:4555990
Last active April 8, 2018 02:24
stash:get_list comare var against value in a previous iteration
{exp:stash:get_list name="my_list"}
{if "{exp:stash:get name='list_var' default=''}" == "{my_list_variable}"}
do something
{/if}
{exp:stash:set name="list_var" random}{my_list_variable}{/exp:stash:set}
{/exp:stash:get_list}
{!-- note - added 'random' to the set in case {my_list_variable} has the same value in more than one row (prevents EE caching the tag) --}
@croxton
croxton / gist:4073583
Last active March 29, 2021 12:34
Install xdebug 2.2.0 for AMPPS on OSX
Grab the 'PHP Remote Debugging Client' (the pre-complied xdebug binary for OSX) from here:
http://code.activestate.com/komodo/remotedebugging/
Unzip it, find the folder that corresponds to the version of PHP you want to install it for and copy the xdebug.so file from there into your php extensions folder in the relevant PHP version directory. E.g. for PHP 5.4:
/Applications/AMPSS/php-5.4/lib/extensions/ext/
Now open PHP.ini in a text editor:
/Applications/AMPSS/php-5.4/etc/php.ini
@croxton
croxton / gist:4067524
Created November 13, 2012 18:34
Line 134
if ( $vars['template_debugging'])
{
foreach ($vars['template_debugging'] as &$debug_row)
{
$debug_row = htmlentities($debug_row);
}
}
unset($debug_row);
@croxton
croxton / stash_nested_embeds.md
Created October 29, 2012 14:23
Stash & template partials - nested embed

Required:

Stash 2.3.4 (beta) or later

Stash template directory

	/layouts/
		standard.html

	/partials/

listing.html

{!-- Standard pagination, e.g. /P15 --}
{!-- Works with match, against and offset params too --}
{!-- Use prefix="my_prefix" if you need a prefix for the pagination tag pairs / variables --}
{exp:stash:get_list
name="my_channel"
limit="5"
paginate="bottom"
}
@croxton
croxton / gist:3810681
Created October 1, 2012 10:08
Better Workflow > Assets integration
In ft.assets.php add this to the top of the pre_process function:
/**
* Pre Process
*/
function pre_process()
{
// -------------------------------------------
// Get the exp_assets_entries rows
// -------------------------------------------
@croxton
croxton / gist:3715803
Created September 13, 2012 16:59
./system/codeigniter/system/core/Input.php function ip_address()
/**
* Fetch the IP Address
*
* @access public
* @return string
*/
public function ip_address()
{
if ($this->ip_address !== FALSE)
{