HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Please upgrade here. These earlier versions are no longer being updated and have security issues.

{include} smarty tag?

clethrillclethrill ✭✭
edited November 2011 in Vanilla 2.0 - 2.8
Does vanilla not support the {include} smarty tag? I have been using the rounder theme, modified. And I want to reuse some elements throughout the template. Is there a way to do it with views instead? (Don't have a clue how they work)
Tagged:

Best Answer

  • x00x00 MVP
    Accepted Answer
    you can use {asset} or create your own smarty function/plugin.

    look in library/vendors/

    Personally I have come to the conclusion that smarty is a bit of waste of time though.

    If you are using {include} and {php} and all sort of logic in there you aren't getting separation of concerns, which is the whole point of a template engine.

    grep is your friend.

    CurtisOden

Answers

  • Please? Bump, are we allowed to bump?
  • x00x00 MVP
    Accepted Answer
    you can use {asset} or create your own smarty function/plugin.

    look in library/vendors/

    Personally I have come to the conclusion that smarty is a bit of waste of time though.

    If you are using {include} and {php} and all sort of logic in there you aren't getting separation of concerns, which is the whole point of a template engine.

    grep is your friend.

    CurtisOden
  • Thank you,
    I attempted to convert it to php but I was a bit sloppy and had errors everywhere and gave up in the end. I will look into the asset tag.
  • x00 said:

    **> Personally I have come to the conclusion that smarty is a bit of waste of time though. **

    It's wasting all of my time today. Do you know of a list containing PHP equivalents of the Vanilla Smarty tags. The documentation would be a logical place to look. Alas...

  • It's wasting all of my time today. Do you know of a list containing PHP equivalents of the Vanilla Smarty tags. The documentation would be a logical place to look. Alas...

    I know a fair bit, but it is fair to say that the smarty implementation abstract a lot of to the logic in smarty functions (but in a more limited, less pliable way). So really the equivalent you are looking for aren't really 1:1

    Best thing to do is to interpret the php version of the default template. and also you can look at how the smarty functions where constructed in /library/vendors/SmartyPlugins.

    I can't really say more that that, because it can be be time consuming explaining everything, when people doing really care how it works. Really you a re better off learning that because that little bit of knowledge, will save you time in the long run.

    grep is your friend.

Sign In or Register to comment.