We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 33968
    • 863 Posts
    @Eoler: Nice smiley All the more reason to find a common place we can all post and search for these things!
      • 15558
      • 108 Posts
      Is it a big issue to use several (like fifteen or more) notempty output modifiers to wrap mere simple TVs ? like this :

      	  [[*tvSurfaceCarrez:isnotempty=`<span class="detail">Surface habitable : [[*tvSurfaceCarrez]]</span>`]]
      	  [[*tvSurfaceSol:isnotempty=`<span class="detail">Surface au sol : [[*tvSurfaceSol]]</span>`]]
      	  [[*tvSurfaceTerrain:isnotempty=`<span class="detail">Surface du terrain :[[*tvSurfaceTerrain]]</span>`]]



      I'm wondering
        Sorry for that ⇧ , I'm no dev but I wanna try
        • 3749
        • 24,544 Posts
        Not if the page-load time is acceptable.
          Did I help you? Buy me a beer
          Get my Book: MODX:The Official Guide
          MODX info for everyone: http://bobsguides.com/modx.html
          My MODX Extras
          Bob's Guides is now hosted at A2 MODX Hosting
          • 15558
          • 108 Posts
          my eyes are burning

          thank you Bob

          However, I don't know yet what the client's hosting service is capable of. Let's think of it as a surprise.
            Sorry for that ⇧ , I'm no dev but I wanna try
            • 23018
            • 353 Posts
            A couple of months ago I posted an idea that might also be worth adding to this list:

            http://forums.modx.com/thread/80126/all-purpose-snippet-is-this-a-good-idea-or-a-really-bad-one#dis-post-441501

            The idea ist to have a snippet that can do all kind of stuff depending on its parameters.

            You simple pass the function name and an double pipes seperated list of parametes to the snippet an you are ready to go:

            /* Use str_replace on a string and put the result into a placeholder. */

            /* Use str_replace on a string and put the result into a placeholder. */
             
            [[!runFn? 
               &fn=`str_replace` 
             &args=`This||MODx||This CMS is awesome`
               &ph=`test`
            ]]
             
            [[+test]]
             
            /* Result: MODx CMS is awesome*/


            The whole snippet is listed in the post above. If there is a php function you want to use, it can most certainly be called with this snippet.

            Another example:

            [[!runFn? 
            /* Return the current date in a specific format */
             
            [[!runFn? 
               &fn=`date` 
             &args=`'l jS \of F Y h:i:s A'` 
            ]]
            /* Result: 'Thursday 25th of October 2012 03:39:38 PM' */


            This concept can be improved, especially in regards to security and error handling, but I think it is well worth the trouble to have a universal snippet.

            Regards,

            pepebe [ed. note: pepebe last edited this post 10 years, 11 months ago.]
              Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe