View Full Version : Where is data inserted into table?
mgiroir
06-27-2005, 07:00 PM
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.
David
06-27-2005, 07:35 PM
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
mgiroir
06-27-2005, 09:56 PM
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>
David
06-27-2005, 10:08 PM
I really appreciate you taking the time to post this. It will be a good reference.
Thanks,
David
richm
11-04-2005, 10:36 AM
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)
Tim_Myth
11-04-2005, 01:30 PM
That is some excellent info! If there were a rep system on this board, I'd give you some. :)
Hardy
01-04-2006, 03:20 AM
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
BoInG
02-08-2006, 01:36 PM
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?
Mortenh
03-05-2006, 06:12 PM
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?
bobby9101
03-29-2006, 01:20 AM
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?
minute
04-23-2006, 07:55 AM
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.
Perrine
07-16-2006, 05:40 PM
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 :
Content visible to registered users only.
around line 66
discover
07-16-2006, 09:07 PM
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
Perrine
07-16-2006, 09:12 PM
In detail.php, you should add this
Content visible to registered users only.
just after this (line 66)
Content visible to registered users only.
and in detail.tpl, this
Content visible to registered users only.
Hope this works ;)
discover
07-16-2006, 09:19 PM
thanks man worked perfectly
appreciate it
al
Perrine
07-16-2006, 10:36 PM
you're welcome :)
Teknotant
07-18-2006, 04:45 AM
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
07-19-2006, 09:43 PM
I got it working with help over at DP.
I had to use {$link.ID} and it worked great
minute
08-02-2006, 01:06 PM
Content visible to registered users only.
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.
rawaccess
08-07-2006, 07:08 AM
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..
jeeplaw
08-17-2006, 04:45 AM
Likewise, i'm having the same issues. Data is in, can't display it!
Pidea
08-17-2006, 10:21 PM
Content visible to registered users only.
I'm trying to add in some fields too (specifically a TEXT field and a ENUM field). What's the shorthand equivalent of those ? I can't seem to find a full list anywhere.
PortProphecy
10-25-2006, 02:54 AM
Content visible to registered users only.
Ok, can someone help a mySQL noob. Got all the files edited, but the database has me confused. What is the proper SQL query to add the CHANGE_ME_FIELD into the PHP_LINK table? Thanks for any help!
:)
shotoshi
06-11-2007, 08:15 PM
It would neat if you could add the custom fields from the admin area, like the cms Expression Engine allows.
In addition, via the admin, you could state which type of fields they should be such as text input, radio buttons, check boxes, drop down lists - and nominate values for the fields where necessary i.e. drop down lists etc.
vBulletin® v3.8.0, Copyright ©2000-2012, Jelsoft Enterprises Ltd.