Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I create a Content Type and I add to it a field (Embedded Media Field) that has thumbnails of Youtube videos.

Now the thumbnails use each a row on its own. I want to make them show in three columns, like in a grid. I understand i have to create a node-MyContentType.tpl.php . But in this file there is a $content variable that holds the html structure of the content and i can't find a way to change that (i want to remove some divs). Can anyone guide what to search for?

share|improve this question

2 Answers 2

Creating a template (node-MyContentType.tpl.php) for your content type is certainly helpful to manipulate the display of the entire node, but it sounds like what you're looking for is how to modify individual fields, and these are rendered in a different template.

Drupal uses template files and theme_xxx() functions to display elements on the site, and there is generally one template or theme function for each object (page, node, block, field, etc.). In order to override them, you use a feature called Template Suggestions. These are an alternate template (.tpl.php) file that you have created to override the base or original template file. Read more about these for Drupal 6 or Drupal 7.

The best way to create your own version of a template file is find the original one, copy it into your theme folder (don't modify the original!), and rename it using the "template suggestions" convention mentioned in the links above. In Drupal 6, you have to have both the base template (e.g. node.tpl.php) as well as the renamed one (e.g. node-mytype.tpl.php). In Drupal 7, having the base template in the same folder is not necessary.

In Drupal 6, fields are a part of the CCK module. Here's information on overriding CCK Field templates. The original template content-field.tpl.php is located in the CCK module under cck/theme.

In Drupal 7, fields are a part of the Drupal core code. The original template field.tpl.php is located in modules/field/theme.

share|improve this answer

To theme individual content types in different ways, you need to create a file node-[type].tpl.php in your theme's folder, where [type] is the machine readable name of the content type.

$content: Node content, teaser if it is a summary.

Basically you can edit the template file in anyway you, to add the fields you can make the use of $node: $node(object): The node object. To view all of the properties of a current $node object, put the following line of code in your node.tpl.php: <?php print_r($node); ?>

Also you can check the community docs for overriding the node template files: https://drupal.org/node/11816
https://api.drupal.org/api/drupal/modules!node!node.tpl.php/6
Theming nodes by content type

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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