Drupal中判断当前页面为分类页的方法

在Drupal中,分类系统路径都是类似这种格式:

taxonomy/term/10

taxonomy/term/17

那么,根据Drupal API,判断当前页面为分类页面,可以这样写:

if ( arg(0) == ‘taxonomy’ && arg(1) == ‘term’ ) {

echo ‘这是分类’;

} else {

echo ‘这不是分类’;

}

if(arg(0) == ‘taxonomy’ && arg(1) == ‘term’){
//就肯定是分类列表了。
}

:mrgreen:

Drupal中判断当前页面为分类页的方法》上有1条评论

发表评论

Fill in your details below or click an icon to log in:

WordPress.com 徽标

You are commenting using your WordPress.com account. Log Out /  更改 )

Google photo

You are commenting using your Google account. Log Out /  更改 )

Twitter picture

You are commenting using your Twitter account. Log Out /  更改 )

Facebook photo

You are commenting using your Facebook account. Log Out /  更改 )

Connecting to %s