In case anyone is interested, I’ve created a hack to the weblog_title_list() function that gives it more flexibility. The hack allows the following:
Adds an addition option to the “orderby” parameter to allow for ordering by most recent comment (in addition to the existing “newest”, “oldest”, and “alpha”)
$wtl['orderby'] = "[i]recent[/i]";
Adds a parameter to limit the number of words in the titles with a trailing syntax of your choice for titles that exceed this length, so your parameter array and associated tag would look like this:
<?php
$wtl['show_date'] = "no";
$wtl['date_fmt'] = "M d, Y";
$wtl['limit'] = "6";
$wtl['offset'] = "0";
$wtl['orderby'] = "recent";
$wtl['weblog'] = "news";
$wtl['category'] = "";
$wtl['page'] = "comments";
[i]$wtl['words'] = "3";[/i]
[i]$wtl['trail'] = "...";[/i]
?>
<?php weblog_title_list($wtl); ?>
An example of this hack can be seen at Archinect.com (the 6 most recent entries from 4 different sections, at the bottom of the page). These are set to show 6 entries, with a word limit of 3. They are all showing the newest entries except for the discussions which is showing the 6 most recently commented discussions.
To create this hack open archives.fns.php and do the following:
- goto function weblog_title_list($wtl=”“) and add the following arrays:
(is_array($wtl) AND isset($wtl['words'])) ? $words = $wtl['words'] : $words = "";
(is_array($wtl) AND isset($wtl['trail'])) ? $trail = $wtl['trail'] : $trail = "";
- find this code (around line 190):
echo "<a href=\"$ppath". $wpath ."\">".$title."</a>";
if ($date == "yes" || $date == "")
{
echo " " . date($date_fmt, $t_stamp) . "<br />\r\n";
}
else
{
echo "<br />\r\n";
}
and replace with this code:
echo "<a href=\"$ppath". $wpath ."\">";
$elements = explode(" ",$title);
for ($i=0;$i<$words;$i++)
{
echo " $elements[$i]";
}
if (count($elements) > $words)
{
echo "$trail";
}
if ($date == "yes" || $date == "")
{
echo " " . date($date_fmt, $t_stamp) . "<br />\r\n";
}
else
{
echo "</a><br />\r\n";
}
And that’s it. To show your weblog titles on your website, place the following code in your regular pmachine template:
<?php
$wtl['show_date'] = "no";
$wtl['date_fmt'] = "M d, Y";
$wtl['limit'] = "6";
$wtl['offset'] = "0";
$wtl['orderby'] = "[b]recent[/b]";
$wtl['weblog'] = "news";
$wtl['category'] = "";
$wtl['page'] = "comments";
[b]$wtl['words'] = "3";[/b]
[b]$wtl['trail'] = "...";[/b]
?>
<?php weblog_title_list($wtl); ?>
I’m a complete newbie at php so I won’t be able to provide any support with this hack. I also cannot guarantee the reliability or efficiency of this code
