我只想在当前页面是分类页面的情况下,在de page.tpl.php中打印我的区域。因此,我需要检查当前页面是否为首页,然后检查分类法
<?php
if(currentpage == taxonomy){
print render($page['sidebar'])
}
?>谢谢你的帮忙,
发布于 2012-01-05 02:23:56
您可以使用arg() function来获取当前页面路径的底层部分(即,不是URL别名)。在您的示例中,它将如下所示:
if (arg(0) == 'taxonomy' && arg(1) == 'term') {
print render($page['sidebar']);
}发布于 2012-05-01 15:35:44
如果你有多个词汇表,你可以这样集成Clive suggestion:
if (arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2)))
{
$tid = (int)arg(2);
$term = taxonomy_term_load($tid);
if($term->vocabulary_machine_name == '<YOUR_VOCABULARY_MACHINE_NAME>') print render($page['sidebar']);
}https://stackoverflow.com/questions/8731549
复制相似问题