php - $match = TRUE - not working to reduce block visibility in Drupal -
trying show block drupal under conditions - tried write out allow $match = true
in event content type article or 1 of archive pages (format /archive-monthname
) or news page (/news
).
for reason, not showing on of pages desired.
here's code:
<?php $match = false; $types = array('article' => 1); if (arg(0) == 'node' && is_numeric(arg(1))) { $nid = arg(1); $node = node_load($nid); $type = $node->type; if (isset($types[$type])) { $match = true; } } switch (substr($_server["request_uri"], 0) { case "/archive-january": $match = true; break; case "/archive-february": $match = true; break; case "/archive-march": $match = true; break; case "/archive-april": $match = true; break; case "/archive-may": $match = true; break; case "/archive-june": $match = true; break; case "/archive-july": $match = true; break; case "/archive-august": $match = true; break; case "/archive-september": $match = true; break; case "/archive-october": $match = true; break; case "/archive-november": $match = true; break; case "/archive-december": $match = true; break; case "/news": $match = true; break; } return $match; ?>
here: switch(substr($_server["request_uri"], 0) {
, missing closing bracket.
might 1 of problems.
also, substr(anything, 0)
returns anything, think it's kinda pointless.
Comments
Post a Comment