footer extra content - attribute
So i have moved the required js files into the root /js folder, and want to be able to add a footer extra content on the pages where the extra js files are required. This should speed up the initial page loading time.
I can see the attribute for Header Extra Content and i want o be able to add another for footer extra content to be placed at the bottom of the footer just before the
can anyone help me create such a custom attribute?
or ideally edit the block to load their js after the
<?php Loader::element('footer_required'); ?>
This is for concrete5.5.1
sure I could then create a page type for the pages I want the js to load and then create another footer.php (with another name) in the elements folder which gets loaded by that new page type - but there surely is a limply way to add a custom Attribute that would allow you to add a Footer Extra Area enabling you to add the custom scripts page by page.
<?php $a = new Area('MyCode'); $a->display($c); ?>
To get you started can do something like this in your theme header.php file above Loader::element('header_required.php')
Anyhow, I have no idea if that actually works as is. But if you give it a shot, please let me know as it would help in what I'm doing.
Now I know about and have coded a script that allows me to add to the
<?php Loader::elements('header_required'); ?>
What my script would allow me to do was whenever I was logged into the site it would disable the jQuery pluggin.
This got me to thinking. What if I could do the same for the footer_required. So I went into the Concrete5 main directory and added my script on line 9 of the page. I wanted the same effect like with the header_required.
So if you need to have a script run at the bottom of the page.
You should grab a copy of the footer_required.php found in the main directory and add it to your directory within your elements folder to override to core version.
Another way around this is to create a file called extra_footer.php and place it in your elements folder of your theme and create a clone of the page_type you want it on and call to it like this;
<?php $this->inc('elements/extra_footer.php'); ?>
and place under your <?php Loader::elements('footer_required'); ?>
I abuse this method a lot for sub content areas on sites that I build using C5.
Hope my tale was helpful :P
thank you in advance.
Then down in the footer I added this:
This worked fine per se, but I then discovered that both Nivo Slider and a lightbox script I use require their js to be loaded in the head, after jquery, so that scuppered my plans! Had this not been an issue I would have then reintroduced $this->controller->outputHeaderItems() inside a login conditional.