dongyin2643 2010-09-22 08:36
浏览 147
已采纳

如何在drupal中的内容模板模块中添加视图?

Hi i m working on content template module in drupal,but there is problem in showing view of ranking field with below coding

<td width="10%" align="left"><font color="#669900"><b>Address:</b></font></td>
<td colspan="3"><?php print $node->field_perm_add_line1[0]['view'] ?>,<?php print $node->field_perm_add_line2[0]['view'] ?></td>
<td align="left"><font color="#669900"><b>Website:</b></font></td>
<td align="left"><?php print $node->field_website[0]['view'] ?></td>
<td width="8%" align="left"><font color="#669900"><b>Phone:</b></font></td>
<td width="42%" align="left"><?php print $node->field_phone1[0]['view'] ?><?php echo ","; print $node->field_phone2[0]['view'] ?></td>
<td align="left"><font color="#669900"><b>Email:</b></font></td>
<td align="left"><?php print $node->field_alt_email[0]['view'] ?></td>
<td align="left"><font color="#669900"><b>Fax:</b></font></td>
<td align="left"><?php print $node->field_fax[0]['view'] ?></td>
<td align="left"><font color="#669900"><b>Rankings:</b></font></td>
<td colspan="3"><?php print $node->field_university_rankings[0]['view'] ?></td>
<td align="left" colspan="4"><font color="#669900"><b>Description:</b></font></td>
<td style="background-color:#fff; align="left" colspan="4"><?php print $node->field_description[0]['view'] ?></td>

but for the ranking field i have designed a view which has argument title so i can't get it how to add it please help.......... Thanks in advance Pranoti

  • 写回答

3条回答 默认 最新

  • douyue7536 2010-09-22 09:17
    关注

    You could start with a

     var_dump($node->field_university_rankings[0]);
    

    To find out how this is structured. I doubt that your code,

     $node->field_university_rankings[0]['"check_plain($node->title)"']
    

    is correct. Since Drupal would hardly use the stripped version of a title as key in an array. Once var_dump() tells you the exact key of that array, use that.

    I assume you will find that you will see something like

    $node->field_university_rankings[0]['value']; //=> a full, or lartial $node-object.
    $node->field_university_rankings[0]['view']; //=> a string with the title of that node, in  a link.
    

    The exact output of 'view' is created with display settings that go with the field. You should try to configure it in such a way, that the 'view' already outputs the correct string.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案