I have seen some people asking why the random featured listings are not showing on the homepage after installing the featured listing mod. Thanks to Dawzz, who is a phpLD moderator in phpLD forum, solved this problem.
The original code is:
Find
echo $tpl->fetch('main.tpl', $id);
in your index.php, and above it, place:
$random_link = $db->Execute("SELECT * FROM {$tables['link']['name']} WHERE FEATURED = 1 AND STATUS=2 ORDER BY RAND() LIMIT 5");
$tpl->assign('random_link', $random_link);
Then place this in your main.tpl file depending on where you want display it
if $category.ID eq 0 and not $p and not $qu}{l}Random Link{/l}:
{foreach from=$random_link item=link name=links}
{/foreach}{/if}
For some people, this is not working, the homepage shows nothing, to fix it, in your index file,
use GetAll instead of Execute:
$random_link = $db->GetAll(”SELECT * FROM {$tables[’link’][’name’]} WHERE FEATURED = 1 AND STATUS=2 ORDER BY RAND() LIMIT 5″);
$tpl->assign(’random_link’, $random_link);
then in your main.tpl
use
if !$uid & !$search & empty($category.ID) & !$list & $scriptname == "index"}
instead of
{if $category.ID eq 0 and not $p and not $qu}
At last, add this to your init.php before ?>
$tpl->assign('scriptname' , basename($_SERVER[PHP_SELF], ".php"));
