May 8th, 2007phpld additional fields
This allows you to add an additional field associated with a phpld link. This can be used, for instance, to add a field called “PHONE” when the submitters input his phone number. This was used in the deeplinks mod.
1. ADD the additional field (FIELD1) to the database:
The easiest way to do this is by running the sql query below in phpmyadmin
ALTER TABLE `PLD_LINK` ADD `FIELD1` TEXT NULL ;
2. The second step is to modify the submit form to add an input field with the same name “FIELD1″:
<tr>
<td class="label">FIELD 1</td>
<td class="field"><input type="text" name="FIELD1"
value="{$FIELD1|escape|trim}"
size="40" maxlength="255" class="text"/></td>
</tr>
Now the additional field is available in the database and can be filled from the submit form. Until now, the additional field is not visible from the admin panel. To make it accessible to the admin so it can be viewed or edited you will have to modify the following:
First, in admin/dir_approve_links.php
$columns = array ('TITLE' => _L('Title'),
'URL' => _L('URL'),
'DESCRIPTION' => _L('Description'),
'CATEGORY' => _L('Category'),
'RECPR_URL' => _L('Recpr. Link URL'),
'PAGERANK' => _L('Pagerank'),
'DATE_ADDED' => _L('Date Added'));
Replace by:
$columns = array ('TITLE' => _L('Title'),
'URL' => _L('URL'),
'DESCRIPTION' => _L('Description'),
'CATEGORY' => _L('Category'),
'RECPR_URL' => _L('Recpr. Link URL'),
'PAGERANK' => _L('Pagerank'),
'FIELD1' => _L('FIELD1'),
'DATE_ADDED' => _L('Date Added'));
Note that we have added the line 'FIELD1' => _L('FIELD1'),
Second, add the code below in templates/admin/link_details.tpl where you want the field to show
<tr class="{cycle values="odd,even"}">
<td class="label">FIELD 1:</td>
<td class="smallDesc">{$linkInfo.FIELD1|escape|trim}
</td>
</tr>
Finally, in templates/admin/dir_links_edit.tpl add the code below where you want to field to show when editing the listing in the admin panel.
<tr>
<td class="label"><label for="FIELD1">
FIELD 1:</label></td>
<td class="smallDesc">
<input type="text" id="FIELD1" name="FIELD1"
value="{$FIELD1|escape|trim}" class="text" />
</td>
</tr>
Now the additional field can be viewed and edited from the admin panel. However it is not displayed yet to the directory visitor. Usually it will be displayed in the details page of each listing. This is done as follows:
1. in detail.php
Find:
$data['META_DESCRIPTION'] = $rdata['META_DESCRIPTION'];
Below it, add:
$data['FIELD1'] = $rdata['FIELD1'];
2. in detail.tpl, add the code below where you want the additional field to appear:
{$FIELD1|escape|trim}
9 Responses to “phpld additional fields”
Leave a Reply
You must be logged in to post a comment.

May 12th, 2007 at 3:19 pm
Please confirm if this works with all versions ? Thanks.
May 15th, 2007 at 9:04 am
Hi, I am not sure about the free versions, never looked at their code but it definitely work on all 3.xx versions.
If you test it on s free version please report it here.
July 17th, 2007 at 7:43 am
[...] your coder to do it, as it is fairly easy. Or you can do it your self by visiting a popular blog here, with a lot of “do it your self” free [...]
September 5th, 2007 at 2:16 pm
Hi,
I would like to add the new field within the listing too not only within the detail page. How may I do that?
Thanks
September 8th, 2007 at 4:45 am
I cannot find the dir_links_edit.tpl file. Shouldn’t this file be in the admin folder?? Thx
September 8th, 2007 at 6:37 am
Is this mod appliable for v 3.2?
March 19th, 2008 at 11:22 am
Hello and thanks for the MOD. It is very helpful, but there is a problem with ‘Reviewed Links’. When the user edit the additional fields, the changes don’t refer to the database. Please could you update the MOD? Thanks!
July 11th, 2008 at 10:52 pm
[...] additional fields (Rakcha.com): This allows you to add an additional field associated with a phpld link. This can be [...]
November 15th, 2008 at 5:10 am
Please note the above article is incomplete without adding the Reviewed Links.
So please add the code below
ALTER TABLE `PLD_LINK_REVIEW` ADD `FIELD1` TEXT NULL ;