Skip to content

Instantly share code, notes, and snippets.

@rsanchez
Created June 21, 2012 20:21
Show Gist options
  • Save rsanchez/2968310 to your computer and use it in GitHub Desktop.
Save rsanchez/2968310 to your computer and use it in GitHub Desktop.
Using stash to move safecracker JS to footer
{exp:safecracker channel="foo" include_jquery="no"}
{exp:stash:set name="safecracker_head"}
{safecracker_head}
{/exp:stash:set}
......
{/exp:safecracker}
......
<script type="text/javascript" src="/js/jquery.min.js"></script>
{exp:nest parse="inward"}
{exp:stash:get name="safecracker_head"}
{/exp:nest}
</body>
</html>
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
$plugin_info = array(
'pi_name' => 'Nest',
'pi_version' => '1.0.0',
'pi_author' => 'Rob Sanchez',
'pi_author_url' => 'http://github.com/rsanchez',
'pi_description' => 'Useful when you need to delay the parsing of the inner, nested tag.',
'pi_usage' => '{exp:nest parse="inward"}
{exp:other:tag}
{/exp:nest}',
);
class Nest
{
public $return_data = '';
public function Nest()
{
$this->EE =& get_instance();
return $this->return_data = $this->EE->TMPL->tagdata;
}
}
@rsanchez
Copy link
Author

Actually, with the latest from the dev Stash branch you can do this without the nest plugin:

{exp:stash:get name="safecracker_head" process="end"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment