In the Joomla 2.5 Beez2 template, we see the following PHP code in the index.php file:

$doc->addScript($this->baseurl.'/templates/'.$this->template.'/javascript/md_stylechanger.js', 'text/javascript', true);

In this tutorial, we will focus on $this->template.

 

What is $this->template

To find out what the value is of $this->template, we will update our template's code as follows:

$doc->addScript($this->baseurl.'/templates/'.$this->template.'/javascript/md_stylechanger.js', 'text/javascript', true);
echo "<pre>" . $this->template . "</pre>"; die();

The output of the above is as follows:

beez_20

We can see that $this->template holds the value of the template that we're using, more specifically the folder name of the template. This information can be used to help build the path to files included within the template.

For example, if we wanted our template to reference:
http://domain.com/templates/beez_20/css/position.css

... we can use $this->template to help build the url to position.css. Because we know that all Joomla 2.5 templates are located in the templates folder, the URL can be constructed dynamically. This is helpful because it won't break our template if the user by chance moves Joomla to another folder on the server, or into a subfolder of the current domain.

Continued Education in Course 219: Joomla 2.5 Template Development Tutorial
You are viewing Section 9: Joomla 2.5 Templates - $this->template
Section 8: Joomla 2.5 Templates - $this->baseurl
Section 10: Joomla 2.5 Templates - $this->language
Did you find this article helpful?

We value your feedback!

Why was this article not helpful? (Check all that apply)
The article is too difficult or too technical to follow.
There is a step or detail missing from the instructions.
The information is incorrect or out-of-date.
It does not resolve the question/problem I have.
How did you find this article?
Please tell us how we can improve this article:
Email Address
Name

new! - Enter your name and email address above and we will post your feedback in the comments on this page!

Post a Comment

Name:
Email Address:
Phone Number:
Comment:
Submit

Please note: Your name and comment will be displayed, but we will not show your email address.

1 Questions & Comments

Post a comment

Back to first comment | top

Need more Help?

Search

Ask the Community!

Get help with your questions from our community of like-minded hosting users and InMotion Hosting Staff.

Current Customers

Chat: Click to Chat Now E-mail: support@InMotionHosting.com
Call: 888-321-HOST (4678) Ticket: Submit a Support Ticket

Not a Customer?

Get web hosting from a company that is here to help. Sign up today!