I want to find a solution for my question in drupal 6.x

I have some pages that are created via node/add/page directly in drupal.

but some pages are as result of view module.

Now I want to theme the pages that are generated by views. for example I want to disable primary and secondary menus. change the location of some objects and etc....

I know that page.tpl.php is the base structure of pages. also page-nid.tpl.php is for special page that is directly made by drupal admin area.

but for the pages that are made by special view, how can I theme it . what is the format of tpl.php file for specific page that is created via specific view.

Please help me.

Thanks a lot.

let me explain more.

views-view.tpl.php contains the below codes.

 * @file views-view.tpl.php
 * Main view template
 * Variables available:
 * - $classes_array: An array of classes determined in
 *   template_preprocess_views_view(). Default classes are:
 *     .view
 *     .view-[css_name]
 *     .view-id-[view_name]
 *     .view-display-id-[display_name]
 *     .view-dom-id-[dom_id]
 * - $classes: A string version of $classes_array for use in the class attribute
 * - $css_name: A css-safe version of the view name.
 * - $css_class: The user-specified classes names, if any
 * - $header: The view header
 * - $footer: The view footer
 * - $rows: The results of the view query, if any
 * - $empty: The empty text to display if the view is empty
 * - $pager: The pager next/prev links to display, if any
 * - $exposed: Exposed widget form/info to display
 * - $feed_icon: Feed icon to display, if any
 * - $more: A link to view more, if any
 * - $admin_links: A rendered list of administrative links
 * - $admin_links_raw: A list of administrative links suitable for theme('links')
 * @ingroup views_templates
<div class="<?php print $classes; ?>">
  <?php if ($admin_links): ?>
    <div class="views-admin-links views-hide">
      <?php print $admin_links; ?>
  <?php endif; ?>
  <?php if ($header): ?>
    <div class="view-header">
      <?php print $header; ?>
  <?php endif; ?>

  <?php if ($exposed): ?>
    <div class="view-filters">
      <?php print $exposed; ?>
  <?php endif; ?>

  <?php if ($attachment_before): ?>
    <div class="attachment attachment-before">
      <?php print $attachment_before; ?>
  <?php endif; ?>

  <?php if ($rows): ?>
    <div class="view-content">
      <?php print $rows; ?>
  <?php elseif ($empty): ?>
    <div class="view-empty">
      <?php print $empty; ?>
  <?php endif; ?>

  <?php if ($pager): ?>
    <?php print $pager; ?>
  <?php endif; ?>

  <?php if ($attachment_after): ?>
    <div class="attachment attachment-after">
      <?php print $attachment_after; ?>
  <?php endif; ?>

  <?php if ($more): ?>
    <?php print $more; ?>
  <?php endif; ?>

  <?php if ($footer): ?>
    <div class="view-footer">
      <?php print $footer; ?>
  <?php endif; ?>

  <?php if ($feed_icon): ?>
    <div class="feed-icon">
      <?php print $feed_icon; ?>
  <?php endif; ?>

</div><?php /* class view */ ?>

But all of these codes are related to the block that is hold the view result.

tell me please, how can I change the primary link or logo object of the output page that is rendered by the view from these codes?

I want to edit the page.tpl.php that is related to the view's generated page. so imagine that my view name is latest_topics

now page.tpl.php should be renamted to what ?!?!?!

  • latest_topics-page.tpl.php ?
  • page-latest_topics.tpl.php?
  • or any other name ?

And finally I mean : Views-view.tpl.php doesn't override page.tpl.php Please help me.

I found the answer of my question.

the page url is www.domainname.com/latest-topics

so by created another page.tpl.php and renamed it to page-latest-topics.tpl.php it is working...

Thanks a lot friends.

  • In D7 these are called theme_hook_suggestions and you can add them by adding MY_THEME_preprocess_page(&$vars){} to your template.php file and then adding a custom patten to the $vars['theme_hook_suggestions'] array based on the variables in your vars array (in this case your view or the page URL). Not sure if it works 100% the same in Drupal 6 but I'd say there is something similar. If you have devel installed try running dsm($vars) in your preprocess function and see if you can see any theme arrays or anything to that tune. Sorry I couldn't be more help, I have eluded D6 for a while.
    – Sam Becker
    Jul 9, 2012 at 13:04
  • Thanks a lot. I found the answer. I have edited the first post.
    – Mehrdad201
    Jul 9, 2012 at 13:05

4 Answers 4


I found the answer of my question.

the page url is www.domainname.com/latest-topics

so by created another page.tpl.php and renamed it to page-latest-topics.tpl.php it is working...

Thanks a lot friends.


The templates and theme functions views uses depend a lot on how you configure the View. You can however see this info from within the views interface.

For Drupal 6 it should look something like this:

Views admin interface SS

As you can see, theme information gives you a list of possible template names and mark which one is currently used.

  • Thanks for your reply. but is CSS . by css we can hide object. I want to remove it from the source file. if I know the goal tpl.php file of page that is directly related to the page that is generated by view, I can edit the tpl file and remove extra objects or modify object location.
    – Mehrdad201
    Jul 9, 2012 at 12:23
  • @Mehrdad201 You seem to lack basic understanding of how theming work. You need to create a template file in your theme, not edit it in the source module. Also using templates like I shown above is not related to CSS, it is pure control of markup not CSS.
    – googletorp
    Jul 9, 2012 at 12:34
  • Dear @googletorp . I know that we can copy the tpl files of modules into our theme directory and rename theme and then edit theme. I explained my request in the first post. I modified my question.
    – Mehrdad201
    Jul 9, 2012 at 12:42

for example if you have a views and it's machine name is "car" then you have to copy the views-views.tpl.php file from the views/theme folder, then past it in the template folder of your theme that you used and rename it to "views-view--car.tpl.php".
last thing you should do is to clear the cache.

to get the correct name of the tpl.php file go to your views configuration and under "advanced" tab click on information link and get the views name

enter image description here


I have done this using a function in template.php.

function MY_THEME_preprocess_page(&$variables, $hook) {

        // Views Page Override
        if ($the_view = views_get_page_view()) {
        if($the_view->current_display == 'my_view_display_name') {
                $variables['theme_hook_suggestions'][] = 'page__my_custom_page';

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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