July 1st, 2007phplb Description
With this mod you get rid of the two lines description and replace it with a regular text area. After installing this mod you will have to adjust previous listing to this new format (last step of this tutorial).
1. in buy.php
FIND
$kForm->addText('Description Line 1', 'link_desc1', '',
$cfg->getVar('link_desc_max'),$cfg->getVar('link_desc_max'),
'onKeyUp="lpUpdate();"');
$kForm->addText('Description Line 2', 'link_desc2', '',
$cfg->getVar('link_desc_max'),$cfg->getVar('link_desc_max'),
'onKeyUp="lpUpdate();"');
REPLACE BY
$kForm->addTextArea('Description', 'link_description', '', 3, 50);
FIND
$kForm->addRule('link_desc1', 'desc');
$kForm->addRule('link_desc2', 'desc');
REPLACE BY
$kForm->addRule('link_description', 'desc');
2. in link.tpl
FIND
<div class="link-desc">{link_desc1}<br />{link_desc2}</div>
REPLACE BY
<div class="link-desc">{link_description}</div>
3. in links.tpl
FIND
{link_desc1}<br />{link_desc2}
REPLACE BY
{link_description}
4. in admin/links.php
FIND
$kForm->addText('Description Line 1', 'link_desc1', '', 50, 50);
$kForm->addText('Description Line 2', 'link_desc2', '', 50, 50);
REPLACE BY
$kForm->addTextArea('Description', 'link_description', '', 3, 50);
FIND
$kForm->addRule('link_desc1', 'required');
REPLACE BY
$kForm->addRule('link_description', 'required');
5. in link_preview.tpl
REPLACE everything by:
<br />
<h1>Link Preview</h1>
<table width="100%" cellpadding="0px" cellspacing="0px" border="0px">
<tr>
<td valign="top" class="link-bidbg" nowrap>
<div id="link-bid" class="link-bid">${bid_amount}</div>
<div class="link-place">Current Bid</div></td>
<td class="link-cell">
<div id="link-title" class="link-title">Link Title</div>
<div id="link-desc" class="link-desc">Link description</div>
</td>
</tr>
</table>
<br />
<script language="JavaScript" type="text/javascript">
<!--
function lpUpdate()
{
chHtml("link-title", document.getElementById("link_title").value);
chHtml("link-desc", document.getElementById("link_description").value);
chHtml("link-bid", "$" + document.getElementById("link_bid").value);
}
lpUpdate();
//-->
</script>
6. Adjust previous listings. To do so, create a file migrate-desc.php with the following content:
<?php
include("inc/sql_config.php");
mysql_connect(DB_HOST, DB_USERNAME,DB_PASSWORD)
or die("cannot to connect to server");
mysql_select_db(DB_NAME) or die("cannot to connect to the database");
$query = "SELECT link_desc1,link_desc2,link_id FROM tbl_links WHERE 1";
$result = mysql_query($query) or die('Query failed: ' . mysql_error());
while($row = @mysql_fetch_array($result)) {
extract($row);
$link_description = $link_desc1 . ' ' . $link_desc2;
$query = "UPDATE tbl_links SET link_description = \"" .
$link_description . "\" WHERE link_id=" . $link_id;
mysql_query($query);
}
?>
Upload the file to the root of your directory and open it in the browser http://www.youdirectory.com/migrate-desc.php
Everything should be fine now! please delete migrate-desc.php from your root.
Please visit our supporters!
12 Responses to “phplb Description”
Leave a Reply
You must be logged in to post a comment.


July 1st, 2007 at 8:38 pm
Great MOD. i use my Bidding Directory http://www.1dollarlink.com. thank you very much.
July 1st, 2007 at 8:44 pm
you already implemented it? wow that was quick
July 1st, 2007 at 9:11 pm
A great mod. thanks a lot
mike
July 2nd, 2007 at 7:44 am
Just implemented this but noticed a small problem. The description preview no longer works.
July 2nd, 2007 at 8:12 am
Actually it works but it updates only when you are writing the title or after you specify the bid. This is caused by by the fact that the library used klib does not support the OnKeyUp event for textareas, this can be corrected by modifying few files for that library. I think this is why the developers of phplb opted for two lines description eventhough it is not hard at all to make the required changes for textareas. I didn’t want to modify library files.
July 6th, 2007 at 12:36 am
Doesn’t seem to be a way to limit the the amount of text… when you type in the limit in the Admin backend nothing happens… so I like this but there has to be some limit… If I can’t limit it… I may have to return to 2 lines… Aside from reverting to the previous files… how do think I would reverse the migration, or can it be done?
Jeff
July 6th, 2007 at 2:05 am
You can set a limit if you modify the function addTextarea in the library file /klib/class.kForm.php (around line 135). I didn’t want to touch those files.
If you want to go back to two lines description you don’t have to change anything for the database as the previous data was not removed. Only those submissions after the MOD should be modified manually, you can do that in the admin panel.
July 15th, 2007 at 1:00 am
If you have rss feeds the description will be missing. To fix this you can do the following.
In rss.php scroll down till you find:
$html .= “” . htmlspecialchars($rs->fields['link_desc1'] . ” ” . $rs->fields['link_desc2']) . “\n”;
around line 93 and change it to:
$html .= “” . htmlspecialchars($rs->fields['link_description'] ) . “\n”;
July 15th, 2007 at 4:31 pm
I use this MOD aswell- You can check here: http://www.friendlydirectories.com
Thank you rakCha!
July 17th, 2007 at 4:36 pm
Nice work you can see we made some changes as your codes shows above..
July 30th, 2007 at 5:57 am
Thanks a lot for the code. Planning to use this code in my web directory http://www.urlwebdirectory.com.
August 14th, 2007 at 2:16 am
[...] you have modded your description fields for phpLB using this great mod from Rakcha and you are using rss feeds, then the descriptions will be missing from the feed. A solution I used [...]