Drupal页面与内容定制全解析
1. 页面预处理函数及图形标题设置
在Drupal开发中,页面预处理函数有着重要作用。以下是一段代码示例:
// Step 5:
if (arg(0) == "node" && is_numeric(arg(1))) {
// Step 6:
if (isset($variables['node']->taxonomy)) {
$target_tax = 0;
$node_tax = $variables['node']->taxonomy;
// Step 7:
$tid = array_keys($node_tax);
$name = $node_tax[$tid[$target_tax]]->name;
// Step 8:
$clean_name = check_plain($name);
$dash_name = str_replace(" ", "-", $clean_name);
$lc_name = strtolower($dash_name);
// Step 9:
array_push($variables['template_files'], "page-tax-$lc_name.tpl.php");
$variables['body_classes'] .= $variables['body_classes'] . " tax-$lc_name";
超级会员免费看
订阅专栏 解锁全文
14

被折叠的 条评论
为什么被折叠?



