![]() |
| |||||||
| Mods and contribution Discussion This forum is only for discussion of modding phpLD. For specific mod releases, please see the appropriate forum. |
![]() |
| | Thread Tools | Display Modes |
| | #1 |
| Administrator phpLD Administrator Supporter Join Date: Jan 2005 Posts: 11,667 | 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! |
| |
| | #2 |
| Good one. But hopefully it will be only optional in future releases. I have seen it being misused mostly :(. | |
| |
| | #3 | |
| Join Date: Jun 2005 Posts: 353 | Quote:
Regards, YK | |
| |
| | #4 |
| Administrator phpLD Administrator Supporter Join Date: Jan 2005 Posts: 11,667 | 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. |
| |
| | #5 |
| Join Date: Jun 2005 Posts: 353 | 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} |
| |
| | #6 | |
| Join Date: Jul 2005 Posts: 7 | Hi Yktan, in the RC4 i do not find this code[in red color] but the first line only: Quote:
| |
| |
| | #7 |
| Join Date: Jun 2005 Posts: 353 | 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());
} 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} |
| |
| | #8 |
| Join Date: Jul 2005 Posts: 7 | 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. |
| |
| | #9 |
| Join Date: Aug 2005 Posts: 4 | Is there any way to display a "Top Rated Links" page or box? |
| |
| | #10 |
| Join Date: Jun 2005 Posts: 353 | 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'); 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} Code: {if $sort eq 'R'} | <span class="sort">{l}Rating{/l}</span>{else} | {l}Rating{/l}{/if} 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} |
| |
| | #11 |
| Supporter Join Date: Aug 2005 Posts: 14 | 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>
# 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> |
| |
| | #12 |
| Join Date: Jun 2005 Posts: 204 | 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). |
| |
| | #13 |
| Join Date: Aug 2005 Posts: 263 | 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} |
| |
| | #14 |
| Supporter Join Date: Aug 2005 Posts: 14 | great...thanks for the links |
| |
| | #15 |
| Supporter Join Date: Aug 2005 Posts: 14 | 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/ |
| |
| | #16 |
| Join Date: Jun 2005 Posts: 353 | 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} |
| |
| | #17 |
| Supporter Join Date: Aug 2005 Posts: 14 | Thanks |
| |
| | #18 |
| Join Date: Aug 2005 Posts: 35 | Hi, Does this mod work with 5.2? |
| |
| | #19 |
| Supporter Join Date: Aug 2005 Location: Sweden Posts: 218 | Will the next release of the major script include this mod? |
| |
| | #20 |
| Supporter Moderator Join Date: Sep 2005 Location: Vancouver, BC, Canada Posts: 1,180 | 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}
| Code: htxp://{$smarty.const.DOC_ROOT}/index.php?p=r"]{l}Top Rated{/l}
| 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; 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; Code: case 'h':
$sql = "SELECT * FROM {$tables['link']['name']} WHERE STATUS=2 $expire_where ORDER BY HITS DESC";
$tpl->assign('title', ' - Popular Listings');
break; 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; Regards, Dan Virtual Solutions monster-submit.com Last edited by David; 08-21-2008 at 06:11 PM. |
| |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|