SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Member
    Join Date
    Nov 2004
    Location
    london
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP Framework vs. Template Engine???

    hi everyone,

    I got a question that what's the difference between PHP Framewor and PHP Template Engine.

    Template engines are included as part of a framework???

    please help me,
    thanks !

  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2003
    Location
    norway
    Posts
    92
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow, how very advanced.

    Frameworks are a set of components built together to help with specific problems. You have several php-frameworks, and many of them incorporate their own template-engine, though the two are two entirely seperate things.

    If you want, you can use templateengines without any specific framework, like smarty. Then, after you see the light, you will cast Smarty into the burning flames of Mount Doom and never look back.

  3. #3
    SitePoint Member
    Join Date
    Nov 2004
    Location
    london
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Aphenitry
    Wow, how very advanced.

    Frameworks are a set of components built together to help with specific problems. You have several php-frameworks, and many of them incorporate their own template-engine, though the two are two entirely seperate things.

    If you want, you can use templateengines without any specific framework, like smarty. Then, after you see the light, you will cast Smarty into the burning flames of Mount Doom and never look back.
    Thank you your answer.
    But I also can't understand it exactly,
    could you please give me more detail.


    A framework is an integrated set of components that collaborate to provide a reusable architecture for a family of related applications.

    Template Engine is used to separate presentation layout and style from view logic.

  4. #4
    SitePoint Enthusiast
    Join Date
    Jan 2003
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Think of it this way, an engine is to a car as a template class/engine is to a framework.

    engine:car::template engine:framework

    - You can have different types of engines in a car and there are all sorts of cars. Same thing with frameworks and template engines
    - As a whole, a car is more useful as a sum of its parts (brakes, steering) just as a framework provides other functionality to make it more useful (database, email, form validation etc.).

  5. #5
    SitePoint Member
    Join Date
    Nov 2004
    Location
    london
    Posts
    3
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ghuytro
    Think of it this way, an engine is to a car as a template class/engine is to a framework.

    engine:car::template engine:framework

    - You can have different types of engines in a car and there are all sorts of cars. Same thing with frameworks and template engines
    - As a whole, a car is more useful as a sum of its parts (brakes, steering) just as a framework provides other functionality to make it more useful (database, email, form validation etc.).
    Thanks!
    But I hope i can handle it exactly, could you guys give me some example concerning the popular framework and template engines.

    e.g.

    A framework is an integrated set of components that collaborate to provide a reusable architecture for a family of related applications. An MVC Framework helps us build applications using the MVC pattern.
    for example: PHP.mvc, Mojavi, PRADO ...

    Template Engine is used to separate presentation layout and style from view logic.
    for example: Smarty or WYSIWYG HTML editors???

  6. #6
    SitePoint Guru
    Join Date
    Oct 2001
    Posts
    656
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I can understand where this question came from. If you look at some of the so-called frameworks, many are little more than a glorified template engine.

  7. #7
    SitePoint Member
    Join Date
    Jun 2003
    Location
    Vashon, Washington
    Posts
    13
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A template engine is usually just a way to display the results generated by your application. For example, if you are writing a php application, you'll usually need to do stuff like iterate through an array and display all the values in a certain way. A template engine will usually let you assign these dynamic variables, and provide a way to display them.

    A framework usually provides not only a way to display the information, but a way to code the actual application as well. For example, common features of a framework include processing request date ($_GET and $_POST variables), database access, user permissions, form validation, and most of all the way you actually organize your application. This differs from templates in that templates only provide display logic, whereas frameworks provide a means to do application logic as well.

    With a template engine, you can use any sort of code to provide the information the template needs to display the code. With a framework, you have to code your application in a certain way, dictated by the way the framework does things. The upside to using a framework is that if you learn it very well, you will be able to program applications faster because they provide a structured way to approach a project, as well as pre-written common application logic. The downside is that you have to actually learn the framework (some are very poorly documented), and that you may find limits to what you can do within the framework. You also need to learn template engines, but template engines let you decide how you get the information you provide it yourself.

    Hope that helps,
    Saoi


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
  •