Display (x) full flexinodes in a page

Last modified: March 7, 2009 - 16:29

PLEASE NOTE! The following snippets are user submitted. It's impossible to test them all so please use at your own risk! For users who have setup Drupal using an alternate database to the default (MYSQL), please note that the snippets may contain some database queries specific to MYSQL.

<?php
/**
* Displays (x) full flexinodes in a page
*
* To change which flexinode type is being referenced, change
* the $flexi_id value
* To change the length of the list, change
* the $list_no value
*
* This snippet works with Drupal 4.6.x
*
*/
$flexi_id = "flexinode-2";
$list_no =10;
$sql = "SELECT node.type, node.nid FROM node WHERE node.type = '$flexi_id' LIMIT $list_no";
$result = db_query($sql);
while (
$node = db_fetch_object($result)) {
   
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}
print
"<div id=\"recommended_links\">";
print
$output;
print
"</div>";
?>

If you need to extract nodes from multiple flexinodes, slayerment's suggested:

<?php
/**
* Displays (x) full flexinodes in a page
*
* To change which flexinode type is being referenced, change
* the $flexi_id value
* To change the length of the list, change
* the $list_no value
*
* This snippet works with Drupal 4.6.x
*
*/
$flexi_id = "flexinode-2";
$flexi_id2 = "flexinode-6";
$list_no =10;
$sql = "SELECT node.title, node.type, node.nid FROM node WHERE node.type = '$flexi_id' OR node.type = '$flexi_id2' LIMIT $list_no";
$result = db_query($sql);
while (
$node = db_fetch_object($result)) {
   
$output .= node_view(node_load(array('nid' => $node->nid)), 1);}
print
"<div id=\"recommended_links\">";
print
$output;
print
"</div>";
?>

If you need to display flexinodes in PHPEngine Template try http://drupal.org/node/72439#comment-135228

 
 

Drupal is a registered trademark of Dries Buytaert.