PDA

View Full Version : Front page "Latest Links" and "Top Links" (phpld)


topvip
2007-07-10, 03:31 PM
I would like to add my Latest Links and my Top Links to my index page instead of having a seperate page for them. How would I go about doing this?

topvip
2007-07-10, 03:33 PM
Try this:

Open index.php and find: echo $tpl->fetch('main.tpl', $id);
BEFORE that add this code:
$top10 = $db->GetOne("SELECT * FROM {$tables['link']['name']} WHERE STATUS = 2 ORDER BY HITS DESC LIMIT 0,10");
$last10 = $db->GetOne("SELECT * FROM {$tables['link']['name']} WHERE STATUS = 2 ORDER BY ID DESC LIMIT 0,10");
$tpl->assign('top10', $top10);
$tpl->assign('last10', $last10);
Open main.tpl

Where you want the top10 list to appear add:
{foreach from=$top10 item=link name=links}
{$link.URL}

{/foreach}
Where you want the last10 list to appear add:
{foreach from=$last10 item=link name=links}
{$link.URL}

{/foreach}

topvip
2007-07-10, 03:37 PM
I've added the code and got it up and running, but, it's showing on all my pages, how can I limit it to the frontpage only?