Forum Moderators: coopster
jst wondering if anyone knows of any tutorials that will show the design and impl. of a simple cms. im thinking of making my own and tough i might get some ideas from such a tutorial or example.
basically i have a site with following section
articles,
photos,
web dev articles etc.,
cd reviews,
receipes,
links in categories,
what would be the best way to apprach this. mostly everything will be article based i think. photo album will have a seperate script to load and display. all i need to do is upload the pics.
just looking for sugesstions really...
i think it will be some sort of a system that is based on text files for content nad include to put it all together,
would that make some sense?
sorry if this all sounds too basic, :)
kumar
I sometimes use the filesystem for sort of a 'mock up' cms to later design the real, database-backend version, so I have time to think out and change around the general datastructure, and then make the db layout the most efficient possible. But I'd guess you'll want to use a db later.
Make sure you have a very, very good working knowledge of doing stuff with arrays. Your front page can have a script that does opendir() and readdir() on a general content directory, which reads a list of directies in this directory and outputs links to this same page, but with the directory name in the parameter, and a parameter serving as a function name, like 'category'. Here you have all your categories of content like recipies and cd reviews.
Use if() to check in this main page (your index.php) if $_GET['func'] == 'category'. If not, it does the above; if yes, it takes the directory given in $_GET['name'] and, after some security checking (use preg_match, make sure it, e.g., only contains chars [a-z] to prevent directory traversal), does pretty much the same as described above, except for reading this directory in $_GET['name'] instead of the general content directory. And here you have the list of all your articles.
And if the $_GET['func'] == 'content', you use file_get_contents() to get the contents of $_GET['name'] and output it.
All of this is enclosed in echo statements outputting your header and footer.
When you get to this stage, you might want to make a sidebar which always displays the menu which is made by the index page when $_GET['func'] isn't set to anything it recognizes - you know, the links based on the contents of the main content directory. And then you'll want to get fancier, and use the database solution. You'll want custom modules and stuff. Time to check out hotscripts for rather simple CMS's then.
I've wanted for a long time to know which CMS is probably best for the php-newbie to learn about writing PHP, and CMS architecture. The old-PHP-nuke style drop-in module system has proven really popular, even though it's generated such bad PR. Not, though, a bad way of learning where to put different pieces of your code, even if it's a pretty bad source for good php syntax and other aspects of php style.
What the PHP-nuke style won't teach you is good methods of object-oriented coding for making a 'drop-in' sort of module structure, I'd be interested in hearing recommendations.
thanks for the long reply, it has made me understand the basics more. im not sure where the site would be going in the future and how fast but ideally it would grow of course. but this is a persoanll site and i doubt it would grow too big without changing the focus of the site. anyways, lets see if i do get you right:
i have a index page, everything is sorted in folders and subfolders as a mock up db, i use php to read folders and content and display the page and links based on those results.
it sounds like u have some experience so one more q:
for now at least, i want to keep the articles in txt files. how would i make this work. i mean i would have to use html markup in the text to deal with the styling. is there any other way of dealing wiht this? is DOM and xml somethings to consider?
again thanks for the reply
kumar
Have fun with your home-baked css!