我是 drupal 的新手。我正在创建一个内容类型 "news" 。每次我创建新闻类型的内容时,它都会显示在页面中,例如 .../drupal/?q=node/6, .../drupal/?q=node/7 等等。
我到底需要什么我想在一个页面中列出所有这些内容并在一个模板文件中编辑它们。在这里我遇到问题,模板文件名是什么?
尝试:我尝试使用以下名称,并且在 mytheme/template 目录中有“mytheme_preprocess_page()” 。
1.node--news.tpl.php
2.node--type--news.tpl.php
3.node-type-news.tpl.php
This is my
function ppi_preprocess_page(&$variables) {
if (isset($variables['node']) && isset($variables['node']->custom_template['und'][0]['value'])) {
$custom_template_value = $variables['node']->custom_template['und'][0]['value'];
$templates_directory = dirname(__FILE__)."/templates";
$template_file_path = "$templates_directory/{$variables['node']->type}--{$custom_template_value}.tpl.php";
$template_name = "{$variables['node']->type}__{$custom_template_value}";
if(file_exists($template_file_path)) {
$variables['theme_hook_suggestions'][] = $template_name;
}
if ((arg(0) == 'node') || (arg(1) == 'edit' || arg(2) == 'news')) {
$vars['template_files'][] = 'page-node-edit-news';
}
}
}
我还更改了$vars['template_files'][] = 'page-node-edit-news'我哪里出错了?