Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Php Framework or template engine or something else?

Tags:

php

frameworks

I have a relatively simple application up and working with some basic functionality which i have built as a bit of a project. I would like to now build on that, and add some more complex features, including login.

The code has got quite complex, and it's written in plain php, so all the presentation code is mixed in with the logic. I have decided that before I go any further I'd like to re factor it to separate this out, so it's easier to maintain and add to. I've been researching MVC and think that's the way i should be going.

I had decided to give the zend framework a go, and have spent a while trying to get to grips with it, however I have found the learning curve extremely steep as I have no object oriented experience.

Is there another framework or option that anyone could recommend? I am considering having a look at cake based on reading other posts in this forum but I'd accept any guidance - my "requirments" are

  • easiest to learn for non OO experience
  • includes some login / authentication features
  • handles database interaction with mysql easily.

All suggestions appreciated!

like image 271
Rob Y Avatar asked Jan 07 '09 21:01

Rob Y


People also ask

Is PHP a template engine?

PHP is not a template engine, but a language that can be used to write templates, or template engines. A template engine is not just a language, but also the programming API that allows the scripts to locate, organize templates or assign the data from the script to them.

What are some other template engines?

Popular template engines Template engines are mostly used for server-side applications that are run on only one server and are not built as APIs. The popular ones include Ejs, Jade, Pug, Mustache, HandlebarsJS, Jinja2, and Blade.

Which of the following is a PHP based template *?

Smarty. Smarty is a template engine for PHP, facilitating the separation of presentation (HTML/CSS) from application logic. This implies that PHP code is application logic, and is separated from the presentation. Under the hood, Smarty compiles copies of the templates as PHP scripts.

Is JSP a template engine?

Spring MVC, Struts or Apache Wicket are examples of web frameworks, whereas JSP, Velocity or FreeMarker are examples of template engines.


2 Answers

As stated very eloquently here already, frameworks are good until you want to do something they're not suited for, plus they can abstract the language to the point where you're effectively learning them rather than the language you're coding in.

I would encourage you to roll your own. If you understand the principles of MVC and you have a fair-to-middling knowledge of PHP then it won't be too hard (there's already several pointers around), plus you'll come out of it far further ahead than if you'd just used someone else's.

like image 77
da5id Avatar answered Oct 27 '22 23:10

da5id


Smarty templating engine.

http://www.smarty.net/

like image 21
Jobo Avatar answered Oct 27 '22 23:10

Jobo