Solved

add javascript to the bottom of page

Posted on 2010-09-02
5
1,482 Views
Last Modified: 2012-05-10
i know we have joomla to add script to the header :

$document = &JFactory::getDocument();
$document->addStyleSheet( '/templates/bluechipvacations_2.0.0/css/sharelink.css' );

Anyone come across adding script to the bottom of the page?.. is there any Joomla method can do that ?
0
Comment
Question by:bcv2010
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 14

Expert Comment

by:Allan Nisbet
ID: 33585778
You could create a position at the bottom of the page
and use the custom code module which allows javascript and use the code in this modurmle
then assign this module to the bottom position

and your javascript will be there

Is this what you mean?

Storm

0
 

Author Comment

by:bcv2010
ID: 33587518
I am looking for the Joomla method to do that .... Not quite fancy to create too many module which will make it difficult to maintain in future.... I already have too much module to maintain at the moment
0
 
LVL 14

Expert Comment

by:Allan Nisbet
ID: 33588526
Modules are good though as you can switch them off and on when needed and assign them to different user groups they are less heavy on the server than say a component to do the same

the other good thing is you can set them to appear on a certain page only or embed within an article

Storm
0
 
LVL 25

Expert Comment

by:lenamtl
ID: 33589094
0
 
LVL 1

Accepted Solution

by:
dhaval_neesa earned 500 total points
ID: 33605609
You can put the code at the end of your template

Adding JavaScript
<?php
$document = &JFactory::getDocument();
$document->addScript( '/media/system/js/sample.js' );
?>

Adding Javascript Files Using JHTML
<?php
   $filename = 'filename.js';
   $path = 'path/to/file/'; // add the path parameter if the path is different than : 'media/system/js/'
   JHTML::script($filename, $path, true); // MooTools will load if it is not already loaded
?>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
URL Rewrite - 404 Errors 8 493
Joomla generating massive error log 7 201
Joomla 1.5 login message 9 66
Joomla - adding a new Admin user 5 83
Welcome Friends, This is the tutorial for how to create new simple module in joomla 1.5. In the module has two important files. One is XML file and another file is PHP controller file. First you need to create the XML file. (CODE) …
Have you ever wanted to use that sweet jQuery gallery plugin on your Joomla site but couldn't get it working due to jQuery conflicts or your lack of knowledge about what's under the Joomla hood? This article will step you through the process of impl…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

751 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question