Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- Combining Php snippets to display date separator in Drupal group blog


jatar_k - 11:18 pm on Mar 27, 2006 (gmt 0)


we could start by analyzing passed data otherwise we don't know what we are working with

this bit needs to change

while ($node = db_fetch_object($result1)) {
$output .= node_view(node_load(array('nid' => $node->nid)), 1);

therefore we need to understand everything involved

we can start by stepping it out to see each piece

while ($node = db_fetch_object($result1)) {
echo '<p>node:<pre>';
print_r($node);
echo '</pre>';

$nloadarr = node_load(array('nid' => $node->nid))
echo '<p>nloadarr:<pre>';
print_r($nloadarr);
echo '</pre>';

$nview = node_view($nloadarr, 1);
echo '<p>nview:<pre>';
print_r($nview);
echo '</pre>';

$output .= $nview;
echo '<p>ouput',$output;
die();
}

this means everything will still work (though you would have to comment the echos and the die) but we can look at each step. This may spit out a ton of data so running it a single time is probably preferable which is why I added a die at the end.

run that once, document all output, then comment the echos and the die if this isn't a dev environment. You can then see what you are working with. It may require you to just comment the die and let it dump on every iteration of the loop so you can see how data is changed as the loop progresses.

You can paste the result from the single iteration here (I am hoping it isn't that long ;)).


Thread source:: http://www.webmasterworld.com/php/12207.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com