solved How to register JS or Css in the footer

alt=
adanhash
@famegroup
12 years ago
15 posts
Hi, can someone help me, i want to place JS and Css in the footer in the include.php.

the code in the tpl is this
{if isset($css_footer_href)}
{foreach from=$css_footer_href item="_css"}

{/foreach}
{/if}
{if isset($javascript_footer_href)}
{foreach from=$javascript_footer_href item="_js"}

{/foreach}
{/if}
{if isset($javascript_footer_function)}

{$javascript_footer_function}

{/if}

and in include is jrCore_register_module_feature('jrCore', 'javascript', 'jrCore', 'jquery-1.8.3.min.js');
but this register in the header how can i put it in the footer?

updated by @famegroup: 02/02/14 09:51:52AM
brian
@brian
12 years ago
10,149 posts
Is your javascript going to be used on every page, or specific pages?

Thanks!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
adanhash
@famegroup
12 years ago
15 posts
every page and how would i make it specific pages?
brian
@brian
12 years ago
10,149 posts
If it is every page, then you need to just register it like this:

 jrCore_register_module_feature('jrCore', 'javascript', 'yourModule', 'yourModule.js');

"yourModule.js" should be in your yourModule/js directory. This way the JS gets minified and compiled in with the system JS and there is not a separate request to download it.

To do it on specific pages you would use the jrCore_create_page_element() function - i.e.:

jrCore_create_page_element('javascript_footer_href', array('src' => 'http://path/to/js.js'));

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

updated by @brian: 12/22/13 10:33:46AM
alt=
adanhash
@famegroup
12 years ago
15 posts
Hi thanks Brian, ok if i want to register the JS from the skin folder into the footer how would i do it?
brian
@brian
12 years ago
10,149 posts
adanhash:
Hi thanks Brian, ok if i want to register the JS from the skin folder into the footer how would i do it?

You would need to just add the JS into your footer.tpl file.

Hope this helps!


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net
alt=
adanhash
@famegroup
12 years ago
15 posts
so wehats this mean in the nova footer.tpl
{if isset($css_footer_href)}
{foreach from=$css_footer_href item="_css"}

{/foreach}
{/if}
{if isset($javascript_footer_href)}
{foreach from=$javascript_footer_href item="_js"}

{/foreach}
{/if}
{if isset($javascript_footer_function)}

{$javascript_footer_function}

{/if}
brian
@brian
12 years ago
10,149 posts
Those are for javascript files placed there via the jrCore_create_page_element() function by a module view.


--
Brian Johnson
Founder and Lead Developer - Jamroom
https://www.jamroom.net

Tags