2012-07-22 3 views
1

사용자가 최대 10 개의 파일을 업로드 할 수있는 파일 필드 인 'field_downloads'라는 필드가 있습니다. page.tpl.php에서 어떻게 렌더링 할 수 있습니까?파일 drupal 렌더링

콘텐츠에
print render($content['FIELD_NAME']); 

하는의 디스플레이 페이지 집합을 관리 입력 : 당신은 어떤 다른 필드로이 작업을 수행

$x = node_view($node); 
dsm($x['#node']->field_downloads); 

enter image description here

+0

'이것들을 렌더링하시오.' –

+0

답변

1

f ollowing 코드.

$list_of_paths = array(); 
foreach($x['#node']->field_downloads['und'] as $index => $data) 
{ 
    $file_uri = $data['uri']; 
    $file_path = file_create_url($file_uri); 
    $list_of_paths[] = l(t("my file direction"), $file_path); 
} 
print theme("item_list", array(
    'items' => $list_of_paths, 
    'type' => 'ul', 
    'title' => t('List of file paths.'), 
)); 

다음은이 작품에 대한 file_create_url()

희망 ... 무하마드을 알아야 할 사항입니다.

1

: 아래

는 page.tpl.php의 출력입니다 파일 필드를 "파일 테이블"

+0

이것은 노드에서만 작동합니까? – LeBlaireau

0
<?php 
     $file_uri=$node->my_field['und']['0']['uri']; 
     $file_path = file_create_url($file_uri); 
     print "<a href='".$file_path."'>here</a>"; 
    ?>