PDA

View Full Version : Latest entry in glossary?


Stavrogin
11-02-2008, 12:38 AM
Is it possible to use GAL to display the Latest Entry in the Glossary on a forum homepage? I used the following code (from this hack (http://www.vbadvanced.com/forum/showthread.php?t=29556) for the vBadvanced Links Directory) to show the latest link:

if ($forum['forumid'] == 'XX')
{
global $db;
$tot = $db->query_first("SELECT COUNT(*) as count FROM " . TABLE_PREFIX . "adv_links");
$link = $db->query_first("SELECT linkid , name, posts, username, userid, dateline FROM " . TABLE_PREFIX . "adv_links ORDER BY linkid DESC");
$date = vbdate($vbulletin->options['dateformat'], $link['dateline'], 1);
$time = vbdate($vbulletin->options['timeformat'], $link['dateline']);
$forum['lastpostinfo'] = '<div align="left" class="smallfont"><strong><a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'">'.$link[name].'</a></strong><br />by <a href="member.php?find=lastposter&f='.$link[userid].'">'.$link[username].'</a><br /><span style="float:right;">'.$date.' '.$time.' <a href="/showcase/showlink.php?do=showdetails&l='.$link[linkid].'"><img src="images/buttons/lastpost.gif" border="0" alt="View showcase"></a></span></div>';
$forum['threadcount'] = $tot['count'];
$forum['replycount'] = $link['posts'];
}

Here XX was replaced by the forumid I used. I'd like to do something similar with GAL but is it possible and, if so, how could it be achieved? The result would be a forum on the homepage that links directly to GAL (glossary.php) but shows the details of the latest entry in the "Last Post" column. Any ideas?

Morgan
11-03-2008, 04:52 PM
Custom coding really falls outside the realm of support and is not typically offered, especially for larger requests, but here is a query you could try to get the most recent entry in the gal database table:

# add your vB table prefix to the gal table name if you use a prefix
SELECT * FROM gal ORDER BY id DESC LIMIT 1;

Stavrogin
11-03-2008, 06:03 PM
Thanks, Morgan. I'll give that a try.