Interesting snippets

You can for each item click the ‘show if following page returns true’. to decide where blocks get displayed

display bock to a particular id

<?php

  global $user;
  if($user->uid == 1 ) {
    return true;
  }
  else
  {
    return false;
  }

display block only to particular node

<?php

$match=FALSE;
$types=array(‘story’ =>1);
if(arg(0)==’node’ && is_numeric(arg_(1))) {
  $nid=arg(1);
  $node=node_load(array(‘nid’ => $nid));
  $type=node->type;
  if(isset($types([$type])) {
    $match=true;
  }
}
return $match;
?>

display a block throughout al the forums

<?php
   if(arg(0) == ‘forum’) {
       return true;
   }
   if(arg(0) == ‘node’ && ctype_digit(arg(1))) {
      $node =node_loag(arg(1));
      if($node->type == ‘blog’) {
         return true;
      }
   }
   return false;
?>

 

Leave a Reply

Your email address will not be published. Required fields are marked *