Solved

add javascript to the bottom of page

Posted on 2010-09-02
5
1,457 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
5 Comments
 
LVL 13

Expert Comment

by:StormITSolutions
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 13

Expert Comment

by:StormITSolutions
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 24

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Convert Nigeria naira to gbp in PayPal 6 335
Move Joomla from dev to prod 1 111
Enabling compression in WARP Framework template 5 86
Customizing themes 14 69
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) …
First of all, we will need Jumi component or Sourcerer plugin for this to work. We need either of these because the main focus here is custom development outside of the standard modules or articles within Joomla. You can find Jumi here...it's my …
Internet Business Fax to Email Made Easy - With  eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, f…
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now