...

View Full Version : Trying to make a "create-a-page" feature in a CMS...



r_plane
08-23-2006, 12:16 AM
Hi there, to all up to the challenge:

I have created my own little CMS in PHP. But there is one feature I really want to add.

First off, I have it set up so that the client can log in, select a page from a list, and edit, and delete the entry.

What I want to do is have a feature where a client can type in the name of a page into an form input box and when they hit create, it will create a new page. Essentially I want them to be able to enter the name, submit, and have a new table made in a mySQL database. But I have no idea where to start, I cant find any documentation on the net, mainly because I dont know where what to look for.

If anybody has any assistance for me it would be greatly appreciated!

Mwnciau
08-23-2006, 12:24 AM
lookup the fwrite (http://uk2.php.net/manual/en/function.fwrite.php) and fopen (http://uk2.php.net/manual/en/function.fopen.php) file functions.

eg.


if (!file_exists($_GET[url] . '.php')){
$file = fopen($_GET[url] . '.php', 'w');
fwrite($file, 'Hello world!');

musher
08-23-2006, 03:41 AM
r_plane
quick question are you creating a new table for each page or a new record in a table for each page?

timgolding
08-23-2006, 12:33 PM
r_plane
quick question are you creating a new table for each page or a new record in a table for each page?

If i were you I would suggest not stroring the page data in an sql, just use the fwrite function to create it. then only use a database to store the URL for use by and nav menus you may have.

musher
08-23-2006, 04:11 PM
If i were you I would suggest not stroring the page data in an sql, just use the fwrite function to create it. then only use a database to store the URL for use by and nav menus you may have.

timgolding/Mwnciau quick question guys, why not store page content in MySQL? I've been doing that for awhile now is there an advantage to storing it in a flat/txt file or dis-advantage to writing content to MySQL?

r_plane
08-23-2006, 09:57 PM
Ive found it easiest to make separate tables, but maybe because I dont entirely know how to do it any other way. If there are any good tut's on the net for this kind of stuff, I would love to take a look at them. Anybody know where to find an online source for all of this stuff?

Thanks for everybodies input thus far. Its been muchos appreciated.

timgolding
09-13-2006, 03:00 PM
timgolding/Mwnciau quick question guys, why not store page content in MySQL? I've been doing that for awhile now is there an advantage to storing it in a flat/txt file or dis-advantage to writing content to MySQL?

A web page should be stored as a web page. There is an advantage in executing it as you can include serverside scripts in the file. These codes could not easily be executed using echo commands.

Also I generally only use SQL for data that requires fast access for multiple user across multiple records. In the case of a single web page i think the text file option is more feasable

Having said that you could do it using SQL



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum