HowToGuides24/7

Here To Guide You Everyday

How To Create Featured Links Page PhpLD

Previously we showed you how to create featured links RSS feed but what about creating a Featured Links page?

For those of you that need this feature in your PHP Link Directory install here is how you accomplish this.

First ftp to your PhpLD install.

Open “index.php” and find the following (somewhere around line 236);

case 'latestarticles':
$articles = $db->CacheGetAll ("SELECT * FROM `{$tables['article']['name']}` WHERE (`RELEASE_DATE`<= now() OR {$permission_links_arts}) AND (`STATUS` = '2' OR {$permission_links_arts}) {$email_conf} ORDER BY `FEATURED_MAIN` DESC, `FEATURED` DESC, `DATE_ADDED` DESC LIMIT 0, ".LINKS_TOP);
$path[] = array ('ID' => '0', 'TITLE' => _L('Latest Articles'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
break;

Then right below it put this:

case 'featured':
$links = $db->CacheGetAll ("SELECT * FROM `{$tables['link']['name']}` WHERE (`FEATURED` = '1' OR {$permission_links_arts}) {$email_conf} {$expire_where} ORDER BY `HITS` DESC LIMIT 0, ".LINKS_TOP);
$path[] = array ('ID' => '0', 'TITLE' => _L('Featured Links'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
break;

Save and upload your file.

Next under the template file you are using (eg: templates/professional) open “top_bar.tpl” and somewhere around line 15 find:

<a href="{$smarty.const.DOC_ROOT}/index.php?list=top" title="{l}Browse most popular links{/l}">{l}Top Sites{/l}</a>

Right below it put this:

<a href="{$smarty.const.DOC_ROOT}/index.php?list=featured" title="{l}Browse featured links{/l}">{l}Featured{/l}</a>

Save file and upload in your site.

Then open .htaccess file and find:

#RewriteBase /

Below it put:

##Featured Rewrite
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^featured-links\.htm[l]?$ index.php?list=featured [QSA,NC,L]

Save file and upload to your site.

That’s it Folks. Now go to your website and you should see “Featured” in your menu.

PhpLD How to RSS Featured Links

Ever wondered how to get an RSS feed for your featured links on your PhpLD install? This should be a feature on phplinkdirectory but it is not so we are going to modify the code to get what we want.

First FTP to your site and open rss.php file and find

case 'top':
$sql   = "SELECT * FROM `{$tables['link']['name']}` WHERE `STATUS` = '2' {$expire_where} ORDER BY `HITS` DESC";
$limit = LINKS_TOP;
$tpl->assign('title', ' - Top Hits');
break;

and right below it include

case 'featured':
$sql   = "SELECT * FROM `{$tables['link']['name']}` WHERE `FEATURED` = '1' ORDER BY `DATE_ADDED` DESC";
$limit = LINKS_TOP;
$tpl->assign('title', ' - Featured Links');
break;

Save your rss.php file and upload to your server.  Your new Featured RSS Feed is http://yourdomain.com/rss.php?list=featured&s=P&p=1
Now you have a working RSS Feed for your featured links.