Solved

add javascript to the bottom of page

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
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 …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

760 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

21 Experts available now in Live!

Get 1:1 Help Now