real world example in drupal 5

Last modified: November 8, 2008 - 21:23

<div class="node<?php print ($sticky) ? " sticky" : ""; ?>">
  <?php if ($page == 0): ?>
  <?php else: ?>
    <?php print $picture ?>
    <em class="info"><?php print $submitted ?></em>
  <?php endif; ?>

  <?php
   
global $current_view;
    if(
$teaser) {
      if(
$current_view->name == 'frontpage')
      {
?>

        <?php foreach ((array)$node->field_news_image as $item) { ?>
          <div class="field-item"><?php print $item['view'] ?></div>
        <?php } ?>
        <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
        <?php print $node->content['body']['#value'];
      }

      if(
$current_view->name == 'ghana_page')
      {
?>

        <?php foreach ((array)$node->field_news_image as $item) { ?>
          <div class="field-item"><?php print $item['view'] ?></div>
        <?php } ?>
        <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
        <?php print $node->content['body']['#value'];
      }

      if(
$current_view->name == 'africa_page')
      {
?>

        <?php foreach ((array)$node->field_news_image as $item) { ?>
          <div class="field-item"><?php print $item['view'] ?></div>
        <?php } ?>
        <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
        <?php print $node->content['body']['#value'];
      }
       if(
$current_view->name == 'business_page')
      {
?>

        <?php foreach ((array)$node->field_news_image as $item) { ?>
          <div class="field-item"><?php print $item['view'] ?></div>
        <?php } ?>
        <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
        <?php print $node->content['body']['#value'];
      }

      if(
$current_view->name == 'gh1' || $current_view->name == 'gh2')
      {
?>

        <?php foreach ((array)$node->field_news_image as $item) { ?>
          <div class="field-item"><?php print $item['view'] ?></div>
        <?php } ?>
        <h2><a href="<?php print $node_url ?>" title="<?php print $title ?>"><?php print $title ?></a></h2>
        <?php print substr($node->content['body']['#value'], 0, 90). '&nbsp;';
       
?>
<a href="<?php print $node_url ?>" title="read more">read more</a><?php
     
}
    } else {
        print
$content;
    }
 
?>

thanks to egoleo from http://newsafrican.com/

 
 

Drupal is a registered trademark of Dries Buytaert.