Wednesday, August 12, 2009

My First Themed View!

Success! I just themed my first Views using customized tpl.php files. It was a very simple customization, but still, it's good to get something right on the first try.

Here's how to do it:

  1. In Views, edit the specific View display you would like to theme.

  2. Click on the theme link in Basic Settings. Mine said "Information".

  3. Pick the specific aspect of the theme you'd like to theme. In my case it was "Display Output".

  4. The tpl.php that is being used is in bold. Open that file with an editor (my file was located in Views/themes).

  5. Save the file in your theme directory, renaming it to the most specific name option in the theming information list. In my case, the file being used was views-view.tpl.php, which I renamed to views-view--press-releases--page-2.tpl.php and saved in my theme directory.

  6. Make the changes you need in the new file and save.

  7. Click the "Rescan Template Files" button at the bottom of the View theming information area.

No comments: