PDA

View Full Version : Page with all Featured & Partners links


Ioannis Freris
01-26-2007, 12:32 PM
Would it be nice to have a dynamic page with all Featured & Partners links. :bum-bum:

Dave Baker
01-26-2007, 08:49 PM
Hello Ioannis,
Download files from my post unzip and upload in directory:
featured-partners.php - in Root of your directory
featured-partners.tpl - in templates/yourTemplate/ of your directory
***Open templates/yourTemplate/Layout.php and find function***

function print_menu($aCategory = 0)

***In the function find code***

$menu['suggest-link']['caption'] = $gDirLang['suggest_link'];
$menu['suggest-link']['url'] = $url."suggest-link.php?id={$aCategory}";

***Below this code add***

$menu['featured-partners']['caption'] = $gDirLang['featuredpartners'];
$menu['featured-partners']['url'] = $gDirConfig['mod_rewrite'] ? $url.'featured-partners.html' : $url.'featured-partners.php';

***Save file***
***Open file classes/Dir.php and find code (the bottom of the file)***

/**
* Checks if a link was already clicked
*
* @param str $aIp ip address
*
* @return int
*/
function checkBannerClick($aId, $aIp)
{
$sql = "SELECT `id` ";
$sql .= "FROM `{$this->mPrefix}banner_clicks` ";
$sql .= "WHERE `ip` = '{$aIp}' ";
$sql .= "AND `id_banner` = '{$aId}' ";
$sql .= "AND (TO_DAYS(NOW()) - TO_DAYS(`date`)) <= 1 ";

return $this->mDb->getOne($sql);
}

***Below this function add the followin code***

/**
* Returns featured and partners links
*
* @param int $aStart starting position
* @param int $aLimit number of links to be returned
*
* @return array
*/
function getFeaturedPartnersLinks($aStart = 0, $aLimit = 0)
{
$cause = "WHERE (t1.`featured` = '1' ";
$cause .= "OR t1.`partner` = '1') ";
$cause .= "AND t1.`status` = 'active' ";

return $this->getLinksBy($aStart, $aLimit, $cause);
}

/**
* Returns number of featured and partners links
*
* @return int
*/
function getNumFeaturedPartnersLinks()
{
$sql = "SELECT COUNT(`id`) FROM `{$this->mPrefix}links` ";
$sql .= "WHERE (`featured` = '1' ";
$sql .= "OR `partner` = '1') ";
$sql .= "AND `status` = 'active' ";

return $this->mDb->getOne($sql);
}

**Save file***
***Open file .htaccess and add code

# mod_rewrite rules for featuredpartners page
RewriteRule ^featured-partners.html$ featured-partners.php [QSA,L]
RewriteRule ^featured-partners([0-9]+).html$ featured-partners.php?page=$1 [QSA,L]

***Save file***
Go to Admin Panel » Language Manager » Add Phrase
key: featuredpartners
value: Featured & Partners links

paypal2go
04-13-2007, 02:51 AM
Did everything per your instraction but not work?


Hello Ioannis,
Download files from my post unzip and upload in directory:
featured-partners.php - in Root of your directory
featured-partners.tpl - in templates/yourTemplate/ of your directory
***Open templates/yourTemplate/Layout.php and find function***

function print_menu($aCategory = 0)

***In the function find code***

$menu['suggest-link']['caption'] = $gDirLang['suggest_link'];
$menu['suggest-link']['url'] = $url."suggest-link.php?id={$aCategory}";

***Below this code add***

$menu['featured-partners']['caption'] = $gDirLang['featuredpartners'];
$menu['featured-partners']['url'] = $gDirConfig['mod_rewrite'] ? $url.'featured-partners.html' : $url.'featured-partners.php';

***Save file***
***Open file classes/Dir.php and find code (the bottom of the file)***

/**
* Checks if a link was already clicked
*
* @param str $aIp ip address
*
* @return int
*/
function checkBannerClick($aId, $aIp)
{
$sql = "SELECT `id` ";
$sql .= "FROM `{$this->mPrefix}banner_clicks` ";
$sql .= "WHERE `ip` = '{$aIp}' ";
$sql .= "AND `id_banner` = '{$aId}' ";
$sql .= "AND (TO_DAYS(NOW()) - TO_DAYS(`date`)) <= 1 ";

return $this->mDb->getOne($sql);
}

***Below this function add the followin code***

/**
* Returns featured and partners links
*
* @param int $aStart starting position
* @param int $aLimit number of links to be returned
*
* @return array
*/
function getFeaturedPartnersLinks($aStart = 0, $aLimit = 0)
{
$cause = "WHERE (t1.`featured` = '1' ";
$cause .= "OR t1.`partner` = '1') ";
$cause .= "AND t1.`status` = 'active' ";

return $this->getLinksBy($aStart, $aLimit, $cause);
}

/**
* Returns number of featured and partners links
*
* @return int
*/
function getNumFeaturedPartnersLinks()
{
$sql = "SELECT COUNT(`id`) FROM `{$this->mPrefix}links` ";
$sql .= "WHERE (`featured` = '1' ";
$sql .= "OR `partner` = '1') ";
$sql .= "AND `status` = 'active' ";

return $this->mDb->getOne($sql);
}

**Save file***
***Open file .htaccess and add code

# mod_rewrite rules for featuredpartners page
RewriteRule ^featured-partners.html$ featured-partners.php [QSA,L]
RewriteRule ^featured-partners([0-9]+).html$ featured-partners.php?page=$1 [QSA,L]

***Save file***
Go to Admin Panel » Language Manager » Add Phrase
key: featuredpartners
value: Featured & Partners links

Greg
04-13-2007, 05:28 PM
Did everything per your instraction but not work?

This mod looks to be for an older version. Not for 2.1