簡體   English   中英

Drupal 6中相同內容類型的2種不同布局

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM