Drupal Articles » More control of teasers


By David - Posted on 21 March 2009

<?php if (!$page) { // If shown as a teaser, e.g. search results or tag listing ?>

  Content of the regular teaser.

<?php } // End teaser
else { // Begin full node view ?>


  This is the full node view (e.g. example.com/node/2)

<?php } // Close the PHP if/else for teaser versus full node view. ?>

Here's a version that also accommodates a different teaser for just the front page of the site:

<?php if ($is_front) { // Teaser version for the front page of the site ?>

  This version just shows on the front page.

<?php } // End front page teaser
 
elseif (!$page) { // If shown as a teaser, e.g. search results or tag listing ?>


  Content of the regular teaser.

<?php } // End teaser
 
else { // Begin full node view ?>


  This is the full node view (e.g. example.com/node/2)

<?php } // Close the PHP if/else for teaser versus full node view. ?>

Tags —