By gost_gost on
I want to insert the body of one node into another node.
say I have node 10, and I want it to have node 5's body after it on the same page.
I am reading the api and drupal documentation and am very much confused with what would be the easiest solution.
There are modules out there for it,
http://drupal.org/project/viewfield
http://drupal.org/project/InsertNode
Does not seem to work in 5.2
but right now it is easier for me to just insert php code into the node.
Should I be doing a custom SQL query, or is there a way to call node->body?
Again, I would prefer to insert php into a specific node as opposed to creating a module or modifying template.php or node.tpl.php
Thank you!
Comments
Views
I could be wrong, but it seems to me that views, plain and simple, without those extra modules, would work fine in this situation.
Just use views to create a block (select provide as block), set it to display full nodes, add node body to the field list, filter it by whatever criteria your wanting here, save it and enable the block at Site building > blocks, adding it to the content region. You can then edit the permissions to make sure it only displays on the page you want.
Voilà!
If you still just want to write it yourself (honestly, it's easier sometimes), I wouldn't recommend inserting php code directly into the node. Rather, I would recommend writing a module. It's safer, easier than writing code in a textarea, and makes your functionality reusable. node_load will give you all attributes of a node (including body) and you can use hook_nodeapi to add whatever content you create.
Thank you for your reply
Thank you for your reply drum5ormore , this seems to be the way to go.
I am looking into module APIs and views right now, but for me right now selecting a specific node by node id number (say, 10) is easier then having to write a dropbox menu on top of the module (no easy way to do this in views).
The modules out there that address my needs are a very complicated matter, with 20 or more installation steps.
What I am trying to achieve is also understand drupal functionality better, as right now I'm still confused.
A module is above my head right now, but I'm going to attempt anyway.
InsertNode
InsertNode module works for inserting nodes (but not certain image galleries)
just make sure to turn it on in filters after installing moduel
http://drupal.org/project/InsertNode
http://drupal.org/node/253243#comment-849898