如何根据drupal6中的模块更改页面的整个模板 [英] how can i change the entire template of the page according to module in drupal6

查看:291
本文介绍了如何根据drupal6中的模块更改页面的整个模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在drupal6中检查了许多关于主题的区域。网络上的所有教程都说主题模块,这意味着主题小区域或主题samll blobk等。但在我的情况下,我需要更改页面的整个模板,当我访问一个模块。这是可能的在 drupal6

解决方案

如果条件在你的主题的template.php函数中。
该函数是 template_preprocess_page(& $ variables)



在这个函数中,写一些if条件。

 例如:
if($ some_condition){
$ suggestions [] ='YOUR_CUSTOM_TEMPLATE ;
}
$ variables ['template_files'] = $建议;

您将拥有您的模板YOUR_CUSTOM_TEMPLATE.tpl.php。
主题模板目录中应该有哪些。



此外,您可以为内容类型添加自定义模板。
例如对于内容类型的学生,模板将是:

 页面 -  student.tpl.php 


I have check lots of area in the web about theming in drupal6. All the tutorials in the web saying theme module, which means the theming a small area or theming a samll blobk etc. But in my case i need to change the entire template of a page when i access a module. Is this is possible in drupal6?

解决方案

You can write if conditions in your theme's template.php function. The function is template_preprocess_page(&$variables)

And in this function, write some if conditions.

For example:
if($some_condition) {
  $suggestions[] = 'YOUR_CUSTOM_TEMPLATE';
}
$variables['template_files'] = $suggestions;

And you will have your template "YOUR_CUSTOM_TEMPLATE.tpl.php". Which should be there in theme's templates directory.

Also, you can have a custom template for a content type. e.g. For a content type student, the template will be:

page--student.tpl.php

这篇关于如何根据drupal6中的模块更改页面的整个模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆