SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Building a CMS from scratch, need some help

    Hi,

    I am building a CMS from scratch. I have coded the very basics but there is still a long road to go for me. I know I can use one of the many great open source CMS out there but I have my reasons for building it from scratch.

    I found some simple tutorials and articles talking about building a CMS but none of them are in-depth and cover all the details like, template system, security, updates etc. What I am asking is if you know of any nice "build a CMS from scratch" type of tutorials, articles, ebooks or videos whatever, please give a link to it here. Your help is much appreciated.

    Thanks.

  2. #2
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,294
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    SitePoint's PHP & MySQL Novice to Ninja might be a good fit.

  3. #3
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    SitePoint's PHP & MySQL Novice to Ninja might be a good fit.
    Ralph, thanks for the suggestion. I know that book and it seems very nice but from the contents I can say that it is more like talking about the basics of building a PHP & MySQL site. I can say that I know the basics to some extent, what I need now is some detailed guides/tutorials on building a CMS. Do you know of any other ebooks focusing on CMS development?

  4. #4
    padawan silver trophybronze trophy markbrown4's Avatar
    Join Date
    Jul 2006
    Location
    Victoria, Australia
    Posts
    4,113
    Mentioned
    28 Post(s)
    Tagged
    2 Thread(s)
    Quote Originally Posted by Nail Yener View Post
    Ralph, thanks for the suggestion. I know that book and it seems very nice but from the contents I can say that it is more like talking about the basics of building a PHP & MySQL site. I can say that I know the basics to some extent, what I need now is some detailed guides/tutorials on building a CMS. Do you know of any other ebooks focusing on CMS development?
    I don't know of a book specific to it, if you are familiar with the basics just make a start.
    Building a CMS is a project that a lot of people undertake when they are learning. The process of planning it out, building, problem-solving teaches you a lot. You also said that you had coded the basics already. What features are you stuck on?

    I'd also suggest digging into the source of great open source CMS' out there to see what you can learn. e.g.
    https://github.com/modxcms/revolutio.../develop/core/

  5. #5
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by markbrown4 View Post
    I don't know of a book specific to it, if you are familiar with the basics just make a start.
    Building a CMS is a project that a lot of people undertake when they are learning. The process of planning it out, building, problem-solving teaches you a lot. You also said that you had coded the basics already. What features are you stuck on?

    I'd also suggest digging into the source of great open source CMS' out there to see what you can learn. e.g.
    https://github.com/modxcms/revolutio.../develop/core/
    Hi Mark,

    Asking specific questions about the points where I am stuck will require me to post all the code I have in all related files. I can do that but it will be a tedious task for anyone to go through all that code to help me. That's why I am looking for some good tutorials or ebooks. Surprisingly, I couldn't find any ebook that teaches CMS design yet.

    My CMS will be a very basic one. It will be a directory. Just some pages and listings stored in the DB, a dashboard to easily add/edit/remove pages/listings and change the themes/style. I have the following setup at the moment:

    /admin/
    /themes/
    /uploads/
    index.php
    config.php

    The point I can't solve at this time is about displaying theme files on the homepage. I have a "default" theme in the themes folder. It has index.php, style.css, page.php etc. I can display index.php of the default theme on the homepage, but I can't get page.php (which gets page contents from the DB) displayed. I tried using some sort of .htaccess redirection but it will not be the real solution. I checked WordPress and it has no .htaccess files for doing what I am trying to do.

    Anyway, thanks for your input. I will keep trying to find some resources and meanwhile I will be checking sample opensource CMS files.

  6. #6
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,294
    Mentioned
    460 Post(s)
    Tagged
    8 Thread(s)
    Quote Originally Posted by Nail Yener View Post
    I know that book and it seems very nice but from the contents I can say that it is more like talking about the basics of building a PHP & MySQL site. ... Do you know of any other ebooks focusing on CMS development?
    Yes, fair enough. The problem with a book on building a CMS is that it's not a specific entity, but anything that your intelligence can dream up from knowing a language like PHP.

    Another option you might consider is to use a framework rather than a CMS. The framework provides the basis for the CMS but it's up to you to build it as you wish. CodeIgniter is worth a look, for example. They have some pretty good docs on how it works and how to use it, too.

  7. #7
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    Yes, fair enough. The problem with a book on building a CMS is that it's not a specific entity, but anything that your intelligence can dream up from knowing a language like PHP.
    You are absolutely right Ralph, but I will keep my research hoping to find more resources to get different ideas and learn about things that I am not aware of about CMS design.

    Quote Originally Posted by ralph.m View Post
    Another option you might consider is to use a framework rather than a CMS. The framework provides the basis for the CMS but it's up to you to build it as you wish. CodeIgniter is worth a look, for example. They have some pretty good docs on how it works and how to use it, too.
    I have been ignoring the option of using a framework as the basis because I always thought it would take longer learning how the framework works than learning to build it from scratch. I checked CodeIgniter, I will give it a try but I will also continue developing my own custom CMS from scratch. Thank you again.

  8. #8
    SitePoint Wizard bronze trophy
    Join Date
    Oct 2001
    Location
    Vancouver BC Canada
    Posts
    2,032
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Nail Yener View Post
    Hi Mark,

    Asking specific questions about the points where I am stuck will require me to post all the code I have in all related files. I can do that but it will be a tedious task for anyone to go through all that code to help me. That's why I am looking for some good tutorials or ebooks. Surprisingly, I couldn't find any ebook that teaches CMS design yet.

    My CMS will be a very basic one. It will be a directory. Just some pages and listings stored in the DB, a dashboard to easily add/edit/remove pages/listings and change the themes/style. I have the following setup at the moment:

    /admin/
    /themes/
    /uploads/
    index.php
    config.php

    The point I can't solve at this time is about displaying theme files on the homepage. I have a "default" theme in the themes folder. It has index.php, style.css, page.php etc. I can display index.php of the default theme on the homepage, but I can't get page.php (which gets page contents from the DB) displayed. I tried using some sort of .htaccess redirection but it will not be the real solution. I checked WordPress and it has no .htaccess files for doing what I am trying to do.

    Anyway, thanks for your input. I will keep trying to find some resources and meanwhile I will be checking sample opensource CMS files.
    I think Mark's suggestion of asking questions however tedious it may be is going to be the best way to get over the humps your being challenged with.

    What sort of architecture are you using... is it OOP, MVC or built on various functions that are called into a template system? I've built a number of CMS systems but abandoned that sort of thing several years ago in favor of the big Open Source CMS's. I'm still quite interested in CMS development but for my purposes the big OSS packages are better suited.

    So I think rather than depending on .htaccess you need some sort of config system that cobbles everything together. It doesn't need to be complicated... All it needs to do is intercept the page requests and tell the system to put in all of the pieces and run whatever rules you have in place to assemble the theme. Kevin Yank wrote an article about half a dozen years ago that discussed a routing system in PHP that would intercept all requests and do that. I'll see if I can find it and post it back.

    Cheers,
    Andrew
    Andrew Wasson | www.lunadesign.org
    Principal / Internet Development

  9. #9
    SitePoint Addict
    Join Date
    Nov 2009
    Posts
    311
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by awasson View Post
    I think Mark's suggestion of asking questions however tedious it may be is going to be the best way to get over the humps your being challenged with.

    What sort of architecture are you using... is it OOP, MVC or built on various functions that are called into a template system? I've built a number of CMS systems but abandoned that sort of thing several years ago in favor of the big Open Source CMS's. I'm still quite interested in CMS development but for my purposes the big OSS packages are better suited.

    So I think rather than depending on .htaccess you need some sort of config system that cobbles everything together. It doesn't need to be complicated... All it needs to do is intercept the page requests and tell the system to put in all of the pieces and run whatever rules you have in place to assemble the theme. Kevin Yank wrote an article about half a dozen years ago that discussed a routing system in PHP that would intercept all requests and do that. I'll see if I can find it and post it back.

    Cheers,
    Andrew
    Hi Andrew,

    I am not using any type of architecture, I am using various functions and trying to grab a piece of info from here or there and trying to figure out how WordPress handles things. It is still too complicated for me. Really, there are so many CMS out there but I couldn't find any comprehensive tutorials on building even a simple one with the most basic features. When I accomplish my task and finally create a nice, secure CMS, I will create tutorials for the community.

    I am trying to figure out creating the proper folder structure at the moment. I have the following in my config.php file (in the root):

    PHP Code:
    define('THEMES'dirname(__FILE__).'/themes/'); 
    When I use the THEMES constant for linking to the stylesheet in the index.php file of the default theme, I have something like the following which doesn't work.

    HTML Code:
    C:\Apache24\htdocs/themes/default/style.css
    I am working locally on a Windows PC and I guess the slashes/backslashes inconsistency is because of it.


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
  •