By chicomtl on
i just want this to post the title of the blog. i don't know how to go about it.
not very good at php
<?php
// code by <a href="mailto:morbus@disobey.com">morbus@disobey.com</a>
//
// The LIMIT 100 at the
// end speeds up the PHP foreach loop so that we don't have to process
// thousands of entries just to find a user who last updated long ago.
$bloggers = "5";
//blog number
$blogger_array = array(5);
//bloggers 1,2,3,5,5
//echo "<h3>newest</h3>";
// Display an accessible list of bloggers
foreach ($blogger_array as $blogger) {
$user = user_load(array('uid' => $blogger));
if ($first) { echo " | "; }
//--echo "<a href=\"blog/$user->uid\">$user->name</a>";
$first = 1;
}
$results = db_query("SELECT nid, uid, created FROM {node} n WHERE n.type = '%s' AND n.uid IN (%s) ORDER BY created DESC, uid LIMIT 100", "blog", $bloggers);
// once we've displayed this many users, we stop
// processing the rest of our database results.
$num_users = 10;
// when we've displayed a user's latest blog post successfully,
// we'll throw 'em in here to remind us we don't need 'em anymore.
$displayed_users = array();
//---------echo "<h3>Recent posts:</h3>";
// loop through each result.
while ($result = db_fetch_object($results)) {
// if we've already displayed this user's latest post,
// we don't need to process any of his earlier ones.
if (isset($displayed_users[$result->uid])) { continue; }
// load and display the node. here, we're using a standard
// node theming display, but you can print any custom output
// with $node->teaser, $node->body, and so forth.
$node = node_load(array('nid' => $result->nid));
print node_view($node, 1);
//echo "<h2><a //href=\"blog/$node->uid\">$node->name</a>: <a //href=\"node/$node->nid\">$node->title</a></h2>" ;
// with the node printed, we can flag this user as seen.
$displayed_users[$result->uid] = 1;
// if the number of displayed users is the same as the number
// of users we care about, we can break outta the loop.
if (count($displayed_users) == $num_users) { break; }
}
?>
Comments
What you wanna do?
Hi chicomtl,
what is your goal? This is a old code snippet from some where. It won´t work with Drupal 5.5. So explane first hat you want do do. Wich version of Drupal you have wich php version on you server.
Dirk
hi, this codes works on my
hi, this codes works on my site 5.3
it's a snippet that displays a specific blogger. now it does it with the teaser. I than post these in a block so i have regular bloggers one per block and it post their latest blog.
I just want the title of their latest blog to appear.
that is my goal.
thank you for your intersest and help
maybe $node->title
Hi chicomtl,
try to print the node title with print $node->title before the print node_view!
Dirk
sweet but i need it to be a
sweet, thanks
i found it