Book Image

Joomla! 1.5 Templates Cookbook

Book Image

Joomla! 1.5 Templates Cookbook

Overview of this book

Templates in Joomla! provide a powerful way to make your site look exactly the way you want either using a single template for the entire site or a separate template for each site section. Although it sounds like an easy task to build and maintain templates, it can be challenging to get beyond the basics and customize templates to meet your needs perfectly.Joomla! 1.5 Templates Cookbook consists of a series of self-contained step-by-step recipes that cover everything from common tasks such as changing your site's logo or favicon and altering color schemes, to custom error pages and template overrides. It starts off with the basics of template design and then digs deep into more complex concepts. It will help you make your site more attractive and user-friendly. You will integrate your site with various social media such as Twitter and YouTube; make your site mobile-friendly with the help of recipes for creating and customizing mobile spreadsheets; and use miscellaneous tricks and tips to get the most out of your website. You get all of this in a simple recipe format that guides you quickly through the steps and explains how it all happened.
Table of Contents (16 chapters)
Joomla! 1.5 Templates Cookbook
Credits
About the Author
About the Reviewers
Preface

Including a JavaScript file in your Joomla! template


One of the most basic aspects of using JavaScript with your Joomla! template is including it within the page. There are two ways to do this—within the<head> element of your template, or within the<body> element of your template (best placed just above the</body> element). We'll make use of the method that uses the<head> template. (The reasons to do so are covered in another recipe of this chapter.)

Getting ready

Open your template's index.php template, located in your template's subdirectory within your Joomla! installation's templates directory.

How to do it...

  1. 1. Locate the<head> element of your Joomla! template in the index.php file and insert a<script> element that references the JavaScript file(s) that you wish to use:

    <!-- some HTML omitted for brevity -->
    <script
    type="text/javascript"
    src="<?php echo $this->baseurl ?>/templates/rhuk_milkyway/js/javascript-file.js"></script...