drupal-nodes

how to avoid 'out of memory' errors when programmatically generating a lot of nodes in drupal?

旧城冷巷雨未停 提交于 2019-12-24 02:14:31
问题 I'm creating about 150 nodes programmatically and running into 'out of memory' errors when doing it all in a single request. (I have a menu callback that generates the nodes and calls node_save() on them.) Example: for($i=0; $i<150; $i++) { $node = new stdClass(); $node->title="Foo $i"; $node->field_myfield[0]['value'] = "Bar $i"; ... node_save($node); } I've heard of BatchAPI, but never used it. Is that the right tool to get around this? The docs talk about timeouts, but not memory issues.

Render a Drupal node

元气小坏坏 提交于 2019-12-22 02:34:07
问题 I would like to show a node inside another node. So I retrieve the node id of the second node and I would like to render/print/... it inside another node. But I'm not sure how to do this. I've tried drupal_render , node_view , print ,... but with no results. Any advice? $nid = $node->field_linked_fiche['und'][0]['nid']; $fullFiche = node_load($nid); EDIT - the whole template <?php /** * @file * Bartik's theme implementation to display a single Drupal page. * ... */ ?> <div id="page-wrapper">

Recipe for adding Drupal node records

元气小坏坏 提交于 2019-12-10 17:30:04
问题 I am looking for a recipe for adding Drupal node records. I have identified three tables. node_revisions nid=249 - vid + 1? vid=248 - auto-increment node: nid=250 - vid + 1? vid=249 - auto-increment content_type_my_content vid=248 - from node_revisions table? nid=249 - from node table? Am I on right track? Is there some helper functions for this? 回答1: If you are looking to programatically create nodes, use the Drupal API. Start by creating a $node object. Fill in title, type, status, body,

Render a Drupal node

限于喜欢 提交于 2019-12-04 23:47:48
I would like to show a node inside another node. So I retrieve the node id of the second node and I would like to render/print/... it inside another node. But I'm not sure how to do this. I've tried drupal_render , node_view , print ,... but with no results. Any advice? $nid = $node->field_linked_fiche['und'][0]['nid']; $fullFiche = node_load($nid); EDIT - the whole template <?php /** * @file * Bartik's theme implementation to display a single Drupal page. * ... */ ?> <div id="page-wrapper"><div id="page"> <div id="header" class="<?php print $secondary_menu ? 'with-secondary-menu': 'without