Modifying content output in drupal 7

The output of the drupal will come from either template files or theme functions. Lets modify the output content using node.tpl.php. We can use node template file i,e. node.tpl.php and overwrite it using node id or content type. Copy the node.tpl.php into your theme folder. If we want to change the output for particular content type, we can do it by renaming the file.
For example, if we want to customize the node template for a article content type, we would rename our file to:
node--article.tpl.php
Lets start with simple Example.Add the following lines of code in your node.tpl.php
    <h2 class="style"<?php print $title_attributes; ?>><a href="<?php print $node_url; ?>"><?php print $title; ?></a></h2>
In the above code we have just given a class to h2 named as style. Lets add some css to style. Add the following lines of code
.style{
font-color:red;
font-weight: bold;
text-decoration: underline;
}
Now heading will appear in red, bold font and with underlined text. 
This is how we can change the output using node.tpl.php. If you want to learn about drupal you can visit  Zenrays

Share this:

ABOUT THE AUTHOR

Ceyron Louis

Hello We are OddThemes, Our name came from the fact that we are UNIQUE. We specialize in designing premium looking fully customizable highly responsive blogger templates. We at OddThemes do carry a philosophy that: Nothing Is Impossible

    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment