Adding a new field

Register an Account
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 09-13-2008, 01:48 PM
New Pligger
 
Join Date: Sep 2008
Posts: 5
Send a message via AIM to Snizneth
Hello all and thanks for any help or guidance.

I am wanting to add a new field when submitting a story, namely an "author" field.

a lil background: I'm wanting to track quotes that people have made, and would like to have it when you submit a story you can enter the authors name in a separate field and have it displayed either below or next to the story title and link. above and beyond what would ideal would also be an autofill field, so if that name has been entered before it would come up to avoid mispellings and differences with the persons title. (i.e. don't want a 3 different sections for Mr. Bill Clinton, Senator Bill Clinton, Bill Clinton, or President Bill Clinton) if that makes sense.

Thank you all very much.

-Seth
Reply With Quote
  #2 (permalink)  
Old 09-13-2008, 03:48 PM
redwine's Avatar
Pligg Donor
Pligg Version: 9.8
Pligg Template: custom templat
 
Join Date: Jul 2007
Location: Canada
Posts: 216
You can use the "Extra fields" that comes with Pligg.
First, you have to enable extrafields from the admin panel:
In admin panel, click on "Configure yoursite"
click on ExtraFields
Change the value "false" to true

Code:
Enable extra fields
description: Enable or disable extra fields when submittng stories.
value: true
default value: false
expected values: true / false
Open /libs/extra_fields.php and change the code as follows
Let's say you want a field for "Quotes" and another for the author

Code:
define('Enable_Extra_Field_1', true);
 define('Field_1_Title', 'Quote');
 define('Field_1_Instructions', '');
 define('Field_1_Searchable', false);
 //the variables below are not yet used in version 6.02.
 define('Field_1_Required', false);
 define('Field_1_Validation_Method', '');
 define('Field_1_Validation_Error_Message', '');
 
define('Enable_Extra_Field_2', true);
 define('Field_2_Title', 'Author');
 define('Field_2_Instructions', 'Enter the quote\'s author name');
 define('Field_2_Searchable', false);
 //the variables below are not yet used in version 6.02.
 define('Field_2_Required', false);
 define('Field_2_Validation_Method', '');
 define('Field_2_Validation_Error_Message', '');
If you want to change where the extra fields display on the page, just do the following:
open /templates/yourtemplate/submit_step_2.tpl
move the below code to wherever you want the extra fields to display.

Code:
{checkActionsTpl location="submit_step_2_pre_extrafields"}
{include file=$tpl_extra_fields.".tpl"}<br />
If you want to change the where they appear in the story display, open /templates/yourtemplate/link_summary.tpl and change whatever in the block of code of the extra fields.
Reply With Quote
  #3 (permalink)  
Old 09-13-2008, 06:48 PM
New Pligger
 
Join Date: Sep 2008
Posts: 5
Send a message via AIM to Snizneth
Has anyone told you that you rock today? Just incase, YOU ROCK. Thanks so much. I really appreciate you spreadin the knowledge.

Thanks again.

Seth
Reply With Quote
  #4 (permalink)  
Old 09-13-2008, 07:29 PM
New Pligger
 
Join Date: Sep 2008
Posts: 5
Send a message via AIM to Snizneth
Quote:
Originally Posted by redwine View Post

Code:
{checkActionsTpl location="submit_step_2_pre_extrafields"}
{include file=$tpl_extra_fields.".tpl"}<br />
I did the other changes, but when i drop in the code above, the only changes are the html <br />, it doesn't add the field. Do i need to parse it within something else?

UPDATE: Figured it out, thanks again.

Last edited by Snizneth; 09-13-2008 at 07:35 PM. Reason: update
Reply With Quote
  #5 (permalink)  
Old 09-14-2008, 02:28 AM
New Pligger
 
Join Date: Sep 2008
Posts: 5
Send a message via AIM to Snizneth
Quote:
Originally Posted by redwine View Post
If you want to change the where they appear in the story display, open /templates/yourtemplate/link_summary.tpl and change whatever in the block of code of the extra fields.
I've been messing around with link_summary.tpl and I can't figure out how to link the 'author" extra field. Any help?

Thanks
Reply With Quote
  #6 (permalink)  
Old 09-14-2008, 03:17 AM
redwine's Avatar
Pligg Donor
Pligg Version: 9.8
Pligg Template: custom templat
 
Join Date: Jul 2007
Location: Canada
Posts: 216
Quote:
Originally Posted by Snizneth View Post
I've been messing around with link_summary.tpl and I can't figure out how to link the 'author" extra field. Any help?

Thanks
This is the block of code in link_summary.tpl that displays all the extra fieldsin the story:

Code:
{if $Enable_Extra_Field_1 eq 1}{if $link_field1 neq ""}<br/><b>{$Field_1_Title}:</b> {$link_field1}{/if}{/if}
     {if $Enable_Extra_Field_2 eq 1}{if $link_field2 neq ""}<br/><b>{$Field_2_Title}:</b> {$link_field2}{/if}{/if}
     {if $Enable_Extra_Field_3 eq 1}{if $link_field3 neq ""}<br/><b>{$Field_3_Title}:</b> {$link_field3}{/if}{/if}
     {if $Enable_Extra_Field_4 eq 1}{if $link_field4 neq ""}<br/><b>{$Field_4_Title}:</b> {$link_field4}{/if}{/if}
     {if $Enable_Extra_Field_5 eq 1}{if $link_field5 neq ""}<br/><b>{$Field_5_Title}:</b> {$link_field5}{/if}{/if}
     {if $Enable_Extra_Field_6 eq 1}{if $link_field6 neq ""}<br/><b>{$Field_6_Title}:</b> {$link_field6}{/if}{/if}
     {if $Enable_Extra_Field_7 eq 1}{if $link_field7 neq ""}<br/><b>{$Field_7_Title}:</b> {$link_field7}{/if}{/if}
     {if $Enable_Extra_Field_8 eq 1}{if $link_field8 neq ""}<br/><b>{$Field_8_Title}:</b> {$link_field8}{/if}{/if}
     {if $Enable_Extra_Field_9 eq 1}{if $link_field9 neq ""}<br/><b>{$Field_9_Title}:</b> {$link_field9}{/if}{/if}
     {if $Enable_Extra_Field_10 eq 1}{if $link_field10 neq ""}<br/><b>{$Field_10_Title}:</b> {$link_field10}{/if}{/if}
     {if $Enable_Extra_Field_11 eq 1}{if $link_field11 neq ""}<br/><b>{$Field_11_Title}:</b> {$link_field11}{/if}{/if}
     {if $Enable_Extra_Field_12 eq 1}{if $link_field12 neq ""}<br/><b>{$Field_12_Title}:</b> {$link_field12}{/if}{/if}
     {if $Enable_Extra_Field_13 eq 1}{if $link_field13 neq ""}<br/><b>{$Field_13_Title}:</b> {$link_field13}{/if}{/if}
     {if $Enable_Extra_Field_14 eq 1}{if $link_field14 neq ""}<br/><b>{$Field_14_Title}:</b> {$link_field14}{/if}{/if}
     {if $Enable_Extra_Field_15 eq 1}{if $link_field15 neq ""}<br/><b>{$Field_15_Title}:</b> {$link_field15}{/if}{/if}
Every extra field that you enabled as explained in my steps, should appear in the story paragraph without you doing anything.

Note that the extra field will only show if it is populated and not empty.
Reply With Quote
  #7 (permalink)  
Old 09-25-2008, 09:22 PM
New Pligger
 
Join Date: Sep 2008
Posts: 11
Quote:
Originally Posted by Snizneth View Post
I did the other changes, but when i drop in the code above, the only changes are the html <br />, it doesn't add the field. Do i need to parse it within something else?

UPDATE: Figured it out, thanks again.
Hi, I got the same problem - the extra field does not appear in Step 2 of Submit although I have made the changes above. Any idea where I could have gone wrong? Thanks.
Reply With Quote
  #8 (permalink)  
Old 09-25-2008, 11:21 PM
New Pligger
 
Join Date: Sep 2008
Posts: 11
Quote:
Originally Posted by bijiny View Post
Hi, I got the same problem - the extra field does not appear in Step 2 of Submit although I have made the changes above. Any idea where I could have gone wrong? Thanks.
Problem solved thanks.
Reply With Quote
  #9 (permalink)  
Old 10-01-2008, 10:22 AM
New Pligger
 
Join Date: Sep 2008
Posts: 5
Hi all,
I had a similar requirements and followed as per your guidelines. It worked. Thanks.

But I would like to have a text area input rather than a single line text entry. How do I change this.

Also I expect the user to enter large volume of text into this new extra_field.
From the database structure, I see that link_field1 is a varchar(255).
How do I make it accept large volume of text?
Reply With Quote
  #10 (permalink)  
Old 10-01-2008, 01:21 PM
Webmastercoders's Avatar
Casual Pligger
Pligg Version: 9.9.5
Pligg Template: yget
 
Join Date: Sep 2008
Posts: 36
Quote:
Originally Posted by betatester View Post
Hi all,
I had a similar requirements and followed as per your guidelines. It worked. Thanks.

But I would like to have a text area input rather than a single line text entry. How do I change this.

Also I expect the user to enter large volume of text into this new extra_field.
From the database structure, I see that link_field1 is a varchar(255).
How do I make it accept large volume of text?
Hi, I'll help ya.
Let's Assume you have used Field 2 : /libs/extra_fields.php
------
define('Enable_Extra_Field_2', true);
define('Field_2_Title', 'Textarea Input');
define('Field_2_Instructions', 'Testing Textarea.');
------
Then in /templates/your template/submit_extra_fields.tpl

{if $Enable_Extra_Field_2 eq 1}
<p><label>{$Field_2_Title}:</label>{$Field_2_Instructions}<br />
<input type="text" name="link_field2" id="link_field2" value="{$submit_link_field2}" size="60"/>
</p>

Change to :

{if $Enable_Extra_Field_2 eq 1}
<p><label>{$Field_2_Title}:</label>{$Field_2_Instructions}<br />
<textarea type="text" name="link_field2" id="link_field2" value="{$submit_link_field2}" rows="10" col="60"/></textarea><br />
</p>

------

In /templates/your template/link_summary.tpl for "example"
Find the Line :
{if $Enable_Extra_Field_2 eq 1}{if $link_field2 neq ""}<br/><b>{$Field_2_Title}:</b> {$link_field2}{/if}

And place it where you want to display the data.. I just tested to make sure. This will work for you.. Just edit the rows="10" col="60" to your increase your textarea size.

Last edited by Webmastercoders; 10-01-2008 at 01:31 PM.
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Need to add 1 more extra field to the submit page - step2 aaronpais Questions and Comments 3 04-10-2008 03:37 PM
Adding Drop-Down Extra Field? eH9116 Questions and Comments 13 12-30-2007 04:49 AM
rss_importer adding multiple titles and urls olivert Questions and Comments 1 07-17-2007 05:03 PM
adding extra field guile82 Questions and Comments 3 06-18-2007 05:18 PM
Adding field to add URL for post images in the Submit section plushpod Questions and Comments 2 12-08-2006 03:47 PM


Pligg Modules and Pligg Templates from Pligg Pro Find support on the Pligg CMS Forum - 24 hours a day! Make a donation to support Pligg CMS development