Views Header subject to the Taxonomy Term ID

Category
drupal, views
Date Created
2nd Oct 2010
Last Updated
2nd Oct 2010

Views Header subject to the Taxonomy Term ID

Question

How to configure the Views Header subject to the Taxonomy Term ID

Answer

Within the Views Arguments section add the 'Taxonomy: Term ID' as the argument.

The output from the header may then be configured per taxonomy term ID using the example php code below.

The example php code is placed within the Views Header field.


<?
$a = arg(0);
$b = arg(1);
$c = arg(2);

print "<p>arg-0: [" . $a . "]</p>";
print "<p>arg-1: [" . $b . "]</p>";
print "<p>arg-2: [" . $c . "]</p>";

switch($c) {

  // Fine China
  case '5':
    echo "<p>Welcome to fine china</p>";
    break;

  // Overmatle Mirrors
  case '15':
    echo "<p>We provide a wide range of overmantle mirrors.</p>";
    break;

}

?>

Related terms