Jump to content

Simple CMS...the first step takening (cross-posted from the design subforum)


KevinM1

Recommended Posts

I decided to cross-post my original message from the design forum to here in the hopes of getting as much input as possible.  I hope this is okay.  Original message is below.

 

-----------------------------------------------------------

 

This will be my first attempt at using OOP to make a fully functional, real project.  The law firm at which my brother works wants their site redone, and he suggested me.  Unfortunately, most of my PHP experience is in the form of writing code that modifies/improves existing systems.  I've never created one from scratch before.

 

The firm's site already has a simple CMS.  One that allows one of the secretaries to add a new lawyer bio and/or text for other pages, but not the ability to add items to the navigation menu or change any of the existing main graphics.  I believe, however, that they can add images to the pages (such as a new laywer's photo).

 

There doesn't appear to be too much in the way of database info.  Most of the pages on the current site appear to be static, from what I can see.  With the exception of the admin area - which is where the secretary goes to add/modify pages on the site - there's no membership to speak of.

 

I'm thinking, for the public side of the site, to use a Front Controller.  Would I need anything else?  In particular, are there any other patterns I should think of (Registry, Command, etc)?

 

The admin backend seems a bit more tricky.  Obviously, there needs to be a simple login system, but I'm having trouble trying to see how to handle both the creation of new pages, and the editing of existing pages.  In particular, how would I handle the text input?  Simple textarea field?  Embedded TinyMCE editor?  Something else?  What about a file naming scheme?  Should I just use a numeric id (probably the easiest in terms of mapping the files to the database)?  Something more user friendly?  This is the part that will trip me up the most, so any input here would be greatly appreciated.

Link to comment
Share on other sites

If you want to make your own, I recommend learning Zend Framework. It takes a little getting used but its well worth the slog and once you get the basis of your application laid out the actually application is very easy to develop. Go to: http://framework.zend.com. It fully OOP and uses MVC.

 

If you want to use an existing one, I would recommend CMS Made Simple over other CMSs. I have had experience with drupal and it just doesn't seem as friendly.

 

If none of the above options above take your fancy, I would also recommend this read: http://www.phpit.net/article/simple-mvc-php5/

 

Cheers,

Cobby

Link to comment
Share on other sites

Not using, say, Drupal for what reason?

 

Because I don't know what Drupal is? :P

 

In any event, I'm trying to roll my own, so to speak.

 

If you want to make your own, I recommend learning Zend Framework. It takes a little getting used but its well worth the slog and once you get the basis of your application laid out the actually application is very easy to develop. Go to: http://framework.zend.com. It fully OOP and uses MVC.

 

If you want to use an existing one, I would recommend CMS Made Simple over other CMSs. I have had experience with drupal and it just doesn't seem as friendly.

 

If none of the above options above take your fancy, I would also recommend this read: http://www.phpit.net/article/simple-mvc-php5/

 

Cheers,

Cobby

 

Thanks for the link to the phpit article.  There's one thing, though: like I asked in my first post, how would I handle the creation/editing of new pages?  The rest all seems more or less what I expected, especially after doing a quick browse through the Code Igniter framework, but allowing a user to create new content still eludes me, especially when trying to figure out how to handle any images that may be added/removed (number of images allowed and their positioning) and trying to come up with a decent file naming scheme for these user-created pages.

Link to comment
Share on other sites

I understand the programmer in you wants to 'roll their own.' It's perfectly natural. In fact, I don't think you'll have a problem making your own and meeting the firms expectations.

 

The problem becomes when their expectations change, bugs are found, security issues found, etc.

 

Basically, what I am saying is, it will take a lot longer to get your own (production ready) CMS up and running than it would to take an existing CMS that is quite extensible, learning the details of writing plug-ins, and filling in the gaps (if any.) I have a lot of experience with drupal (http://www.drupal.org) You should also look in to CMS made simple mentioned by Cobby (http://www.cmsmadesimple.org/)

 

Just my 0.02

 

Link to comment
Share on other sites

Thanks for the link to the phpit article.  There's one thing, though: like I asked in my first post, how would I handle the creation/editing of new pages?  The rest all seems more or less what I expected, especially after doing a quick browse through the Code Igniter framework, but allowing a user to create new content still eludes me, especially when trying to figure out how to handle any images that may be added/removed (number of images allowed and their positioning) and trying to come up with a decent file naming scheme for these user-created pages.

 

Since your so focused on making your own, which is good fun :), I highly recommend Zend Framework. Zend Framework is quite easy, but its just there is soo much to learn. I would allow two weeks to learn it thoroughly. With Zend you will find several video tutorials on creating bootstrap, etc (just google) and make sure you look deeply at:

  • Zend_Controller
  • Modular Directory Structure
  • Zend_Loader
  • Zend_Zb
  • Zend_Config / Zend_Log
  • Zend_Auth / Zend_Layout
  • Zend_View / Zend_Layout
  • Zend_Form
  • Integrating Smarty

 

For modular directory structure, see here: http://framework.zend.com/manual/en/zend.controller.modular.html#zend.controller.modular.directories

 

That's the bulk of the essential modules when developing a CMS. More info at http://framework.zend.com/manual/en/

 

In any case, actual page content should be stored in a database. Create a regex route that routes all requests ending in .html to your content controller. Then your content controller would retrieve the specified page (from the request) from the database, then render it in the content section of your template/layout. Editing would be a similar process, except a different url to route (like /admin/page/:pid) and have a little editor (either TinyMCE or FCKEditor) and when the form is submitted just update the record in the DB.

 

Again, learn Zend Framework, especially if you will be creating other applications down the track.

 

 

Cobby.

Link to comment
Share on other sites

Thanks for the replies, both of you.  I think the first step should be me trying my hand at some simple homegrown stuff.  Trying to get a Registry to work, trying to get a Front Controller to work, that sort of thing.  Then, off to a framework once I figure out how things should be put together.

Link to comment
Share on other sites

A registry class isn't too difficult, look into the __set() and __get() magic methods and also have a look at implementing ArrayAccess. Another thing you might want to look is a class that handles global variables, namely the session.

Link to comment
Share on other sites

I think the first step should be me trying my hand at some simple homegrown stuff.  ... once I figure out how things should be put together.

 

At first, think over code flow - see http://codeigniter.com/user_guide/overview/appflow.html or other such diagrams. All begins with HTTP request, with URL - you must choose schema for it.

 

I recommend to start with very small front controller, something as:

 

initial_config();
if ($_POST) {
    // process form and redirect
} else {
   // analyze URL, determine action and other parameters
}

 

 

Link to comment
Share on other sites

Hey, I just wanted to say thanks for linking me to that flow diagram.  It's nice seeing the main participants in action.  I actually have CodeIgniter 1.6.1, as a sort of study aid, but I hate the way their documentation works.

 

The big thing, now, is to try to copy/steal (mwahaha) their segmented URL scheme.  I like that infinitely better than the standard get links.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.