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条)

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 oracle集群安装出bug
  • ¥15 关于#python#的问题:自动化测试