0

So I know you can define how to display a teaser for different content types using if($teaser) in node--content_type.tpl but how can I add logic to render the teaser in different formats depending on the content type of the page in which it is being displayed?

I want to do this

if($teaser && CONTENT_TYPE_OF_PAGE_THAT_TEASER_IS_DISPLAYED_ON == content_type)

within node--content_type.tpl is there a way to go about this?

For example I have teasers of content type blog. But I want these teasers to display different when they are on a page of content-type:blog, to when they are displayed on a page of content-type:level_3.

Thanks for your time

3

2 Answers 2

0

Have you tray display suit?

Display suit let you configure how you want to print the teaser and the full content type with a great UI

Oskar

0

It is possible. In *node--content_type.tpl* I can get the content type of the page in which the teaser is displayed like so:

$node = menu_get_object($type='node');

I can then use logic to render my teasers in different ways depending on the page's content type:

if($teaser && ($node->type == 'my_content_type')){
    //render in this way
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.