网络营销电子商务研究中心

网络营销电子商务研究中心 (https://www.0058.net/index.php)
-   Web Directory (https://www.0058.net/forumdisplay.php?f=60)
-   -   Random Featured Links on front page (phpld) (https://www.0058.net/showthread.php?t=2721)

topvip 2007-08-18 12:28 AM

Random Featured Links on front page (phpld)
 
This is working and tested with version 2.1, see at www.azet.co.uk

new file random_featured.tpl in templates dir
Quote:

{if $category.ID eq 0 and not $p and not $qu}
<h2>{l}Random Featured Links{/l}</h2>
<div class="featured">
{foreach from=$random_link item=link name=links}
{include file="link.tpl" link=$link}
{/foreach}</div>
{/if}
edit templates/main.tpl - paste the code where you want to display the links
Quote:

{include file="random_featured.tpl"}
i am using as showed bellow with combination of google adsense
Quote:

{if $smarty.const.FTR_ENABLE == 1 and !empty($feat_links)}
<h2>{l}Featured Links{/l}</h2>
<br />
<div class="featured">
{foreach from=$feat_links item=link name=links}
{include file="link.tpl" link=$link}
{/foreach}</div>
{/if}

{* google *}
{if $category.ID != 0}
{include file="googlead.tpl"}
{else}
{include file="random_featured.tpl"}
{/if}
last edit index.php
find
Quote:

echo $tpl->fetch('main.tpl', $id);
place above

Quote:

$random_link = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE FEATURED = 1 AND STATUS=2 ORDER BY RAND() LIMIT 3");
$tpl->assign('random_link', $random_link);
that's it

for more customized design edit in random_featured.tpl line

Quote:

{include file="link.tpl" link=$link}
to

Quote:

{include file="link2.tpl" link=$link}
now you need to create new file link2.tpl as new template for the random featured links on front page

have fun

topvip 2007-08-18 12:29 AM

just an example:
http://www.azet.co.uk/


All times are GMT +8. The time now is 06:29 PM.

Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.