Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP

Building a small cms

I need to build a small cms that allows me to sort the content in categories and have a small profile for each user. He hoped that put me on the right path What should I know to do this? and some recommendations if u can guys I do not want to use Wordpress, I want to learn how to make my own little cms

2 Answers

(TL;DR at bottom)

There's a reason why I recommend either using a prebuilt CMS or a framework, rather than writing it from scratch: there is no such thing as a "small" CMS. Every CMS has to manage the same things:

  • It must store content in a database
  • It must present content to outside visitors
  • It must allow the user to CRUD content
  • It must allow the user to organize content (taxonomies)
  • It must have some kind of user access with permissions levels
  • It must allow the user to upload media attachments
  • It must allow the user to make basic site changes (e.g., new nav links)
  • and the list goes on

The first two are somewhat easy, and they're covered entirely in Randy's awesome suite of PHP courses. But #3 and #4 are things that you really, really, really don't want to mess around with if you're new. User authentication is a nightmare. And have you seen the amount of work WordPress puts into its content editor? That tinyMCE editor thing blows any other editor I've ever seen out of the water. It's the result of over a decade of work. File uploads also require an insane amount of work.

On top of that, WordPress in particular offers Theme and Plugin APIs that no custom-from-scratch CMS could ever hope to reach. If you want to add some custom functionality to your site, it's usually just a couple clicks away to install a new plugin:

  • Want to destroy comment spam? Install Akismet.
  • Want Facebook integration? Install the Facebook plugin.
  • Want to use Google's reCAPTCHA for authentication? Install the reCaptcha plugin.
  • Want automatic backups? Install BackUpWordPress.
  • Want caching? Install WP Super Cache.
  • Want to scrap tinyMCE and use Markdown instead? Install WP-Markdown.
  • Want to keep all those plugins (and WP core) up-to-date automatically? Install Advanced Automatic Updates.

No. You really don't want to reinvent those wheels.

If you're insistent on writing a custom CMS, use a framework like Laravel and don't create it from scratch. The Laravel ecosystem has a lot of its own plugins that will assist you with a lot of what I mentioned in the first list (authentication, content editing, taxonomies, etc.). Hampton has a great ice-breaker on Laravel here at Treehouse.

TL;DR There's no such thing as a "small" CMS. It's great that you want to learn, it really is. But it would be best for you to use a prebuilt solution like WordPress, or if you're looking for something more lightweight, Bolt. Even if you want to build it all out yourself, using a framework like Laravel would greatly ease development.

Thanks for your reply what i want is understand how a cms work making one with some basics features, is just for learning nothing more and i need to know where i can start :)