Solved

add javascript to the bottom of page

Posted on 2010-09-02
5
1,476 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 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Need full URL displayed in email notice to customer in Virtuemart (Joomla) 5 363
joomla not showing pages 4 185
Advise requested on Payment Gateway 5 112
Joomla menu button 10 156
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) …
Here is a tutorial for making your own Joomla templates. Note before reading, you should have some existing knowledge of web development using HTML and CSS. Design Layout: Design your template in a graphics program like Adobe PhotoShop or Corel…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
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…

808 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