drupaldrupal-viewsdrupal-5

is there an argument to know you're on a views list page?


I've had to move my page title into my node to accommodate a client need, but I'm unable to now get a title to display on a page view of my views list. The argument I have to display title on edit, admin and track pages is:

<?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's a generic argument to include either all views list pages, or, the inverse, just exclude all node pages (NB: I'm using CCK, so have a lot of content types)?


Sniffing out other possibilities...

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

Here's the code I'd through into template.php to get the ability 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


Solution

  • OK - I found my own solution that didn't require creating 20 plus page templates. For the above example, I added the condition of !node->type to my query, since view's don't provide a node-type, then went through the site ensuring that title's were 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