We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 7923
    • 4,213 Posts
    Mucho respecto! I think it will be a great piece of software.


      "He can have a lollipop any time he wants to. That's what it means to be a programmer."
      • 33372
      • 1,611 Posts
      I personally have no strong feelings about Smarty, having used it for only basic applications in the past, but I’m wondering why some folks have such strong negative reactions to using it. It seems like a very useful and flexible tool to me, and it’s already built and tested and functioning as a plug-in module. What are people’s concerns about using it anyway?
        "Things are not what they appear to be; nor are they otherwise." - Buddha

        "Well, gee, Buddha - that wasn't very helpful..." - ZAP

        Useful MODx links: documentation | wiki | forum guidelines | bugs & requests | info you should include with your post | commercial support options
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        My objection was the bloat it would add, loading up a whole ’nother library, but if we’re only using it for manager pages then it wouldn’t be so bad.

        I also tried to use it once several years ago and found that it was not able to do something I wanted; maybe it’s been improved since then. After all, installing Linux these days is totally different from my first floppy installation of Slackware 1.0!

        Of course, there’s always just plain laziness... I’ve already gone to all the trouble of learning the existing MODx structure, now I’ll have to go learn how to use Smarty grin
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: sottwell at Mar 28, 2007, 01:51 AM

          My objection was the bloat it would add, loading up a whole ’nother library, but if we’re only using it for manager pages then it wouldn’t be so bad.
          The integration is implemented as an optional service ($modx->services[’smarty’], also accessible as $modx->smarty), so Smarty is only loaded when needed, and the initial use case is definitely limited to manager page rendering. I’ve noticed no real difference in rendering times, and with the posts being handled by AJAX now, the number of page refreshes in the manager is greatly reduced as a result, making the experience at least seem much lighter and quicker. In addition, QuickEdit can now be refactored to take advantage of the new connectors to perform the same tasks from it’s own interface, as can any other management interface you want to build in the manager, front-end, or any context, Smarty or no Smarty.

          Quote from: sottwell at Mar 28, 2007, 01:51 AM

          Of course, there’s always just plain laziness... I’ve already gone to all the trouble of learning the existing MODx structure, now I’ll have to go learn how to use Smarty grin
          The good news here is that once you learn the new object-oriented MODx API, with any experience in PHP, the Smarty templates will look very familiar. Smarty exposes MODx objects directly, and so your learning-curve on this will likely be minimal. Consider the following block from one of the manager templates which illustrates how easy it is to work with the templates and the new API...
          	<th colspan="2">
          		<input name="locked" id="locked" type="checkbox" {if $chunk->locked EQ 1}checked="checked"{/if} />
          		<label for="locked">{$_lang.lock_htmlsnippet}</label>
          		<span class="comment">{$_lang.lock_htmlsnippet_msg}</span>
          	</th>
          

          I think you’ll find that Smarty’s robust support for conditional logic and accessing PHP variables assigned to the template by the new controller files will make it infinitely easier to create custom manager interfaces, and could be used just as easily to do the same for front-end templates. In fact, I have plans to make both a modSmartyResource class (create documents that can be rendered using Smarty templates) and a modSmartyElement (embed Smarty templates within any other MODx Content Element, be it a template, a web resource’s content, template variable, snippet, chunk, etc.). But again, the key here these are all optional services and core extensions...
            • 6726
            • 7,075 Posts
            And now you almost got me convinced, so much so that I’ll try a second look at smarty tongue

            Glad I didn’t miss this post, modSmartyResource and modSmartyElement are a pretty interresting example of how you can integrate smarty into the new MODx codebase, not to mention helping me understand what Resources and Elements will be. I really love the concept though I am hardly qualified to have an informed opinion of how you’ll achieve that !
              .: COO - Commerce Guys - Community Driven Innovation :.


              MODx est l&#39;outil id
              • 28042 ☆ A M B ☆
              • 24,524 Posts
              Indeed, I’ll also reconsider my original opinion of Smarty; I have a great deal of respect for anything Jason does, so it must have something going for it!
                Studying MODX in the desert - http://sottwell.com
                Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                Join the Slack Community - http://modx.org