Community Documentation

Display avatar based on information from the query string

Last updated October 6, 2006. Created by travischristopher on February 10, 2006.
Edited by pwolanin, puregin. Log in to edit this page.

This snippet is useful when using the paging.module http://drupal.org/project/paging and avatars, but could be adapted to show and hide any area based on a query string parameter.

        If displaying a page (vs a teaser)
            Look for the 'from' parameter
            If present and value is greater than 0
                Suppress the picture

In the node.tpl,php file replace your standard

<?php if ( $picture) : ?>
    <div class="picture">
      <?php print $picture ?>
    </div>
    <?php endif; ?>

with

<?php if ( $picture ): ?>
<?php
$from
= $_GET['from'];
?>

   <?php if ( ! $from || $from == 0 ): ?>
    <div class="picture">
      <?php print $picture ?>
    </div>
    <?php endif; ?>
  <?php endif; ?>

About this page

Drupal version
Drupal 4.6.x, Drupal 4.7.x

Reference

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.