Reputation: 31
I am newbie to drupal . I am creating a content type "news" . Every time i created a content of type news it shows in the page like .../drupal/?q=node/6, .../drupal/?q=node/7 and so on .
What i exactly need i want to listing all those contents in a single page and edit them in a single template file. Here I am getting problem that what will be the template file name??
Attempt: I have tried with the following names and also i have "mytheme_preprocess_page()" in mytheme/template directories.
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';
}
}
}
I have also changed the $vars['template_files'][] = 'page-node-edit-news' Where i am going wrong ?
Upvotes: 2
Views: 3496
Reputation: 31
This can be possible through the name like page--node--{custom_content_type}.tpl.php
In this case it shuld be **page--node--news.tpl.php**
Upvotes: 1
Reputation: 169
use this steps :
Upvotes: 0