开发者

How can i add view in the content template module in 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>Ema开发者_Python百科il:</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


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.


if you want to use/embedded a view into your html file you need to use:

  • without argoument:

    echo views_embed_view('VIEW_NAME','DISPLAY_NAME_AND_NUMBER');

  • with argument:

    $view = views_get_view('VIEW_NAME');
    $r = $view->execute_display('DISPLAY_NAME_AND_NUMBER',array(ARGOUMNT1,ARGUMENT2));
    echo $r['content'];

where (for example):

VIEW_NAME "last_cd"

DISPLAY_NAME_AND_NUMBER "block_1"

Hope that this help you.


Sorry but i got the solution for this problem and i wants to share it with you guys,there was the problem in node field,the ranking view is not selected. so go to edit tab of particular node and the select view reference.......thanks for the response.I hope this help you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜