Forums / General / Knowing if a node view template is overridden from a tpl

Knowing if a node view template is overridden from a tpl

Author Message

Massimiliano Bariola

Thursday 12 April 2007 6:43:14 am

hi,

I want to add a breadcrumb navigation to my site and the standard code for them does a fine job of giving me links for each node in the hierarchy. the problem is that there are some nodes which are shown with the standard template that of course looks out of place and broken.

So what I need is some way to "know" within the pagelayout if the node I will print the name and URL to in the breadcrumb trail, will use its fallback full.tpl or a template I have customized.

e.g: the default output for the breadcrumb code goes like this:

MyRootNodeName > Categories > ShowAsFavorites > OnTheRoad > MyNiftyOnTheRoadArticle

of course the "ShowAsFavorites" is a folder by which the editor controls a certain behavior on the site by adding / removing objects there. That folder has no need to have a special visualization.

is there some operator combo or trick I can use from the template to know what tpl I will be using as "full" for a node?

thanks

Michael Lee

Thursday 12 April 2007 7:32:42 am

Hi Massimiliano,

You can add an attribute to specify the navigation status in your content class and set them to different values in content objects. The attribute type and meaning depends on your requirements.
For example, you can define a check box in content class to specify if it should be shown in navigation or not. You can also define a text-line attribute as the navigation link URL, and if the navigation link is empty, the default $node.url_alias will be used, otherwise, the specified URL will be used.

Does it answer your question?

Michael Lee | Managing Director | ZerusTech Ltd | www.zerustech.com

Skype: zerustech

Massimiliano Bariola

Monday 16 April 2007 2:48:26 am

hi Michael,

your solution surely will address the problem, but it involves some extra work from content editors and from programmers to enact it. I hoped to find a more structured and robust. solution that will ease the burden on the users.

Yours will surely work; but I don't want to change 30 content classes and manually set all those flags for all the content objects I have :) (currently 1000 and not easy to write rules to do that in a programmatical way - except for to check for which templates is the node using, which again puts me back to my original problem).

ciao and thank you again

M.

Massimiliano Bariola

Monday 23 April 2007 5:33:53 am

.... no one has any tip?

ciao