creating new pages

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Mad0Driver
Forum Newbie
Posts: 10
Joined: Tue Jan 30, 2007 4:00 pm

creating new pages

Post by Mad0Driver »

Hey everyone, i want to set up a "program" that can set up multiple pages for me. Basically for my page i need to have "tests". They are simple enough to create, but if i need to set up multiple "tests" it could take undue amounts of time. So what i want is two have a page that asks certain questions, and those questions will be posted in a certain order on a new page. But i need the program to set a new page on my website, so it actually adds pages to my directory as if i had used my WYSIWYG editor. Any ideas?

Thanks
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Code generation can be a bad smell.. but it's your project. :)

fopen() + fwrite() + fclose(), file_put_contents() may all be of use/interest.
Mad0Driver
Forum Newbie
Posts: 10
Joined: Tue Jan 30, 2007 4:00 pm

Post by Mad0Driver »

What do you mean can be a bad smell? IT doesnt always work?

And whis will only work if i create a blank page on my site, right?

Thanks
User avatar
shiznatix
DevNet Master
Posts: 2745
Joined: Tue Dec 28, 2004 5:57 pm
Location: Tallinn, Estonia
Contact:

Post by shiznatix »

basically what you are going to do it auto-generate php code, then write that code (which is actually a string) to a file. This can get really hairy because you are auto-generating code and things can go wrong really fast.

Just have the code of the test page in a string, create a file with fopen() then write the string to the file and there you go!
nwp
Forum Contributor
Posts: 105
Joined: Sun Feb 04, 2007 12:25 pm

Post by nwp »

If There is an error in your php codes and you didn't looked at it while testing
all ther visitors will face that particullar error in a Chain
and then you need to recreate all the wrong pages
so i think its a very bad idea
-----------------------------------------------------------------------
But if you think to generate the page in the fly and then delete it after compiling
then its a matter with lower risk than it was of before
but in this casa don't forget to use a .htaccess in it to make the Access Denied(Deny from All)
Post Reply