2013-04-12 2 views
2

나는 drupal에 초보자입니다. 나는 content type "news"를 만들고있다. 때마다 내가/.../drupal /? q = 노드/6, .../drupal /? q = 노드/7과 같은 페이지에 표시 유형 뉴스의 내용을 만들었습니다.특정 컨텐츠 유형에 대해 node.tpl.php를 대체하고 모든 컨텐츠를 단일 페이지에 표시하는 방법은 무엇입니까?

정확히 필요한 모든 내용을 단일 페이지에 나열하고 단일 템플릿 파일에서 편집하고 싶습니다. 여기 템플릿 파일 이름은 무엇이 될지 문제가 있습니다. ??

시도 : 나는 다음과 같은 이름으로 시도 또한 내가 "mytheme_preprocess_page()" mytheme에서/템플릿 디렉토리를 가지고있다.

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

나는 또한 $ 바르 [ 'template_files를'] 변경 [] = '페이지 노드 편집 뉴스'는 어디서 잘못된 것입니까?

답변

1
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** 
0

사용이 단계 :

  1. 실행 뷰와 뷰
  2. 을 요청 콘텐츠 유형의 새보기를 만들/
  3. 링크 구조를 사용 viwes을 UI 뷰 모듈을 설치 원하는 필드를 입력 한 다음 원하는대로 페이지를 구성하십시오.
  4. 원하는 경우보기를 테마로 지정할 수 있습니다.
+0

앞 페이지 나 특정 블록을 테마로하는 것처럼보기 및 맞춤 모듈을 제외한 다른 옵션이 있습니까? – Drupalie