Is there an argument to know that you are on the view list page?

I had to move the title of my page to my node to suit the needs of the client, but I cannot now get the title to display on the view page of my watchlist. The argument I should be showing in the edit, admin and track pages is as follows:

<?php if ($title && ((arg(2) == 'track') || (arg(2) == 'edit') || 
  (arg(0) == 'admin'))): ?>
    <h1 class="title"><?php echo $title; ?></h1>
<?php endif; ?>

      

and I'm wondering if there is a general argument to include all pages of the list of views, or conversely to just exclude all node pages (NB: I am using CCK, so you have a lot of content types)


Sniffing out other possibilities ...

I know I can create different page templates for my content types, but can I create one page template for ALL of my CCK content types?

Here is the code I passed to template.php to be able to add individual content type templates:

function _phptemplate_variables($hook, $vars) {
  switch ($hook) {
    case 'page':  
      if ($vars['node'] && arg(2) != 'edit') {
        $vars['template_files'][] = 'page-'. $vars['node']->type;
      }
      break;
  }
  return $vars;
}

      

Cheers
Steve

+1


source to share


2 answers


OK - I found my own solution that didn't require creating 20+ page templates. In the example above, I added a condition !node->type

to my request as the view does not provide a node type and then travels through the site ensuring that the header is disabled at the page view level where needed.

<?php if ($title && ((arg(2) == 'track') || (arg(2) == 'edit') 
  || (arg(0) == 'admin') || !$node->type)): ?>
    <h1 class="title"><?php echo $title; ?></h1>
<?php endif; ?>

      



Thanks for listening :-)
Steve

+3


source


In case anyone else is investigating some similar questions, another way to provide an argument in the node.tpl file to be applied when the node is displayed via the View () module would be using:

if ($ page == 0)



Anything following this will be ignored for "regular" display of a single node. This does not work on page.tpl, so if you want to return a title for all pages generated through Views, you can add it to the views-view.tpl.php file and add it to the theme. Or other more specific tpl Views files can be added for specific view types.

0


source







All Articles