SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard
    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    1,285
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Building an OOP CMS

    Hi,

    I'm getting bored with building the same(ish) CMS' and Web Sites with normal PHP for different clients, and fancied getting my hands dirty with OOP.
    The development time is fairly small right now for my sites/CMS but I just find it tedious and not learning much, just re-using old code(and not very efficient either).

    Can anyone point me in the right direction/tutorial to develop my own CMS with PHP OOP. I'd basically love to build(or just have) a system that allows an Admin to login and add/edit/delete Articles.

    It would be useful if a very simple CMS was ready and I could extend it.


    Many thanks for any tips, really appreciate the help.

  2. #2
    SitePoint Enthusiast
    Join Date
    Feb 2006
    Location
    Bel Air, Maryland.
    Posts
    60
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I started on mine awhile back after reading this great article on PHP & XML CMS. I wouldn't exactly call this OOP though, but i don't think that is necessary unless you're planning on a large application (in that case look into using one that is open source and already been developed) or your goal is to learn OOP.

    Eventually I stripped the xml portion out and now just use the CMS to load the small php pages of content for editing. I've added the capability to upload files and edit meta data for their site also. I'm still working on a nice WYSIWYG editor, like FCKeditor, to eliminate the need for using html.
    ---
    Paul S. Smith
    technetic | design & code

  3. #3
    Spirit Coder allspiritseve's Avatar
    Join Date
    Dec 2002
    Location
    Ann Arbor, MI (USA)
    Posts
    648
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It sounds like you already have some features implemented in a procedural codebase-- I would recommend starting from there and refactoring where you see OOP benefitting you. A good place to start might be to create a data access object to handle persistence of your articles. Try searching here or googling active record, table data gateway, or data mapper. If you gather together all of your SQL statements that work with articles, try and find good method names that capture what it is you're doing with the db.

    Are you updating an article?
    PHP Code:
    $dao->update ($article). 
    Are you inserting an article?
    PHP Code:
    $dao->insert ($article). 
    Are you finding an article by it's id?
    PHP Code:
    $dao->getById ($id
    ...you get the idea. Maybe that will help you get started.

  4. #4
    SitePoint Wizard
    Join Date
    Mar 2008
    Location
    United Kingdom
    Posts
    1,285
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Many thanks for the replies. My friend is a total guru with PHP and built me a CMS with OOP back in 2004 when I was just learning basic PHP.
    I just fancy improving my programming skills and efficiency. I'm about to post some code on another board here and get some feedback on how I'm doing things.
    I hope to post back here soon too.

    It was just an excuse to learn some OOP style, then maybe move onto Java. I've been wasting a fair bit of time the past couple of years reusing and rehashing old code, and want to make ammends and learn.

    Thank you.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •