[support] Referencing the body field

KOBA | Hans Rossel hans.rossel at koba.be
Fri Oct 9 15:13:23 UTC 2009


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


More information about the support mailing list