Hello,

I want to add a div tag specifically around one content-type. In my example, I have many different types - news, page, story, etc. However, I want to add a div specifically around a content type called news. I can't work out how to do this. The website does use the Views module, but that is specifically only for news snippets blocks. Any ideas where I should be altering this?

Thanks...

Comments

Check out the Display Suite module. It will allow you to create a custom style template for each content type (or just one). They have a few built-in templates but you can create your own (literally just putting the new div).

Unfortunately, Display Suite only allows custom templates in D7, I have D6. One solution I had was to alter views.view.tpl.php. The variable classes pulls in a string of CSS classes appropriate to that page. I want to create an if statement that adds some text inside the div. As it is:

<div class="<?php print $classes; ?>">
    <div class="test"></div>
</div>

My idea:

<div class="<?php print $classes; ?>" <?php if ($classes = 'sample-text') {print 'some-newcode-inside-div';} ?> >
    <div class="test"></div>
</div>

My problem is that the following code always inserts the text some-newcode-inside-div regardless of whether or not the css class contains the string sample-text.

Any ideas?

A custom node-[content_type].tpl.php template file.

Checkin it out

That is solved! Many thanks for your solution. I actually needed this so i could add microdata tags to specific content types.