$this->slot('demo')->set('one');
$this->slot('demo', 'two'); // set shortcut, not saved since 'one' is already set
echo $this->slot('demo')->get(); // 'one'
echo $this->slot('unset')->get('two'); // you can pass a default that returns if slot is empty
// --- custom file ---
slot('demo')->start(); // begin a buffer capture ?>
Heading
Customization
slot('demo')->end(); ?>
parentTemplate('footer.phtml'); ?> // pull a template from a parent theme
// --- footer.phtml ---
slot('demo')->start(); ?>
Ignored default
slot('demo')->end(); ?> // all slot actions return the slot's contents for easy display
^ Method ^ Description (all return slot contents) ^
| set($value) | Save a value, if it's the first value written |
| get([$default]) | Get the contents of a slot or a default if the slot is empty |
| append($value) | Add a string to the end of a slot and after all previous appends |
| prepend($value) | Add a string to the start of a slot and before all previous appends |
| clear() | Empty a slot and return the previous contents |
| start() | Start buffer capture to be saved in slot |
| end([$method]) | Ends a buffer capture. Method can be 'SET' (default), 'APPEND', or 'PREPEND' |
==== appendScript/appendStylesheet ====
When you want to add robust functionality to a page without loading lots of JS and CSS on every other page, headScript and headLink are the best way to go about it.
$this->headLink()->appendStylesheet('vendor/bootstrap-rtl.min.css');
$this->headScript()->appendFile("cart.js");