Friday, March 14, 2014

Customizing the Appearance of a Specific Node in Drupal 7

The customization we will be performing on the node in question is that it should only display its content and links to authenticated users. In other words, anonymous users will only be able to see its title but not content.

Here are the Steps to be Followed:

  • navigate to your Drupal root folder.
  • Go to sites --> all --> themes --> your theme folder. Here in my case, it is myzen.
  • Search for node.tpl.php in templates folder. if you are using myzen theme, you'll not find node.tpl.php file inside templates folder. You have copy from zen (theme)--> templates folder to your theme's template folder.
  • Next,open node.tpl.php file in you favorite editor.
  • search for the code as shown in below screenshot:








  • What we want to do is wrap the above code inside an if statement so that the resulting block looks something like the following:












  • Now clear the cache and rebuild registry.
  • To see if it's working or not , just log out from admin panel & visit the site.
  • you will see only title of a node & you're done.

No comments: