By Ustas on
Hello, everyone!
Is there any ability to attach javascript files to specific pages only (e.g. front page) using info file? Could not find anything about it. :(
Thank you.
Hello, everyone!
Is there any ability to attach javascript files to specific pages only (e.g. front page) using info file? Could not find anything about it. :(
Thank you.
Comments
inserting javascript into the front page
I'm not so sure about using the info files but you can use the theme.
There's a few ways of doing that..perhaps the easiest is to copy your page.tpl.php file, rename it page-front.tpl.php and insert your link to the javascript you want to load just after the
<?php print $scripts ?>line. example below:<script type="text/javascript" src="<?php print base_path() . path_to_theme() ?>/yourjs.js"></script>Where your.js is the name of your javascript file located in your default theme folder.
Alternatively you can use this snippet in your page.tpl.php and copy your javascript into your theme folder.
phil
Yeah! This works for me.
Yeah! This works for me. ;)
Thanks a lot!
which one..
hi ustas.
which option did you use? It would be handy to know which one you found easiest.
phil
I have separate template for
I have separate template for my front page. So, I used first one.