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 (3 votes)

66% thumbs up 33% thumbs down

How would you rate this answer?



Thank you for rating this answer.

How can I make articles use a different panel file based upon their category?

This guide is for versions of Interspire Website Publisher NX 1.7.*. If you have NX 2.0 this feature is built in and you can skip down to Part 2 to use it.

Part 1 -- Interspire Website Publisher NX 1.7.* only
Open: /includes/classes/class.panel.php

Find:

$parsedPanelData = "";

Then paste this code after it:

if(strpos($this->_htmlFile,"ViewArticlePanel.html") !== false){

    $origFile = $this->_htmlFile;
    $categoryId = $GLOBALS["AL_CLASS_ARTICLE"]->_catlist[0];
    $categoryName = $GLOBALS["AL_CLASS_ARTICLE"]->_catnames[$categoryId];
    $categoryName = str_replace(" ","_",$categoryName);

    $newFile = str_replace(".html","_" . $categoryName.".html",$this->_htmlFile);
    if(file_exists($newFile)){
        $this->_htmlFile = $newFile;
    }
}

Part 2 - Interspire Website Publisher NX 1.7.* and NX 2.0
Currently, all articles will use this file to display:

/templates/{your-template}/Panels/ViewArticlePanel.html

With the above code, this is now only the default. You can now create:

/templates/{your-template}/Panels/ViewArticlePanel_Arts.html

A template file that all the articles that have 'Arts' as their category will use. The format is:

/templates/{your-template}/Panels/ViewArticlePanel.html

CategoryName also has no spaces. If your category name does have a space, it will converted to an underscore. So say you have "My Example" as the category name. You can create:

/templates/{your-template}/Panels/ViewArticlePanel_My_Example.html
And put content or ads specific to that category in there.

If you have any troubles with this guide, please submit a support ticket via the control panel.

Related Articles

No related articles were found.

Attachments

No attachments were found.

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