Community Documentation

Display (x) full flexinodes in a page

Last updated March 7, 2009. Created by Dublin Drupaller on December 3, 2005.
Edited by DyanneNova, pwolanin, Heine. Log in to edit this page.

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

About this page

Drupal version
Drupal 4.6.x
Audience
Developers and coders

Archive

Drupal’s online documentation is © 2000-2012 by the individual contributors and can be used in accordance with the Creative Commons License, Attribution-ShareAlike 2.0. PHP code is distributed under the GNU General Public License. Comments on documentation pages are used to improve content and then deleted.
nobody click here