Yeah,it's me again 
This time, I'm having a bit of a dillema.. I want to do a "latest news article" div/td on my site, and I want only the latest submitted news article to be shown.
A bit late perhaps (haven't been on the forum recently) but I use the following (AMENDED) code which can display any number of latest news items, and also display any length of the starting text as a teezer, adding a "Read more" link to the full item, and it even ensures that it ends after a full word rather than just a set length.
You can see it in operation at the end of the home page on my church web site (see my signature below for the site URL).
$use_doc_view = FALSE; # TRUE or FALSE for use of Doc_View template snippet
$nrblogs = 10; // nr of blogs to show a short portion of
$nrblogs = (isset($LIn_nrblogs))? $LIn_nrblogs : $nrblogs; //passed number ?
$nrblogstotal = 6; // total nr of blogs to retrieve
$lentoshow = 400; // how many characters to show of blogs
$dateformat = "%B %e, %Y"; # Date format for blog entries using strftime()
$timeformat = "%H:%M:%S"; # Time format for blog entries using strftime()
#
# Variables for In-Line-Style (CSS) which you can change
#
# was #F0F8FF
$blog_entry_box_css = 'style="background-color:#FFFFFF; padding:5px; border:1px solid black;"';
$blogtext_css = 'style="color:black; font-weight:normal;"';
$blogtitle_css = 'style="color:blue; font-weight:bold; display:inline;"';
$username_css = 'style="color:blue; display:inline;"';
$date_css = 'style="color:blue; display:inline;"';
#
#$more_css = 'style="color:#821517; font-weight:normal;"';
#
# You should not need to change setting below here
#
$MySimpleBlog = "";
$blogparent = $etomite->documentObject['id']; // the folder that contains blog entries (this folder)
$tbl = $etomite->dbConfig['dbase'].".".$etomite->dbConfig['table_prefix'];
$sql = "SELECT * FROM ".$tbl."site_content
WHERE isfolder = 0 and deleted = 0 and published = 1 and parent <> 2 and parent <> 586 and template = 6 and id <> 407 ORDER BY createdon DESC LIMIT $nrblogs";
#WHERE ".$tbl."site_content.published=1
#AND ".$tbl."site_content.deleted=0
#AND ".$tbl."site_content.pub_date<=".time()."
#ORDER BY ".$tbl."site_content.createdon DESC LIMIT $nrblogstotal";
// gbt note the above editedon was originally id
// but this places recent edits at the top of the list.
$rs = $etomite->dbQuery($sql);
$limit = $etomite->recordCount($rs);
if($limit<1) $MySimpleBlog .= "No entries found.<br />\n";
else { # If we found blog entries, process them
$nrblogs = $nrblogs<$limit ? $nrblogs : $limit;
for ($x = 0; $x < $nrblogs; $x++) {
$blog = $etomite->fetchRow($rs);
# Query for document author info
$sql = "SELECT username
FROM ".$tbl."manager_users
WHERE ".$tbl."manager_users.id = ".$blog['createdby'];
$rs2 = $etomite->dbQuery($sql);
$limit2 = $etomite->recordCount($rs2);
if($limit2 === FALSE) {
$username .= "anonymous";
} else {
$bloguser = $etomite->fetchRow($rs2);
$username = $bloguser['username'];
}
# gbt
$username = '';
# check for tags and optionally strip the content
$blog['content'] = str_replace(array("<",">"),array("<",">"),$blog['content']);
$tag = '<!--showall-->';
$showall = strpos($blog['content'], $tag);
if($showall === FALSE) {
$tag = '<!--more-->';
$more = strpos($blog['content'], $tag);
if ($more === FALSE) $lentoshow = $lentoshow;
else $lentoshow = $more;
$tag = '<!--showtags-->';
$showtags = strpos($blog['content'], $tag);
if ($showtags === FALSE)
$rest = "" . strip_tags(substr($blog['content'], 0, $lentoshow));
else $rest = substr($blog['content'], 0, $lentoshow);
#################################
#only full word at the end
$string=$rest;
$charToFind=" ";
$searchPos = $lentoshow;
$searchChar = '';
//
while ($searchChar != $charToFind) {
$newPos = $searchPos-1;
$searchChar = substr($string,$newPos,strlen($charToFind));
$searchPos = $newPos;
}
$rest=substr($string,0,$searchPos)." ";
################################
if($use_doc_view) {
$rest .= "...<div style='text-align:right;'><a $more_css href='[~".$doc_view_parent_id."~]&doc=".$blog['id']."&Ym=".$blogdate."'>Click here to read more ....."."</a></div>\n";
}
else {
$rest .= "...<div style='text-align:right;'><a $more_css href='[~".$blog['id']."~]'>Click here to read more ....."."</a></div>\n";
}
}
else $rest = "" . $blog['content'];
$formatted_time = strftime("$dateformat at $timeformat", $blog['createdon']+$server_offset_time);
#gbt
$formatted_time = '';
# Display the blog entry using CSS formatting
$MySimpleBlog .= " <fieldset><legend><b>".$blog['pagetitle']."</b></legend>";
#gbt $MySimpleBlog .= " <div $username_css>".$username."</div> on <div $date_css>".$formatted_time."</div>\n";
#gbt $MySimpleBlog .= " :: <a style='$parent_css' href='[~".$blog['parent']."~]&Ym=".$blogdate."'>More Like This&raq"."uo;</a>\n";
$MySimpleBlog .= $rest."</fieldset>\n";
}
}
////////////////////////////// See Also /////////////////////////////////////////////////
if($limit>$nrblogs) { # Show list of additional blog entries with hyperlinks
$MySimpleBlog .= "<div $blogtext_css><b $blogtitle_css>See also</b><br /><ul>\n";
for ($x = $nrblogs; $x < $limit; $x++) {
$blog = $etomite->fetchRow($rs);
$formatted_time = strftime("%B %e, %Y at $timeformat", $blog['createdon']+$server_offset_time);
if($use_doc_view) {
// $MySimpleBlog .= "<li> ".$formatted_time." - <a href='[~".$doc_view_parent_id."~]&doc=".$blog['id']."'>".$blog['pagetitle']."</a></li>\n";
$MySimpleBlog .= "<li> <a href='[~".$doc_view_parent_id."~]&doc=".$blog['id']."'>".$blog['pagetitle']."</a></li>\n";
}
else {
$MySimpleBlog .= "<li> <a href='[~".$blog['id']."~]'>".$blog['pagetitle']."</a></li>\n";
}
}
$MySimpleBlog .= "</ul></div>\n"; # Close the blog list
}
return $MySimpleBlog;