Additional Criteria when submitting question

In this board you can talk about general questions about phpMyFAQ

Moderator: Thorsten

Post Reply
GoleyC
Posts: 4
Joined: Thu Feb 23, 2006 6:26 pm

Additional Criteria when submitting question

Post by GoleyC »

How hard would it be to add additional fields when one needs to submit a questions for our FAQ?

We would like to have additional fields for the following along with the usual category, name, email..etc.

Make:
Model:
Year:
Engine Size:
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

to do this you have two options:

- an easy hack that writes all the additional stuf into the main content table without any new columns in the database.

- a big hack with new columns in the database.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
GoleyC
Posts: 4
Joined: Thu Feb 23, 2006 6:26 pm

Post by GoleyC »

Thorsten wrote:Hi,

to do this you have two options:

- an easy hack that writes all the additional stuf into the main content table without any new columns in the database.

- a big hack with new columns in the database.

bye
Thorsten
We'd perfer the easy route, as then, when an upgrade comes out, the DB hasn't been touched and just the files will need modded again. Much easier route.

This would be nice to have an admin feature, where one can add additional criteria fields on the form for that extra details.
GoleyC
Posts: 4
Joined: Thu Feb 23, 2006 6:26 pm

Post by GoleyC »

Forgot to add, how do we do that?
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

you can hack that into add.php.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
GoleyC
Posts: 4
Joined: Thu Feb 23, 2006 6:26 pm

Post by GoleyC »

Would that be in this area?

Code: Select all

$tpl->processTemplate ("writeContent", array(
	"msgNewContentHeader" => $PMF_LANG["msgNewContentHeader"],
	"msgNewContentAddon" => $PMF_LANG["msgNewContentAddon"],
	"writeSendAdress" => $_SERVER["PHP_SELF"]."?".$sids."action=save",
	"defaultContentMail" => getEmailAddress(),
	"defaultContentName" => getFullUserName(),
	"msgNewContentName" => $PMF_LANG["msgNewContentName"],
	"msgNewContentMail" => $PMF_LANG["msgNewContentMail"],
	"msgNewContentCategory" => $PMF_LANG["msgNewContentCategory"],
	"printCategoryOptions" => $tree->printCategoryOptions($category),
	"msgNewContentTheme" => $PMF_LANG["msgNewContentTheme"],
	"readonly" => $readonly,
	"printQuestion" => $question,
	"msgNewContentArticle" => $PMF_LANG["msgNewContentArticle"],
	"msgNewContentKeywords" => $PMF_LANG["msgNewContentKeywords"],
	"msgNewContentLink" => $PMF_LANG["msgNewContentLink"],
	"copyright_eintrag" => unhtmlentities($PMF_CONF["copyright_eintrag"]),
	"msgNewContentSubmit" => $PMF_LANG["msgNewContentSubmit"],
	));
$tpl->includeTemplate("writeContent", "index");
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

sorry, it's in the file save.php. Sorry for that!

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa »

Sorry for being a newbie, but can you tell me which line I should change on save.php so that I can add additional fields to the Ask Question page? Many thanks for any help.
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi Vanessa,

you have to change various lines of code...

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa »

Sorry, I understand that this is a troublesome hack but any nudge in the right direction would be much appreciated (and I'll come back to post the solution so that other people can use it as well) -

If I want people to enter their country (for example) under name and email when asking a question, I understand that I would have to edit:

language_en.php

Code: Select all

// ask Question
...
$PMF_LANG["msgCountry"] = "Your country:";
ask.php

Code: Select all

$tpl->processTemplate('writeContent', array(
...
'msgCountry' => $PMF_LANG['msgCountry'],
ask.tpl

Code: Select all

    <label for="country" class="left">{msgCountry}</label>
    <input class="inputfield" type="text" name="division" id="country" size="50" /><br />
What should I edit if I want to this information to automatically appear into the content box whenever someone goes to the "Open Questions" page or the admin goes to "Edit Open Questions"? (Which I'm assuming is what Thorsten means is the "easy hack that writes stuff into the main content table".) It would be good if some extra HTML is added to say "This question was asked by <INSERT USERNAME> from <INSERT COUNTRY>" and the admin can choose whether they want to include it in the answer, when they answer the question.

I've been staring at save.php and savequestion.php for the past 8 hours - any help would be great!
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

which version do you use?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa »

Hi Thorsten, I'm using version 1.6.1.
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

okay.... and where should the country appear?

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Vanessa
Posts: 9
Joined: Mon Apr 18, 2005 4:54 am

Post by Vanessa »

If it's possible, I'd want it to appear as part of the answer - for example, to say "This question was asked by [AUTHOR] from [COUNTRY]" at the beginning of the answer to each question. Is this what you mean by the "easy hack that writes all the additional stuff into the main content table without any new columns in the database"?
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

I would add this sentence in the user name column, if that's okay for you.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
Post Reply