Idea for a site, but not sure how to implement

abroms

New member
May 17, 2009
257
12
0
Hi all –

Looking for some help to get this idea I have working. So I have a big CSV of something (sorry, don't want to put niche out in public. If you are really willing to help and need to know this info, PM me). I want to make a site so that when a visitor goes to site.tld/pagegen.php, it will take information from the CSV (well, a mysql database at that point), and generate a page containing that information. I realize that's all very abstract, so here's an example.

I have the stereotypical database of golf courses. I want it so that when a visitor goes to golfcourses.tld/pagegen.php, a quiz will appear on the page, with questions like:

Do you like golf course A or golf course B more?
* Radio button for A * Radio button for B

If you had to write a description for golf course C, what would it be?
[textarea]

Does golf course D have 9 holes or 18 holes?
* Radio button for 9 * Radio button for 18

That should get the point across. So really my question is: how would I go about drawing random information from a database to form questions? And also, how could I make it so that once somebody goes to /pagegen.php, the file outputted becomes static and indexable (I assume using a write command or something...)

Thanks!
 


Pulling info from a database is easy, but then making that info into a questionnaire is really hard.

If I were you I wouldn't try and generate a questionnaire from the database, I would just write the questionnaires myself and then record the answers to a database, the answers could then easily be displayed.

I would think about other ways you can leverage your existing data from the database instead of using a questionnaire.

Rgds

Hi all –

Looking for some help to get this idea I have working. So I have a big CSV of something (sorry, don't want to put niche out in public. If you are really willing to help and need to know this info, PM me). I want to make a site so that when a visitor goes to site.tld/pagegen.php, it will take information from the CSV (well, a mysql database at that point), and generate a page containing that information. I realize that's all very abstract, so here's an example.

I have the stereotypical database of golf courses. I want it so that when a visitor goes to golfcourses.tld/pagegen.php, a quiz will appear on the page, with questions like:

Do you like golf course A or golf course B more?
* Radio button for A * Radio button for B

If you had to write a description for golf course C, what would it be?
[textarea]

Does golf course D have 9 holes or 18 holes?
* Radio button for 9 * Radio button for 18

That should get the point across. So really my question is: how would I go about drawing random information from a database to form questions? And also, how could I make it so that once somebody goes to /pagegen.php, the file outputted becomes static and indexable (I assume using a write command or something...)

Thanks!
 
Get a book on php and study up for a few days. The sitepoint book building database sites with php and mysql is pretty good for a beginner.
 
Data mining graphics sounds like something you would use Amazon Mechanical Turk for. I think the way you code this solution would be dependent upon the data in the CSV file. If you can somehow filter the data, you might be able to attach HTML input types to each field, which would be used to build a questionnaire dynamically. Sorry I don't have a better answer.
 
From your example it seems like you want to ask questions about brand names, I'm not sure if you have more data than just names in real life but for something like your example all you would have to do is build a simple quiz engine and then plug your brands/names in to it.

Make the script so that it uses a template to display the page and plugs things in like question text, answer options, etc. The script should grab that stuff from a file/db where you have defined the questions and specified whether or not they are multiple choice or whatever. So then for the golf course names have your script parse the question text and replace a variable like {COURSE_NAME} or something with a random item from your golf course names list.

So for your question definitions you would have something like:

1|I think {COURSE_NAME} is better than {COURSE_NAME}.|truefalse
2|Please give a description of {COURSE_NAME}.|freetext
3|What answer would you choose?|multchoice|answer1,answer2,answer3,answer4

I got lazy with #3 but you can see how I'm talking about laying out some options for each question and then having your script do the right thing depending on the options.

Does that sound like what you were asking about?
 
^^^ I wrote a script like that once for generating pages for every city, state and county in the US, to promote local massage schools. It worked but I ended up with too much dupe content. It could be perfected with proper spinning. And no you can't have the script.
 
+Rep to all of you (I'll hit steve and nostalgae when I can). Thanks for the ideas.

Nostalgae, your idea seems like precisely what I'm going for. I just have no idea how to implement it. I'm good with basic to intermediate level php, so if you could find time at some point to chat code with me, that would be fantastic.

Or Stevehnsn, if you happen to have some time, I'd love to chat with you too since you clearly know your stuff. I'm pretty sure I have enough unique content in the database to avoid dupe content penalties, and with a little bit of spinning, I'm sure I'd be fine.

Thanks.

From your example it seems like you want to ask questions about brand names, I'm not sure if you have more data than just names in real life but for something like your example all you would have to do is build a simple quiz engine and then plug your brands/names in to it.

Make the script so that it uses a template to display the page and plugs things in like question text, answer options, etc. The script should grab that stuff from a file/db where you have defined the questions and specified whether or not they are multiple choice or whatever. So then for the golf course names have your script parse the question text and replace a variable like {COURSE_NAME} or something with a random item from your golf course names list.

So for your question definitions you would have something like:

1|I think {COURSE_NAME} is better than {COURSE_NAME}.|truefalse
2|Please give a description of {COURSE_NAME}.|freetext
3|What answer would you choose?|multchoice|answer1,answer2,answer3,answer4

I got lazy with #3 but you can see how I'm talking about laying out some options for each question and then having your script do the right thing depending on the options.

Does that sound like what you were asking about?
 
O'Reilly php books are good if you want to learn more about php. They have a ton now, so you'd need to look for one appropriate for your current level of knowledge and what you want to learn.

Some questions to think about. How much information is in your db about each "golf course"? If it's just the name it makes it super easy. How many "golf courses" are in your database? If there are not a lot would it be easier to put them in an array? Are the questions the same for every "course" or are they different for different "courses"? It shouldn't be to hard to pull a couple random records and fill the data into a form as Nostalgae mentioned.

It looks like you want to change this
golfcourses.tld/pagegen.php

to this
golfcourses.tld/Muirfield-Village-Golf-Club

Look into Appache mod rewrite to do this.
 
Choose one column of your database to be the title. Normalize the titles so that they make pretty page names. Add a column to the golf course table which indicates its url.

Use Apache's mod_rewrite to make pretty urls.

For questions, create a new table which pairs questions with inputs.

Link the questions+inputs tables with a one-to-many connection to a table with responses.

Use meta noindex on pages that don't have content yet or will have dup content.
 
Thanks so much for all the help everyone. I'll be trying to implement this soon... Although I'm sure I'll run into difficulties.

+Rep coming to Victory and DewChugr in 24 hours.