How to add JavaScript to the joomla Template

Source: Internet
Author: User
Tags mootools

Introduction: This is a detailed page on how to add JavaScript to the joomla template. It introduces PHP, related knowledge, skills, experience, and some PHP source code.

Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 332631 'rolling = 'no'>
This articleArticleIt is mainly for those who do not know much about PhP, hmtl and javascriptr. It tells you how to easily add JavaScript to the template using joomla1.5 API cballs.

Use the followingCodeAdd the path of the Javascript library file/Media/system/JS/sample. js to the template:

View Source

Print?

1. <? PHP

2. $ document = & jfactory: getdocument ();

3. $ document-> addscript ('/Media/system/JS/sample. js ');

4.?>

You can also use the JHTML method to add a Javascript file:

View Source

Print?

1. <? PHP

2. $ filename = 'filename. js ';

3. $ Path = 'path/to/file/'; // Add the path parameter if the path is different than: 'Media/system/JS /'

4. jhtml: script ($ filename, $ PATH );

5.?>

The third parameter is a Boolean value. If you want to load mootools (a concise, modular, and object-oriented JavaScript framework. It helps you to write scalable and compatible JavaScript code more quickly and easily.) set this value to true.

View Source

Print?

1. <? PHP

2. $ filename = 'filename. js ';

3. $ Path = 'path/to/file/'; // Add the path parameter if the path is different than: 'Media/system/JS /'

4. jhtml: script ($ filename, $ path, true); // mootools will load if it is not already loaded

5.

6.?>

Note: version 1.6 may be different.

From: http://www.lamp99.com/joomla/how-to-add-javascript-to-a-joomla-template-to/

More articles about how to add JavaScript to the joomla Template

Love J2EE follow Java Michael Jackson video station JSON online tools

Http://biancheng.dnbcw.info/php/332631.html pageno: 11.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.