如何根据drupal6中的模块更改页面的整个模板 [英] how can i change the entire template of the page according to module in drupal6
问题描述
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屋!