There are endless possibilities to made tricks with your template using a little bit of PHP code. Let me show you another one!

The technique relies on the fact that you can easily retrieve the active category alias:

$categoryalias = $this->item-category_alias;

From now on you can do almost anything using this. Let me show only one possible use! Let's say you want to add a category specific image to each article. all you need to do is to upload the pictures named accordingly (say alias1.jpg, alias2.jpg, where alias# is an existing alias of one of your categories) somewhere to your site - let's say in

 /images/stories/categories

directory, then insert in your article template override - for example in the

/yourtemplate/html/com_content/article/default.php

the necessary code to insert the image. For example this way:

<?php 
$categoryalias = $this->item-category_alias; echo '<img src="/images/stories/categories/'.$categoryalias.'.jpg">';
?>

And that's all! Of course this is just a simplest blueprint of what you can do with this information. Use your imagination to invent other ways to jazz up your site!


A website like reddragonwebmedia.com will provide you with the highest quality in the industry.

0
0
0
s2sdefault
Category: Template trickery