drupal 6中相同内容类型的2种不同布局

时间:2009-06-27 22:09:10

标签: php drupal drupal-6

我有一种叫做基金的内容类型。

这个内容在node-fund.tpl.php中,在page.tpl.php里面

我需要重新创建基金内容,但没有page.tpl.php

所以要明确,我需要2页

1)资金内页模板 2)基金数据但完全重新格式化。计划是创建在A4上打印良好的页面

关于如何实现这一目标的任何想法。

2 个答案:

答案 0 :(得分:1)

您是如何创建基金内容类型的? CCK,自定义模块或仅仅是一种简单的新内容类型(即管理>内容管理>内容类型>添加内容类型)。 AFAIK每种方法都有不同的可能性。

一种选择是创建一个print.css文件,该文件在将网页发送到打印机时使用。看CSS Design: Going to Print将是一个很好的起点。

我希望这会有所帮助。

答案 1 :(得分:0)

在template.php preprocess ___ page()中,您可以在URL上查找/ print并使用$ vars ['template_files']更改模板。

来自here

 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']);
    }
  }
}