Back to Top

How to use Template Parameter in Joomla

Here is one quick article about to use Template Parameter in Joomla.You can change the functionality of template with the use of template parameters which you can set from admin panel.Parameters are an excellent way to make your template more flexible.

In Admin panel, default templates are included in the system and can use them.By adding code into the template file, you can retrieve the current value of the parameter.

In Joomla, We can configure component display functionality from template file with using the get method.

In index.php, To retrieve template parameters by following line of code:

params can be used to get and set parameters.params is automatically accessible in the global scope. This object has the member function get() which returns the parameter value given the name

Let’s have a look one example for the template parameter.

Here, Let’s see whether you want to load Show Back to Top Button in the template file or not.You can add an option for same by placing code into params.ini,templateDetails.xml file and then you can retrieve a value in the template file.

Step 1: TemplateDetails.xml

First of all, Let’s add parameters into the templateDetails.XML file by using the following line of code.

The templateDetails file can contain template parameters which can change the functionality of template. As Here, I have set that want to display MooTools library or not.

Step 2: Params.ini

Next, Lets stored the parameter in the file params.ini located in the folder of each template by adding following line of code into the params.ini file.

Step 3: Template File

Now, Parameters can be accessed from within the template by using code such as

Must Read:

Custom Query with Joomla
To disable component on front page in Joomla
To view Position in Joomla 2.5

That’s it.I hope this post will help you. Don’t Forget to Follow us on Twitter or Subscribe us to Get the Latest Updates.

Comments (2)

  1. Great Tutorial, it saves me a lot of brain-storming…

  2. What’s up i am kavin, its my first occasion to commenting anyplace, when i read this post i thought
    i could also create comment due to this sensible post.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Most Popular Posts

Event Delegation in jQuery

Posted on 8 years ago

Bhumi