[英]2 different layouts of the same content type in drupal 6
我有一个称为基金的内容类型。
其内容在page.tpl.php内的node-fund.tpl.php中
我需要重新创建基金的内容,但没有page.tpl.php
所以要明确,我需要有2页
1)资金在页面模板内2)资金数据但已完全重新格式化。 计划是创建可在A4上良好打印的页面
关于如何实现此目标的任何想法。
您是如何创建基金内容类型的? CCK,一个自定义模块,或者只是一个简单的新内容类型(即管理>内容管理>内容类型>添加内容类型)。 AFAIK每种方法都有不同的可能性。
一种选择是创建一个print.css文件,该文件在将网页发送到打印机时使用。 着眼CSS设计:印刷将是一个很好的起点。
我希望这有帮助。
在template.php preprocess ___ page()中,您可以在URL上查找/ print并使用$ vars ['template_files']更改模板。
从这里爬
function phptemplate_preprocess_page(&$vars) {
if (module_exists('path')) {
$alias = drupal_get_path_alias(str_replace('/edit','',$_GET['q']));
if ($alias != $_GET['q']) {
$suggestions = array();
$template_filename = 'page';
foreach (explode('/', $alias) as $path_part) {
$template_filename = $template_filename . '-' . $path_part;
$suggestions[] = $template_filename;
}
$vars['template_files'] = array_merge((array) $suggestions, $vars['template_files']);
}
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.