How to theme the views in Drupal

In Drupal views are used to display the content , images etc.. to the users. Views has the own default template , to create the custom template.

In the Edit mode of views page , click on the Theme Information in the Basic settings block, in this block the theme information  will listed in order like Display Output, Style output , Row Style Output and the View-view.tpl.php will be enabled by default. To enable your custom temple, Go the views module directory and navigate to the View-> theme folder and copy the View-view.tpl.php to your custom themes in sites/all/themes/custom themes directory and rename the View-view.tpl.php  to views-view–frontage-top-content-slide.tpl.php (This is  the name displayed in the theme information block next to the  View-view.tpl.php ) and now clear the performance cache in the site configuration .Now the custom template would be activated and your start customizing the views in the  views-view–frontage-top-content-slide.tpl.php in your custom theming directory

In the custom template we can use the our own HTML and CSS , to style the views and to access the data we can use the  $row will return the raw sql result

to fetch the output use the following coding

Requirement :- Drupal

Leave a Comment

Your email address will not be published. Required fields are marked *

4 × 5 =