[support] Referencing the body field

Emma Badger emma.badger at chocolateteapot.net
Fri Oct 9 11:08:55 UTC 2009


Thanks to both of you that answered.  I think option 1 is exactly what  
I want.

I didn't quite understand this Shai.
But if you take that approach you won't be able to give
access to that node to non-dev site admins without making your site
vulnerable.

Anonymous users can see the content of the other node.  Or do you mean  
that anonymous users shouldn't be allowed to input php - if so, yes  
that's how I have it set up, and it's just me that will need this  
functionality.

Thanks again.

Emma

On 9 Oct 2009, at 12:22, luca capra wrote:

> in node1 body, with php filter
> <?php
>  $node2 = node_load(156);
>  echo $node2->body;
> ?>
>
> or in template.php
>
> YOURTHEME_preprocess_node(&$vars, $hook){
>  $nid = 1; // the nid of node container
>  if(arg(0)==node && arg(1)==$nid){
>    $node2 = node_load(156);
>    $vars['content'] .= $node2->body;
>  }
> }
>
> (then clear the cache in admin/settings/performance)
>
> both should works.
>
>
> Emma Badger ha scritto:
>> I would like to include the content of the body field of node 156 in
>> the body of another node using php.  Is this easy to do?
>>
>> Any help would be appreciated.
>>
>> Regards
>>
>> Emma
>>
>>
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list