you could use a template system to store all the HTML then write the templates with PHP. The advantage of this is you can have dynamic data in different parts of the templates…
You can store all the webpages in different files. Then code a file that would create new pages or edit existing pages. ( easily done usign file handling functions. ). files_get_contents the files and put them into a input field to edit them.
Saving them into a database would be franking saying, a waste of time. Your webpages are so large, you could do better saving them in flatfiles.
The advantage would be that you can edit your files without using ftp…
Thank you! I guess it’s no no!!! Ok another stupid question,…besides being able to make a connection to a mysql database which i have done is there a way to creat tables using dreamwaver mx2004?? or this should only be done with applications like ems mysql manager, phpmyadmin, or just plain dos CLI???
Avoid stuffing your database full of html code. Use the database to store a link to an external file. PHP has plenty of functions to allow the reading and writing of any sort of document so you can still make the changes you need to on the fly with a bit of creative programming. Your database will thank you.
I agree, if you are going to use a database at all use it for storing the links the external files.
Here is a script i wrote up for editing a .txt file with PHP, they might be usefull for you…
I disagree with the last option and code. if u want to edit files… better to use some kind of interface that edits and updates the database. instead of using textfiles or whatever.
Unless ure not so familiar with using db.s that r / w files might be an easyser option but never is the better option.
It’s a bad design if you need to start sticking html pages into the database. Good design principles and common sense should tell you to keep as little html information in the database as possible. I think you might be confusing what he is asking. Never stick an entire html page in a database unless you have to… it’s wasteful and will slow down the database retrieval times.
Rehashing on the template thing again: depending on what you need to do with the site you can store text etc in the database and use PHP to retrieve the information and populate a html template with the dynamic content (like the way vBulletin operates).
Reading and writing files is a better option than putting the whole page in the database… not better than populating a html template with database information.
Hey thank alot you guys! this is excellent info!! and thanks for the file read and write code…i’m going to take a closer look at how i could use that, since im going to want to make my Intranet (@ Work) dynamic, the whole thing that im trying to achive is, i have a Intranet site at work, that i maintain and create content for, but now it’s become BIG! with a few hundred documents, photos, news articles, archives of news articles, and it’s becomeing more and more difficult to maintain, so i want to take a big step into moving some of the content into a database, say pics, articles in docs and pdf’s…and add scripts to the sections of our site, that would retrive the selected file from a database upon loading…i think that’s dynamic??? I would appriciate some help or any suggestion at all, as to how i could go about make the site more managable??
Are you saying you want the user to be able to download different files depending on what they want?
Well for that you would want to use a MYsql database,
just have all the files in a database in different rows,
then just a query string on the end of the .php page and depending on what the query string value is you can have code that will retrieve the correct path to the file off the database so the person can view/download the file.
If you dont know a querystring is a variable attached to the end of the URL, like this:
somepage.php**?file=somerownumber**
you can then retrive that varibal in the php code by doing:
$querystring = $_REQUEST[“file”];
Content management systems are difficult to create so it’s probably just best to ask the questions as they come up. With a large scale site you’ll need to invest some time learning a template system (phplib’s template class is what I use, but smarty templates and fast template are apparently very good). It’ll save you alot of time down the track.
Another suggestion is to build all common site functions into classes (eg. file uploads, image manip, pagination). Also, put all your common variables and settings into 1 file so you can easily make global changes. I use an *.ini file and php’s parse_ini_file() function to retrieve variables.
mmm… might be best to learn the basics first then. Learn classes, functions and study up on php’s inbuilt functions. Once you’ve got a fair idea on how php works the rest kind of falls into place.