Go Back   PHP Link Directory Forum > PHP Link Directory (phpLD) > Support (Version 2)

Support (Version 2) Here is where we provide limited support for version 2. If you are seeking support for version 3 please post in the phpLD 3.0 Support Forum.

Closed Thread
 
Thread Tools Display Modes
Old 06-27-2005   #1
mgiroir
 
Join Date: Jun 2005
Posts: 13
Default Where is data inserted into table?

Where is the link data inserted into the PLD_LINK table? I am trying to add fields to the link submit page and cannot seem to find where the data is inserted into the table. Any help would be appreciated.
__________________
Marshall
mgiroir is offline  
Old 06-27-2005   #2
David
Administrator
phpLD Administrator
Supporter
 
David's Avatar
 
Join Date: Jan 2005
Posts: 11,667
Default

Hi, I moved this topic over to General Support, but if you finish your mod, I hope you will submit the code.

I'm pretty sure you will find what you need in includes/functions.php
David is offline  
Old 06-27-2005   #3
mgiroir
 
Join Date: Jun 2005
Posts: 13
Default Adding fields

You must know how to add fields to your database table to use this process for adding fields.

Where you see CHANGE_ME_LABEL, change to the label of the field as seen in the browser.
Where you see CHANGE_ME_FIELD, change this to the name of the field created in the database.

Create a new field in your database after all other fields (at the end of the table)


************************************************** ***********************************
// ADD to include/tables.php

// FIND:
$tables['link'] = array(
'name' => TABLE_PREFIX.'LINK',
'fields' => array(
'ID' => 'I KEY AUTO',
'TITLE' => 'C(100) NOTNULL',
'DESCRIPTION' => 'C(255)',
'URL' => 'C(255) NOTNULL',
'CATEGORY_ID' => 'I NOTNULL',
'RECPR_URL' => 'C(255)',
'RECPR_REQUIRED' => 'L NOTNULL DEFAULT 0',
'STATUS' => 'I NOTNULL DEFAULT 0',
'VALID' => 'L NOTNULL DEFAULT 0',
'RECPR_VALID' => 'L NOTNULL DEFAULT 0',
'OWNER_NAME' => 'C(100)',
'OWNER_EMAIL' => 'C(100)',
'IPADDRESS' => 'C(15) NOTNULL',
'DATE_MODIFIED' => 'T DEFDATE',
'DATE_ADDED' => 'T DEFDATE',
'HITS' => 'I NOTNULL DEFAULT 0',
'LAST_CHECKED' => 'T',
'RECPR_LAST_CHECKED' => 'T',
'PAGERANK' => 'I NOTNULL DEFAULT -1',
'RECPR_PAGERANK' => 'I NOTNULL DEFAULT -1',
// ADD THIS
'CHANGE_ME_FIELD' => '',
// END ADD THIS
),


************************************************** ********************



{* ADD to templates/submit.tpl *}
{* This will add the text box to the submit form *}

<tr>
<td class="label">{l}CHANGE_ME_LABEL{/l}:</td>
<td class="field">
<input type="text" name="CHANGE_ME_FIELD" value="{$CHANGE_ME_FIELD}" size="40" maxlength="100" class="text"/>
</td>
</tr>


************************************************** ***********************************


// INSERT INTO admin/dir_approve_links.php
// This adds the extra column when you are approving links

// Find:
$tpl->assign('columns', array ('TITLE' => _L('Title'), 'URL' => _L('URL'), 'DESCRIPTION' => _L('Description'), 'CATEGORY' => _L('Category'), 'RECPR_URL' => _L('Recpr. Link URL'), 'DATE_ADDED' => _L('Date Added')));

// Insert 'CHANGE_ME_FIELD' => _L('CHANGE_ME_LABEL')
// where you want it to display. If you want it to display a column
// between title and url... insert the above code like this:
$tpl->assign('columns', array ('TITLE' => _L('Title'), 'CHANGE_ME_FIELD' => _L('CHANGE_ME_LABEL'), 'URL' => _L('URL'), 'DESCRIPTION' => _L('Description'), 'CATEGORY' => _L('Category'), 'RECPR_URL' => _L('Recpr. Link URL'), 'DATE_ADDED' => _L('Date Added')));


************************************************** ********************

{* Insert into templates/admin/link_details.tpl *}

{* Insert: *}
<tr><td>{l}CHANGE_ME_LABEL{/l}:</td><td> {$row.CHANGE_ME_FIELD}</td></tr>

{* where ever you want it to be displayed when hovering over the link title *}
{* when approving links or viewing links in admin *}




************************************************** *********************

{* Insert into templates/admin/dir_links_edit.tpl *}
{* This will add the extra fields where you edit links in the admin panel *}

{* INSERT where you need the additional field displayed *}
<tr>
<td class="label">{l}CHANGE_ME_LABEL{/l}:</td>
<td class="smallDesc">
<input type="text" name="CHANGE_ME_FIELD" value="{$CHANGE_ME_FIELD}" size="20" maxlength="40" class="text"/>
</td>
</tr>
__________________
Marshall
mgiroir is offline  
Old 06-27-2005   #4
David
Administrator
phpLD Administrator
Supporter
 
David's Avatar
 
Join Date: Jan 2005
Posts: 11,667
Default

I really appreciate you taking the time to post this. It will be a good reference.
Thanks,
David
David is offline  
Old 11-04-2005   #5
richm
Supporter
 
Join Date: Oct 2005
Posts: 50
Default

Thank You... Thank You... Thank You! This worked really slick. I was able to add phone number fields, and city, state, country fields to the links database. After adding the new fields to the database using my SQL admin tool, I modified these three files (as per your instructions):
- include/tables.php (to add the new field to the program array)
- templates/submit.tpl (modify the end-user submit screen)
- templates/admin/dir_links_edit.tpl (modify admin submit/edit screen)

These files are purely optional:
- admin/dir_approve_links.php (optional, for admin approval list)
- templates/admin/link_details.tpl (optional, for popup details window)
richm is offline  
Old 11-04-2005   #6
Tim_Myth
 
Join Date: Oct 2005
Location: Polar Regions
Posts: 254
Default

That is some excellent info! If there were a rep system on this board, I'd give you some.
Tim_Myth is offline  
Old 01-04-2006   #7
Hardy
 
Join Date: Jan 2006
Posts: 1
Default New fields other than the (text type).

Hi all,

Let me start by saying this seems to be a great script. I downloaded it and am trying to customize it for my needs. Currently running this at home network before I can roll it out.


This is a wonderful post mgiroir. It was very helpful when I added a few fields to the database, 7 to be exact.
One field holds a 4 digit year and was set as a varchar(4) default 0000
This was presented in the submit page as a drop down select menu populated with a range of years.

The other 6 were set up as a tinyint with a default value 0 to be presented as check boxes, the submitter would check all that applies.

Now, I'm not very familiar with the smarty engine and tried to add a validation and capture for those fields but nothing worked.

My question is: How can I add validation and capture to the submit.php/tpl

Validation:
1- user has to select a value from the drop down year menu.
2- user has to select at least one of the 6 check boxes corresponding to 6 different fields.

Capture:
If the form submit produces an error, the entered values of both drop down menu and check boxes stay selected.

Same goes for Admin, when editing and validating submitted links

Any help is greatly appreciated,
Hardy
Hardy is offline  
Old 02-08-2006   #8
BoInG
 
Join Date: Feb 2006
Posts: 6
Default

This is an nice add-on, but i have a small question.

I have made all the stepts above and it's working nicely. But how to insert this field in my pages....

I have the field country and i will like to add it to the description page. How to insert it there?
BoInG is offline  
Old 03-05-2006   #9
Mortenh
 
Join Date: Mar 2006
Location: Norway
Posts: 2
Default

I follow the instruction above and it works fine when submitting links, but inputs from new fields are gone when i try to edit the link from adminpanel. Inputs also disipeer from database when editing a link.

What must i do to correct this?
Mortenh is offline  
Old 03-29-2006   #10
bobby9101
 
bobby9101's Avatar
 
Join Date: Sep 2005
Posts: 678
Default

I added a field on my submit page so that it requests an optional button image for the visitors site, I would like this button to display next to their link, how do I do this?
__________________
Please check your sig links
bobby9101 is offline  
Old 04-23-2006   #11
minute
Supporter
 
Join Date: Mar 2006
Posts: 114
Default Good questions

I went into detail.tpl and copied this into it

<tr>
<td class="label">{l}Country{/l}:</td>
<td class="smallDesc" align="left">{$Country|escape}>{$State|escape}>{$City|escape}</td>
</tr>
<tr>
<td class="label">{l}Phone{/l}:</td>
<td class="smallDesc" align="left">{$Phone|escape}</td>
</tr>

But for some reason the database does not insert the fields.

e.g where it says $state it does not show and comes out blank

Anyone, otherwise this is a great bit of code which will allow me
to do a lot of stuff.
__________________
Get your Aussie site listed at Australian Web Directory
minute is offline  
Old 07-16-2006   #12
Perrine
 
Join Date: Jul 2006
Posts: 44
Default

Ok, I suppose my answer will come too late for minute and bobby but don't forget to add in, for example, detail.php the CHANGE_ME_FIELD with :

Code:
          $data['CHANGE_ME_FIELD'] = $rdata['CHANGE_ME_FIELD'];
around line 66
Perrine is offline  
Old 07-16-2006   #13
discover
 
Join Date: Mar 2006
Posts: 416
Default nearly

using the info from mgiroir exept the admin parts (added the edit link admin part only)
added this to detail.tpl

<tr>
<td class="label">{l}Phone{/l}:</td>
<td class="smallDesc" align="left">{$PHONE|escape|trim}</b></td>
</tr>

as much as everything seems to be done right (i think) i still dont see the entered information alongside the label names in detail
i can see them within admin when someone submits so it must be something in between
any help pleeeeease
al

Last edited by discover; 07-16-2006 at 10:14 PM.
discover is offline  
Old 07-16-2006   #14
Perrine
 
Join Date: Jul 2006
Posts: 44
Default

In detail.php, you should add this

Code:
$data['PHONE'] = $rdata['PHONE'];
just after this (line 66)

Code:
$data['META_DESCRIPTION'] = $rdata['META_DESCRIPTION'];
and in detail.tpl, this

Code:
 <tr>
 <td class="label">{l}Phone{/l}:</td>
 <td class="smallDesc" align="left">{$PHONE|escape|trim}</b></td>
 </tr>
Hope this works
Perrine is offline  
Old 07-16-2006   #15
discover
 
Join Date: Mar 2006
Posts: 416
Default thanks

thanks man worked perfectly
appreciate it
al
discover is offline  
Old 07-16-2006   #16
Perrine
 
Join Date: Jul 2006
Posts: 44
Default

you're welcome
Perrine is offline  
Old 07-18-2006   #17
Teknotant
 
Join Date: Apr 2006
Posts: 16
Default

Thanks Perrine for the info but I am having trouble trying to put the data that was submitted placed into a URL. For example I want the data that I collected in the submit page to be at the end of a url in a link. This URL would also be placed under the PR Bar just so you get a barring on where I will be placing this URL.

Example: <a href="www.domainname.com/something/{$ID}">click here</a>
Teknotant is offline  
Old 07-19-2006   #18
Teknotant
 
Join Date: Apr 2006
Posts: 16
Default

I got it working with help over at DP.

I had to use {$link.ID} and it worked great
Teknotant is offline  
Old 08-02-2006   #19
minute
Supporter
 
Join Date: Mar 2006
Posts: 114
Talking It's Never Too Late!!!

Quote:
Originally Posted by Perrine
Ok, I suppose my answer will come too late for minute and bobby but don't forget to add in, for example, detail.php the CHANGE_ME_FIELD with :

Code:
          $data['CHANGE_ME_FIELD'] = $rdata['CHANGE_ME_FIELD'];
around line 66
Thanks Perrine! It is working now. Funny I just came back to check the forum after a long absense and you'd answered my question.
__________________
Get your Aussie site listed at Australian Web Directory
minute is offline  
Old 08-07-2006   #20
rawaccess
 
Join Date: Aug 2005
Posts: 10
Default

i can't figure this out.
i want another URL field.
the current URL field was duplicated in mysql with a new field name (URL2)
that field shows up in EDIT and SUBMIT and the date is stored into mysql
however, i can't call that data into the link details page. i am able to dup the URL field so that it deplays twice. when i change the field value from URL to URL2 i get blank on the front end :(

why can't i call data out of mysql? i fed the data into it.. but ... can't .. get.. it... out..
rawaccess 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 01:59 PM.


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