fuelphp-casset icon indicating copy to clipboard operation
fuelphp-casset copied to clipboard

add support for head/footer locations

Open leemason opened this issue 12 years ago • 0 comments

just a quick one which ive added to my app.

i needed to be able to set js for the head, and for the footer sections of the site, so this is how ive added it:

in the head section.

if(Casset::group_exists('js', 'footer')){
    Casset::set_js_option('footer', 'enabled', false);
}
echo Casset::render_js();

in the footer section

if(Casset::group_exists('js', 'footer')){
    Casset::set_js_option('footer', 'enabled', true);
}
echo Casset::render_js();

ive actually added this using the Event class for fuel, but it would work by just putting this in the view files too.

namepsaces still work fine, so files can still come from custom locations.

this works fine for me, but maybe some "global" footer/head groups could be created to prevent the need to check if the group exists first (without the checks the class throws an exception)

or event better add a var in the render function which allows us to set if the call in the head or footer, like:

echo Casset::render_js(false, true);

where true means we are in the footer.

leemason avatar Sep 29 '13 11:09 leemason