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 / gist:5965737
Created July 10, 2013 12:04
jquery offset() problem
$('.scroll').click(function() {
var $target = $(this.hash);
if ($target.length && $target.html()!=undefined) {
var targetOffset = $target.offset().top;
$('html, body').animate({scrollTop: targetOffset}, 600);
}
return false;
@croxton
croxton / header--patch.php
Last active May 31, 2016 20:43
If your clients use IE, do them and yourself a favour and disable the compatibility button in the Control Panel by editing ./system/expressionengine/views/_shared/header.php Why? Because many popular fieldtypes break the publish screen with the compatibility button pressed.
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

##The problem:

When trying to cache a Stash embed or other post-processed Stash tag, ce_cache is caching only the placeholder for the post-processed tag.

http://devot-ee.com/add-ons/support/ce-cache/viewthread/9155

##Solution 1

Use process="start" or process="inline" instead, so the embed/tag is not post-processed:

@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