We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 23018
    • 353 Posts
    As I understand it, MODX is using smarty like syntax in manager templates.

    Example: manager/assets/modext/widgets/core/modx.combo.js line 224

            ,tpl: new Ext.XTemplate(
                 '<tpl for=".">'
                ,'  <div class="x-combo-list-item">'
                ,'      <span style="font-weight: bold">{templatename}</span>'
                ,'      <tpl if="category_name">'
                ,'          - <span style="font-style:italic">{category_name}</span>'
                ,'      </tpl>'
                ,'      <br />{description}'
                ,'  </div>'
                ,'</tpl>'
            )
    


    Now I want to apply some changes to the template combobox.

    Stripping tags from the content of {description} would be a good start. The usual smarty syntax (v2+) to do this would look like this:

    {$description|strip_tags:true} or {$description|strip_tags} 


    This doesn't work. Removing the dollar sign doesn't help as well.

    Two Questions:
    1. I couldn't find any documentation giving advice how to build templates using smarty syntax in MODX. If anyone has a good link for further reading, I would be very happy to learn about it.
    2. Can somebody point me to the file where the db is queried for the templates or how I can modify the content of description before it is used by modx.combo.js?

    Regards,

    pepebe



    [ed. note: pepebe last edited this post 12 years, 7 months ago.]
      Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
      • 4172
      • 5,888 Posts
      this isn't smarty-syntax, what you see are Ext.XTemplate - placeholders for the field-values, which are fetched by ajax for example from here:
      https://github.com/modxcms/revolution/blob/develop/core/model/modx/processors/element/template/getlist.class.php

      this is the path to this processor, for example:
              
      ,baseParams: {
          action: 'element/template/getlist'
      }
      


      you can find some infos about Ext.XTemplate here:
      http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.XTemplate-method-constructor [ed. note: Bruno17 last edited this post 12 years, 7 months ago.]
        -------------------------------

        you can buy me a beer, if you like MIGX

        http://webcmsolutions.de/migx.html

        Thanks!
        • 23018
        • 353 Posts
        Quote from: Bruno17 at Mar 05, 2014, 08:43 AM
        this isn't smarty-syntax, what you see are Ext.XTemplate - placeholders for the field-values, which are fetched by ajax for example from here:
        https://github.com/modxcms/revolution/blob/develop/core/model/modx/processors/element/template/getlist.class.php

        this is the path to this processor, for example:
                
        ,baseParams: {
            action: 'element/template/getlist'
        }
        


        you can find some infos about Ext.XTemplate here:
        http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.XTemplate-method-constructor

        No wander I didn't make any progress.

        The links is also very helpful.

        Thanks

        pepebe
          Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe
          • 23018
          • 353 Posts
          Thanks to Bruno17, the problem has been solved:

          ,tpl: new Ext.XTemplate(
               '<tpl for=".">'
              ,'  <div class="x-combo-list-item">'
              ,'      <span style="font-weight: bold">{templatename}</span>'
              ,'      <tpl if="category_name">'
              ,'          - <span style="font-style:italic">{category_name}</span>'
              ,'      </tpl>'
              ,'      <br />{description:stripTags}'
              ,'  </div>'
              ,'</tpl>'
          )


          http://docs.sencha.com/extjs/3.4.0/#!/api/Ext.util.Format

          Turns out you can do a lot of things using util.Format.

          Nice.

          Case closed!

          pepebe
            Homepage: pepebe.de | MODX snippets (and other stuff) at github: https://gist.github.com/pepebe