Adding custom fields to the posting body

Looking for a MOD? Have a MOD request? Post here for help. (Note: This forum is community supported; phpBB does not have official MOD authors)
Anti-Spam Guide
Locked
bbbri
Registered User
Posts: 38
Joined: Sun Aug 22, 2010 3:05 pm

Adding custom fields to the posting body

Post by bbbri »

Hi,

I would like to add some custom fields to the posting body of my forum.
How would I go about making that work? I am looking at the posting_body template, and I can add the fields that I require, but I cannot get them to show on the forum once the topic is posted.

And just to make things a little more complicated, I only want the custom fields to be available for the first post of the thread.

Any help is always appreciated.

Thanks

User avatar
durangod
Registered User
Posts: 678
Joined: Tue Nov 03, 2009 1:26 pm

Re: Adding custom fields to the posting body

Post by durangod »

You need to define your var. Since i do not know what your doing or how your using it or to the extent im flying blind here so you might try a couple things here.

First your var in the template is called like this {MYVARNAME}

and you need to define it either in the header or in the functions file or both.

in your includes/functions.php go down toward the bottom and look for this (its a long list of common var)

// The following assigns all _common_ variables that may be used at any point in a template.

and add your var name in there using the same format.

in your php file (whatever file your using to process the output to the template - such as your posting.php sounds like thats what your using)

you need to assign the var usually somewhere at the top of the php file.

Code: Select all


//assign var to template global
                   $template->assign_var('MYVARNAME', $myvar_value);                                      

                        // Output the page
         page_header($myvar_value);

 


try a simple test, if it does not work dont go hacking the files too much, always make a copy of the original first so you can just put it back. This will give you some idea at least of how to do it.

also dont forget to clear your temp cache.

bbbri
Registered User
Posts: 38
Joined: Sun Aug 22, 2010 3:05 pm

Re: Adding custom fields to the posting body

Post by bbbri »

Hi,

Thanks for your help.
To explain things a little better, I need to add a few custom profile fields that appear to the thread creator. Fields like "Looking For" "Giving Away" etc...

I can create the "dropdown box" with these options in the posting_layout.html template, but obviously it isn't as easy as that!

So like Durangod has suggested, do I now have to somehow "tell" the viewtopic_body.html template that the modifications are there via the "var"?

I am not a coder, but I do have a little experience - I just need pointing in the right direction!

Thanks in advance for your help.

User avatar
Oyabun1
Former Team Member
Posts: 23162
Joined: Sun May 17, 2009 1:05 pm
Location: Australia
Name: Bill

Re: Adding custom fields to the posting body

Post by Oyabun1 »

bbbri wrote:Fields like "Looking For" "Giving Away" etc...
Sounds like what you are actually looking for is to add a tag to the topic titles. This MOD, Quick Title Edition, will do that. It enables you add icons or words as tags and also provides a facility to search based on the tags.
                      Support Request Template
3.0.x: Knowledge Base Styles Support MOD Requests
3.1.x: Knowledge BaseStyles SupportExtension Requests

bbbri
Registered User
Posts: 38
Joined: Sun Aug 22, 2010 3:05 pm

Re: Adding custom fields to the posting body

Post by bbbri »

Oyabun1 wrote:
bbbri wrote:Fields like "Looking For" "Giving Away" etc...
Sounds like what you are actually looking for is to add a tag to the topic titles. This MOD, Quick Title Edition, will do that. It enables you add icons or words as tags and also provides a facility to search based on the tags.
Sir, I think you have found what I am looking for! :)
I will install and see how it goes.
Thank you very much.

Locked

Return to “[3.0.x] MOD Requests”