Php used it or not?


I need an advice & opinion from more experienced PHP programmers here…

I manage to create my own small CMS with php and mySql, and after working with it for over an year, I am thinking of bringing my small CMS on next level. I create different modules, like articles(pages), news, products, projects, faq, additional products images (for creating gallery for specific product), additional article images (for creating a gallery in the article-page) etc…

At this time according to the customer needs, I manually upload the pages from each module that I need, and I manually create the database.

My code is very old fashioned, with minimum uses of functions, and no classes. For the front end, I have different queries for different tables, and according to the design created by designer, I place the code for the front end, and the site is done.

Now, I would like to re-work my cms, this time with use of OOP, that is using classes & functions in an effort to minimize the time needed for site creation. Also, in the future, I would like to create an installer at least for the back office, since the front end will always have custom design, and I will have to place my code manually anyway…

My problem is that I am not that good with writing classes and functions.

My question is: will use of framework like a code ignition will help me to save the time with this project? Is it worth to learn the framework (his classes, functions etc…)

Or is better to sit down on my ass, and learn how to do everything by my own? What would you do in my situation?

Thanks in advance for your opinions & advices…

Regards, Zoreli

It sounds like your not massively experienced so writing a CMS may not be the best option. I suggest you at least have a look at some MVC style frameworks, just to get a feel of how different entities of a web application interact with each other, and how it all comes together.

You could rewrite your CMS using ‘functions and classes’, but the presence of classes in no way means the code will always be good. You can use classes and still end up with bad code or a bad system.

Whether it’s worth or not to learn to work with a specific framework is something you have to decide by yourself.
And to do so, you have to have to know how much work is involved to learn it.
ie hard to know up front :wink:

Using a framework has many benifits but that doesn’t mean it’s good for everybody.

I know, that answer doesn’t bring you any further. sorry about that.

In your specific case it might not be the best idea to use a framework for rewriting your cms. Depending on the framework you want to use you will have a long or a pretty long learning curve. And bear in mind: Using a framework doesn’t mean you don’t have to know OOP - the opposite is true

Using frameworks will improve your website a lot. You can reduce many security issues. Use CakePHP or CodeIgniter. Both are good and easy to learn.

My opinion is that before to learn to work with a framework is better to learn how to create and use classes and objects.
Than you can understand better how an aplication with classes works.

MVC based frameworks are good to use, but you still need that underlying knowledge of Object Oriented PHP. You can get much more out of it if you’re able to understand how the framework does things.

Learn to swim before you learn to dive.

Maybe you could try a different approach and instead of “reinventing the wheel” try one of the existing CMS systems: Drupal, Joomla or Alfesco to name a few - all three free and open source.

This way you can concentrate on your own customizations (by writing modules for your specific functionality required) rather than building the whole thing from scratch.

Using an MVC framework like codeigniter is a great option. It has a lot of libraries out of the box to help you not reinvent the wheel and it doesn’t force you to use strict mvc patterns while you learn the best practices.

MVC is that. A pattern. You don’t need a framework to implement the pattern. A framework is usually a box of tools built with the best intentions with other patterns, like Front Controllers, already done for you.

I’m a huge fan of frameworks and PHP code generators, I made a few courses of PHP and then fall in love for those generators, bascially most of my learning into PHP was on those generators and I fell that I dont have many gaps in my learning curve, OK, maybe there is some very basic stuff that I may dont know how to do but in other way I focused the learning in the real advanced things, was learning what really matters.

Using those PHP code generators such as scriptcase for example will teach you the correct flow in how to develop for web, if you want to start using a framework I would recomend you to use scriptcase.

But you can never forget to keep studing, that’s my tip. Hope that this text helped you a little bit.