Interspire Product Knowledge Base

Would you like to...

Print this page Print this page

Email this page Email this page

Post a comment Post a comment

Subscribe me

Add to favorites Add to favorites

Remove Highlighting Remove Highlighting

Edit this Article

Export to PDF

User Opinions (6 votes)

83% thumbs up 16% thumbs down

How would you rate this answer?



Thank you for rating this answer.

How can I get categories to use different template files?

Open up /includes/classes/class.categories.php find this line:

$GLOBALS["AL_CLASS_TEMPLATE"]->SetTemplate("Categories");

(Should be there twice, near each other).

the "Categories" bit means to use /templates/{your template}/Categories.html

So if you change it to:

$GLOBALS["AL_CLASS_TEMPLATE"]->SetTemplate("Blah");

It will use /templates/{your template}/Blah.html

We can use this in our favour by creating a set of if statements like this:

if($this->_catId == 1){
    $template = "FirstCategory";
}elseif($this->_catId == 5){
    $template = "AnotherCategory";
}else{
    $template = "Categories";
}
$GLOBALS["AL_CLASS_TEMPLATE"]->SetTemplate($template);

Above, you will see the if statements like:

if($this->_catId == 5){

On the right is the CategoryID of the category you want to have the template on the next line. To get the CategoryID of a category you want to have a custom layout, hover over the Edit link for it in the Control Panel and the URL for it will have &catId=5 and that number there is the one you want in your if statement. Then you can create a new template file as /templates/{your template}/AnotherCategory.html

If you have any troubles with this guide, send in a support ticket via your client area.

Powered by Interspire Knowledge Manager - World's #1 Best Selling FAQ and Knowledge Base Software