Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/drupal/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
渲染文件drupal_Drupal_Drupal 7_Drupal Modules_Render_Drupal Render - Fatal编程技术网

渲染文件drupal

渲染文件drupal,drupal,drupal-7,drupal-modules,render,drupal-render,Drupal,Drupal 7,Drupal Modules,Render,Drupal Render,我有一个名为“field_downloads”的字段,这是一个允许用户上传最多10个文件的文件字段。如何在page.tpl.php中呈现这些内容 下面是page.tpl.php的输出: $x = node_view($node); dsm($x['#node']->field_downloads); 您可以像其他字段一样执行此操作: print render($content['FIELD_NAME']); 在内容类型的管理显示页面中,将文件字段设置为“文件表”您只需编写以下代码即可

我有一个名为“field_downloads”的字段,这是一个允许用户上传最多10个文件的文件字段。如何在page.tpl.php中呈现这些内容

下面是page.tpl.php的输出:

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

您可以像其他字段一样执行此操作:

print render($content['FIELD_NAME']);

在内容类型的管理显示页面中,将文件字段设置为“文件表”

您只需编写以下代码即可

$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.'),
));
以下是您需要了解的内容()

希望这能奏效。。。穆罕默德。


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

你所说的
渲染这些内容是什么意思?!作为链接