What is the php code for embedding (the contents) of a node inside another node?
i guess this must one of the most basic phop code - but them i am zero in php - so need help.
what i want is to create a page then then embed that in many other pages (child pages of many books) so that when i update this page - it automatically get updated in all the places where it is embedded.
I know i can put a hyper link - but in some cases i don't want the reader to go away from a page - and read a specific content right there. thanks in advance
ratnesh
The php code is the: <?php $node = node_load(15); echo $node->title; echo $node->body ?>
The $node variable is an object. You can see the elemnts of this with the print_r or var_dump function. The node_loads parameter is the node id (nid).
More information about it: http://api.drupal.org/api/function/node_load/6
geniekids írta:
What is the php code for embedding (the contents) of a node inside another node?
i guess this must one of the most basic phop code - but them i am zero in php - so need help.
what i want is to create a page then then embed that in many other pages (child pages of many books) so that when i update this page - it automatically get updated in all the places where it is embedded.
I know i can put a hyper link - but in some cases i don't want the reader to go away from a page - and read a specific content right there. thanks in advance
ratnesh
Ámon Tamás Sitefejlesztő és programozó
Thanks, the code below works quite sweety, just one hitch.
The node that i am embedding contains HTML formatting using TINYMCE - so it was using FULL HTML input format - see here: http://geniekids.com/10-commandments-respect
however when i embed it in another drupal page using the php input format the embeded node body looses its formatting (atleast some of it) see here: http://geniekids.com/content/trying-8
Is there some way that i can retain the formatting of the embedded page? Do i change the "php input format"? Is there a way to show the image that was in the original node in its embeded state (image was inserted using TINYMCE? Do i need to change some setting in TINYMCE?
Pl help
Ámon Tamás-4 wrote:
The php code is the:
<?php $node = node_load(15); echo $node->title; echo $node->body ?>
The $node variable is an object. You can see the elemnts of this with the print_r or var_dump function. The node_loads parameter is the node id (nid).
More information about it: http://api.drupal.org/api/function/node_load/6
geniekids írta:
What is the php code for embedding (the contents) of a node inside another node?
i guess this must one of the most basic phop code - but them i am zero in php - so need help.
what i want is to create a page then then embed that in many other pages (child pages of many books) so that when i update this page - it automatically get updated in all the places where it is embedded.
I know i can put a hyper link - but in some cases i don't want the reader to go away from a page - and read a specific content right there. thanks in advance
ratnesh
Ámon Tamás Sitefejlesztő és programozó -- 5NET Informatikai Kft. 1062 Budapest, Aradi utca 38. A 3/11 telefon: (1) 461-0205 | fax: (1) 461-0206 e-mail: amont@5net.hu | web: http://www.5net.hu -- [ Drupal support list | http://lists.drupal.org/ ]
Is there a module that makes this process of embedding easy? Easy as in something an ordinary non-techy client could use?
I think the idea of "stacked" content is a possibly very useful paradigm that it seems most CMS's ignore. I would like to be able to have modular building block elements which could be added together and embedded into each other to construct any type of page.
-- Randal
At 12:34 PM -0700 9/14/08, geniekids wrote:
Thanks, the code below works quite sweety, just one hitch.
The node that i am embedding contains HTML formatting using TINYMCE - so it was using FULL HTML input format - see here: http://geniekids.com/10-commandments-respect
however when i embed it in another drupal page using the php input format the embeded node body looses its formatting (atleast some of it) see here: http://geniekids.com/content/trying-8
Is there some way that i can retain the formatting of the embedded page? Do i change the "php input format"? Is there a way to show the image that was in the original node in its embeded state (image was inserted using TINYMCE? Do i need to change some setting in TINYMCE?
Pl help
Ámon Tamás-4 wrote:
The php code is the:
<?php $node = node_load(15); echo $node->title; echo $node->body ?>
The $node variable is an object. You can see the elemnts of this with the print_r or var_dump function. The node_loads parameter is the node id (nid).
More information about it: http://api.drupal.org/api/function/node_load/6
geniekids írta:
What is the php code for embedding (the contents) of a node inside another node?
i guess this must one of the most basic phop code - but them i am zero in php - so need help.
what i want is to create a page then then embed that in many other pages (child pages of many books) so that when i update this page - it automatically get updated in all the places where it is embedded.
I know i can put a hyper link - but in some cases i don't want the reader to go away from a page - and read a specific content right there. thanks in advance
ratnesh
Ámon Tamás Sitefejleszt és programozó -- 5NET Informatikai Kft. 1062 Budapest, Aradi utca 38. A 3/11 telefon: (1) 461-0205 | fax: (1) 461-0206 e-mail: amont@5net.hu | web: http://www.5net.hu -- [ Drupal support list | http://lists.drupal.org/ ]
-- View this message in context: http://www.nabble.com/how-to-embed-a-node-inside-another-node-tp19468065p194... Sent from the Drupal - Support mailing list archive at Nabble.com.
-- [ Drupal support list | http://lists.drupal.org/ ]
Ámon Tamás wrote:
The php code is the:
<?php $node = node_load(15); echo $node->title; echo $node->body ?>
The $node variable is an object. You can see the elemnts of this with the print_r or var_dump function. The node_loads parameter is the node id (nid).
A more complete method would use node_view, since the above method won't properly render content from other modules (such as cck)
<?php $node = node_load(15); echo $node->title; echo node_view($node); ?>
http://api.drupal.org/api/function/node_view/6
Cheers,
Jonathan
This prints the body and title of node:
<?php
$title = db_result(db_query("select title from {node} where nid=159;"));
$body = db_result(db_query("select body, vid from {node_revisions} where vid=(select vid from {node} where nid=159);"));
print "<p><b>" . $title . "</b><br />"; print $body . "</p>"; ?>
Quoting geniekids ratadi2@gmail.com:
What is the php code for embedding (the contents) of a node inside another node?
i guess this must one of the most basic phop code - but them i am zero in php - so need help.
what i want is to create a page then then embed that in many other pages (child pages of many books) so that when i update this page - it automatically get updated in all the places where it is embedded.
I know i can put a hyper link - but in some cases i don't want the reader to go away from a page - and read a specific content right there. thanks in advance
ratnesh
View this message in context: http://www.nabble.com/how-to-embed-a-node-inside-another-node-tp19468065p194... Sent from the Drupal - Support mailing list archive at Nabble.com.
-- [ Drupal support list | http://lists.drupal.org/ ]