[support] Referencing the body field

Emma Badger emma.badger at chocolateteapot.net
Fri Oct 9 15:17:41 UTC 2009


Thanks, I'll give that a go.
On 9 Oct 2009, at 16:13, KOBA | Hans Rossel wrote:

> I think its a good idea to always pass the content through a filter
> before you output it. I know its your own submitted node in this case
> so there will not be any security risk. But outputting $node2->body on
> user submitted content is unsafe. Do check_markup($node2->body) to be
> sure the body is cleaned by the input filter.
>
> If you dont want to enable the php filter module, which is a good idea
> because safer to leave disabled, you can maka a custom block, leave
> the content empty and make a block-block-1.tpl.php where you put the
> php. Then enable that block for the content top region.
>
> I also recommend the book "Cracking Drupal" of Greg Knaddison for
> interesting insight in making your Drupal site secure.
>
> Hans
> Www.koba.be
>
> 2009/10/9, luca capra <luca.capra at gmail.com>:
>> 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/ ]
>>
>
>
> -- 
> Hans Rossel
> KOBA Webdesign bvba
> Beukenlaan 56
> 9051 Gent (Sint-Denijs-Westrem)
> Belgium
> BTW 0817.931.516
> +32.9.334.52.60
> +32.472.79.32.16
> www.koba.be
> info at koba.be
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list