Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Mods and contribution Discussion

Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum.

Closed Thread
 
Thread Tools Display Modes
Old 07-01-2005   #1
David
Administrator
phpLD Administrator
Supporter
 
David's Avatar
 
Join Date: Jan 2005
Posts: 11,667
Default Rate Links Mod

A big thanks to yktan for this mod, which will likely be added to future releases. This mod allows users to rate links, but only one rating per ip address is allowed.

Attention: this mod has been edited. Please read the entire thread!
David is offline  
Old 07-02-2005   #2
seothatworks
 
Join Date: Jun 2005
Posts: 109
Send a message via AIM to seothatworks Send a message via Yahoo to seothatworks
Default

Good one. But hopefully it will be only optional in future releases. I have seen it being misused mostly :(.
__________________
Greetings, Tom
Legal Dictionary
seothatworks is offline  
Old 07-02-2005   #3
yktan
 
Join Date: Jun 2005
Posts: 353
Default

Quote:
Originally Posted by seothatworks
Good one. But hopefully it will be only optional in future releases. I have seen it being misused mostly :(.
Thanks seothatworks. Don't worry, the rating feature can be turned on and off in the admin panel, so rest assured.

Regards,
YK
yktan is offline  
Old 07-02-2005   #4
David
Administrator
phpLD Administrator
Supporter
 
David's Avatar
 
Join Date: Jan 2005
Posts: 11,667
Default

Yep, and that is one of the beauties of this program, tehe ability to customize it to your needs. We just now releasing the Featured Links module and Payment mudule in the latest development version in the WebSVN.
David is offline  
Old 07-25-2005   #5
yktan
 
Join Date: Jun 2005
Posts: 353
Default

Hi, this Rate Mod has been upgraded to cater for the most recent release of PHP Link Directory. Please use this version if you are using RC4 and above.

Regards,
York Kie
__________________
Greatest fear in a coder\'s world: A minute bug with correct syntax.
{link removed from sig as the account seemed to be suspended}
yktan is offline  
Old 07-25-2005   #6
ant1980
 
Join Date: Jul 2005
Posts: 7
Default

Hi Yktan,
in the RC4 i do not find this code[in red color] but the first line only:

Quote:
#-----[ OPEN ]------------------------------------------
#
/admin/dir_links_edit.php
#
#-----[ FIND ]------------------------------------------
#
$data = $db->GetRow("SELECT * FROM {$tables['link']['name']} WHERE ID = $id");
if ($db->Execute("DELETE FROM {$tables['link']['name']} WHERE ID='$id'")) {
$data['STATUS'] = 0;
send_status_notifications($data, false);
if (isset ($_SESSION['return'])) {
header("Location: ".$_SESSION['return']);
exit;
}
} else {
$tpl->assign('sql_error', $db->ErrorMsg());
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
$data = $db->GetRow("SELECT * FROM {$tables['link']['name']} WHERE ID = $id");
if ($db->Execute("DELETE FROM {$tables['link']['name']} WHERE ID='$id'")) {
$data['STATUS'] = 0;
send_status_notifications($data, false);
if ($db->Execute("DELETE FROM {$tables['link_rate']['name']} WHERE LINK_ID='$id'")) {
if (isset ($_SESSION['return'])) {
header("Location: ".$_SESSION['return']);
exit;
}
} else {
$tpl->assign('sql_error', $db->ErrorMsg());
}
} else {
$tpl->assign('sql_error', $db->ErrorMsg());
}
Bye
ant1980 is offline  
Old 07-25-2005   #7
yktan
 
Join Date: Jun 2005
Posts: 353
Default

Hi ant1980,

The Mod is done for the lastest release of PHP Link Directory. If you are using RC4, you may have to follow some instructions from the first version of the Mod and some from the new version of the Mod.

Ie. The instruction for the part you're trying to change (for the first version of the Mod) is:
Code:
#
#-----[ OPEN ]------------------------------------------
#
/admin/dir_links_edit.php
#
#-----[ FIND ]------------------------------------------
#
if ($db->Execute("DELETE FROM {$tables['link']['name']} WHERE ID='$id'")) {
	if (isset ($_SESSION['return'])) {
		header("Location: ".$_SESSION['return']);
		exit;
	}
} else {
	$tpl->assign('sql_error', $db->ErrorMsg());
}
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ($db->Execute("DELETE FROM {$tables['link']['name']} WHERE ID='$id'")) {
	if ($db->Execute("DELETE FROM {$tables['link_rate']['name']} WHERE LINK_ID='$id'")) {
		if (isset ($_SESSION['return'])) {
			header("Location: ".$_SESSION['return']);
			exit;
		}
	} else {
		$tpl->assign('sql_error', $db->ErrorMsg());
	}
} else {
	$tpl->assign('sql_error', $db->ErrorMsg());
}
Regards,
YK
__________________
Greatest fear in a coder\'s world: A minute bug with correct syntax.
{link removed from sig as the account seemed to be suspended}
yktan is offline  
Old 07-25-2005   #8
ant1980
 
Join Date: Jul 2005
Posts: 7
Default

Thx yktan,
i'have solved applying the mod to the version in development {url removed because it is no longer active}
Now it work fine :wink:

Regards

Last edited by David; 06-10-2008 at 02:45 AM.
ant1980 is offline  
Old 08-02-2005   #9
malooga
 
Join Date: Aug 2005
Posts: 4
Default

Is there any way to display a "Top Rated Links" page or box?
malooga is offline  
Old 08-03-2005   #10
yktan
 
Join Date: Jun 2005
Posts: 353
Default Rating Mod with sorting

Hi, attached is the Rating Mod that includes sorting by Rating in the index page.

For those who already applied Rating Mod v1.0.1, just do the following changes:

Open /index.php
Find:
Code:
$sort_cols = array ( 'P' => 'PAGERANK', 'H' => 'HITS', 'A' => 'TITLE');
$sort_ord = array ( 'P' => 'DESC', 'H' => 'DESC', 'A' => 'ASC');
Replace with:
Code:
$sort_cols = array ( 'P' => 'PAGERANK', 'H' => 'HITS', 'R' => 'RATE', 'A' => 'TITLE');
$sort_ord = array ( 'P' => 'DESC', 'H' => 'DESC', 'R' => 'DESC', 'A' => 'ASC');

Open /templates/main.tpl
Find:
Code:
{if $sort eq 'H'} <span class="sort">{l}Hits{/l}</span>{else} {l}Hits{/l}{/if}
Add below:
Code:
{if $sort eq 'R'} | <span class="sort">{l}Rating{/l}</span>{else} | {l}Rating{/l}{/if}
Regards,
York Kie
__________________
Greatest fear in a coder\'s world: A minute bug with correct syntax.
{link removed from sig as the account seemed to be suspended}
yktan is offline  
Old 08-05-2005   #11
jetlag
Supporter
 
Join Date: Aug 2005
Posts: 14
Default

Hello
Thanks for the rate mod it works great. The only problem i had (im new to this) was i use wordpad and when copying/paste the code it pasted it wrong... or wordpad displays it wrong. It didnt show the "Rate It" link.

Code:
#
/templates/link.tpl
#
#-----[ FIND ]------------------------------------------
#


{$link.DESCRIPTION}</p>
#
#-----[ REPLACE WITH ]------------------------------------------
#


{$link.DESCRIPTION}
{if $link.RATE_ENABLED eq 1}
<span class="url">(Hits: {$link.HITS} Rating: {$link.RATE} Votes: {$link.RATE_COUNT}) <a href=
	"{$smarty.const.DOC_ROOT}/rate.php?id={$link.ID}">Rate It</a></span>{/if}</p>
#
Changed to this...
Code:
{$link.DESCRIPTION}
{if $link.RATE_ENABLED eq 1}
<span class="url">(Hits: {$link.HITS} Rating: {$link.RATE} Votes: {$link.RATE_COUNT}) Rate It</span>{/if}</p>
jetlag is offline  
Old 08-05-2005   #12
minstrel
 
Join Date: Jun 2005
Posts: 204
Default

Don't use WordPad to edit php files... it adds formatting and probably wordwrap.

You need a plain ascii text editor like NotePad or a php editor such as Crimson Editor (excellent and freeware -- download at http://www.crimsoneditor.com).
minstrel is offline  
Old 08-05-2005   #13
vkaryl
 
Join Date: Aug 2005
Posts: 263
Default

Another good free editor is Notepad2 from http://www.flos-freeware.ch - in fact, it's SO good I've set it to replace windows' notepad. Line counting, color coding, etc. standard....
__________________
{Signature Edited - Old non-working links removed}
vkaryl is offline  
Old 08-07-2005   #14
jetlag
Supporter
 
Join Date: Aug 2005
Posts: 14
Default

great...thanks for the links
jetlag is offline  
Old 08-07-2005   #15
jetlag
Supporter
 
Join Date: Aug 2005
Posts: 14
Default

Hello
what do you change to make the font smaller and change the color to grey or black on the "Rate It" link. I find it sticks out too much.
(Hits: 2 Rating: 0.00 Votes: 0) Rate It <--

Thanks
Jetlag
canadianpwc.com/directory/Rentals/
jetlag is offline  
Old 08-08-2005   #16
yktan
 
Join Date: Jun 2005
Posts: 353
Default

Hi jetlag, the font I used is a class from css called "url". To change it, simply open templates\link.tpl and change it to another class that you want.

Regards,
York Kie
__________________
Greatest fear in a coder\'s world: A minute bug with correct syntax.
{link removed from sig as the account seemed to be suspended}
yktan is offline  
Old 08-08-2005   #17
jetlag
Supporter
 
Join Date: Aug 2005
Posts: 14
Default

Thanks
jetlag is offline  
Old 08-24-2005   #18
righthosts
 
Join Date: Aug 2005
Posts: 35
Default

Hi,

Does this mod work with 5.2?
righthosts is offline  
Old 08-29-2005   #19
Nobody
Supporter
 
Join Date: Aug 2005
Location: Sweden
Posts: 218
Default

Will the next release of the major script include this mod?
Nobody is offline  
Old 09-08-2005   #20
VSDan
Supporter
Moderator
 
VSDan's Avatar
 
Join Date: Sep 2005
Location: Vancouver, BC, Canada
Posts: 1,180
Default

1. Original mod works with RC5.2

2. Here are some changes you can make to display a [Top Rated] in your Top Menu Bar:

(a) Locate the following code in /templates/top_bar.tpl:

Code:
htxp://{$smarty.const.DOC_ROOT}/index.php?p=h"]{l}Top Hits{/l}
|
...and add the following afterwards:

Code:
htxp://{$smarty.const.DOC_ROOT}/index.php?p=r"]{l}Top Rated{/l}
|
(b) Locate the following code in /index.php:

Code:
case 'h':
$links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY hits desc limit 0, ".LINKS_TOP);
$path[] = array ('ID' => '0', 'TITLE' => _L('Popular Listings'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
break;
...and add the following afterwards:

Code:
case 'r':
$links = $db->GetAll("SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY rate desc limit 0, ".LINKS_TOP);
$path[] = array ('ID' => '0', 'TITLE' => _L('Top Rated'), 'TITLE_URL' => '', 'DESCRIPTION' => '');
break;
(c) Locate the following code in /rss.php:

Code:
case 'h':
$sql = "SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY HITS DESC";
$tpl->assign('title', ' - Popular Listings');
break;
...and add the following afterwards:

Code:
case 'r':
$sql = "SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY RATE DESC";
$tpl->assign('title', ' - Top Rated Listings');
break;
I revised post and added (c). Otherwise, RSS feed was broken when you clicked on RSS icon on [Top Rated Listings] page.


Regards,

Dan
Virtual Solutions
monster-submit.com

Last edited by David; 08-21-2008 at 06:11 PM.
VSDan is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:42 AM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.