WordPress.org

Ideas

SMARTY(ish) theme engine

  1. corourke
    Member

    12345

    Both of you are missing the point. Pure html and php are the way it is now. Introducing arbitrary template code isn't clean and requires learning a 3rd system of design in order to facilitate the way things are.

    I like the lack of lengthy overburdened "tags" and picked wordpress in large part because it didn't use "smarty templates".

    Posted: 8 years ago #
  2. nbw
    Member

    12345

    I think the humanity is missing the point. Having two legs is the way it is now (and it's been for ages). Introducing cars, trains and planes isn't clean and requires learning other systems and codes of law in order to facilitate the way things are.

    I really like to walk but if I have to go to other city I prefer travelling by car, train or plane. It's easier and faster.

    Got the point?

    Posted: 8 years ago #
  3. waIIace
    Member

    12345

    Good comparison ;)

    Posted: 8 years ago #
  4. lunabyte
    Member

    12345

    I think the templates as they are now are fine. They are as simple, or as flexible as you need.

    If you want templates that are really a pain, look at some of the forums out there now. As it is now, a WP templates is (mostly) html, with a few minor php tags thrown in. Thus, if a user with less knowledge of php really wants to build their own theme for their site, They can mark it up with pure HTML, then reference against the codex for the few tags they need. The only exceptions to this are the actual loop, which is still only a couple of tags combined.

    IMHO, SMARTY has its uses and when used in the right situation it can be very effective. However, WP isn't one of the cases where SMARTY is the answer. It would create more problems than it would solve.

    Think the forums are littered with useless questions about basic HTML/CSS now? Add SMARTY and see what happens.

    Posted: 8 years ago #
  5. nbw
    Member

    12345

    SMARTY is just a proposition.

    Posted: 8 years ago #
  6. bellois
    Member

    12345

    Great idea, nbw. I think you have absolutly right :-) Writing own theme for WP should be simple. Now it's a litle hard...

    Posted: 8 years ago #
  7. CapnRefsmmat
    Member

    12345

    To those who argue that you shouldn't have to learn a new templating language: HTML designers might not necessarily know PHP either. The templates should not be tied to the language.

    Take a look at phpBB3's templating system for a good example of a well-done system.

    Posted: 8 years ago #
  8. lunabyte
    Member

    12345

    But, Capn, they're going to be using tags either way. Whether it's <?php list_cats(1,2,3); ?> or {list_cats[1,2,3]}, or whatever.
    A tag is a tag. It's not like they're some magic thing nobody knows about, and theme authors have to guess at. They're documented right in the codex, for all to see and read about. They even contain several usage examples.
    So, why on earth fix something that isn't broke? Oh, that's right, people see
    <?php` and freak. Well, how confusing to them will another form be? The same.

    The only real situation this will create is take away the upper end of users who know what they're doing, and can easily pop whatever they want into their template. Adding a template engine would take this away most likely, and still not make it any easier for less knowledgeable users.

    In the end... you can lead a horse to water, but you can't make them drink. Whether it's Aquafina, or its Evian.

    Posted: 8 years ago #
  9. nbw
    Member

    12345

    Okay, those who are afraid of simple template language - what are you really afraid of? To make a fully usable layout one has to know not more than 4-5 (short) smarty tags. SMARTY for a designer is not more than 20-25 tags and it is quite similar to Django templates or Basic/Javascript code. One won't see the difference when comparing single lines of smarty/php. The advantage of template engine shows up when the layout is more complicated. The advantage also shows up when there is possibility to occasionally overwrite layouts when making updates.

    Introducing templates does not stand in clean and semantic code way, it does not throw away the possibility to enhance and hack the engine by writing plugins. Rather than having to learn what functions are provided by which plugins, one could have the possibility to simply get an array of variables provided. Hassle free. One does not have to go to codex, to google functions up. {debug output="html"} and voila - all the engine and plugins variables in one place. Ready to be abused.

    And please: when voting, do not stick to the "SMARTY" name. SMARTY is just one of the examples, not best, but quite good.

    Other examples:
    http://www.djangoproject.com/documentation/templates/

    Posted: 8 years ago #
  10. CapnRefsmmat
    Member

    12345

    No, lunabyte, you missed the point (somewhat). A templating language is usually designed to be simple; if it was like phpBB, it would be
    <!-- IF HAVE_POSTS -->
    <!-- BEGIN posts -->
    {POST_CONTENT}
    <!-- END posts -->
    <!-- IF !HAVE_POSTS -->

    and so on.

    It makes much more logical sense. And there are other reasons for using a templating engine, too:
    - It's more readable. HTML editors were made for HTML, not PHP, and web designers work with HTML, not necessarily PHP. If the logic is in comments, the editor can handle it automatically already.
    - It makes the templates more sane. Doesn't "Posted in {CATEGORY}" look better than "Posted in <?php the_category() ?>"? Sure it does, and it makes the meaning of the code much easier to grasp.

    And yes, I don't particularly like Smarty. It's too complex, and defeats the purpose of what I just said. Now go look at a phpBB template and compare it to WordPress (it'll be more complex, because phpBB is more complex, but you'll see the difference in templating).

    Posted: 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.

  • Rating

    12345
    137 Votes
  • Status

    Sorry, not right now