Solved

add javascript to the bottom of page

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

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Change Joomla Logo Graphic This tutorial goes over the steps to change the Joomla Logo in the template you are using. For this example we will be assuming you are using the rhuk_milkyway Joomla Template which is installed by default. You will …
What you will need: Any version of Photoshop or similar product (examples in Photoshop) Internet Access FTP Access to your joomla install or ability to upload images within joomla administrator backend Create Image: Lets start off with cre…

735 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