How to use node_load ()?

Hi, a little confused how to get the node header using this code

node_load ($ item); $ Name = $ nid-> name

I did this encoding in a block, and I want to extract from node id to display the image. These images are usually uploaded to the site using filezilla and have the same name as node title.i. many forms of node_load (), but im failure.so, please tell me the correct option for this. Thanks to everyone. -Pranoti

+3
source share
4 answers

Here is the link for node_load

http://api.drupal.org/api/function/node_load

It returns an object that is node.

$node = node_load($nid); // $nid contains the node id
$title = $node->title;

Please get a good book on developing a Drupal module for learning the basics.

+7

. , ? :

Node load , , node. ( , API: http://api.drupal.org/api/function/node_load).

node id:

$nid = 55;
$node = node_load($nid);
$title = $node->title;

:

$title = 'How to serve man';
$node = node_load(array('title' => $title));
$body = $node->body;
+5

node ,

<?php
$type = "product_type";
$nodes = node_load_multiple(array(), array('type' => $type));
foreach($nodes as $products):
?>
<?php print $products->nid; ?>
<?php print $products->title; ?>
<?php endforeach; ?>

node, , , , , " "

NODE

+2

If you load multiple nodes using node_load (), be sure to use the $ reset parameter so that each node is not stored in the function’s static cache (and increases memory usage):

$ nid = 55; $ node = node_load ($ nid, NULL, TRUE);

0
source

Source: https://habr.com/ru/post/1768616/


All Articles