We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Hi,

    I want to show [+content+] if [+introtext+] is empty in Ditto (&tpl parameter). I use code below:
    [+introtext:ifempty=`[+content+]`+]

    It shows introtext for docs have intro but shows nothing for docs which haven’t intro.

    This happens only when i put [+content+]. it means code below shows pagetitle when there is no intro!!!!
    [+introtext:ifempty=`[+pagetitle+]`+]

    huh
      God loves me. 【ツ】


      MODX.ir (Persian Support)

      Boplo.ir/modx/ (Persian)
      • 7231
      • 4,205 Posts
      I have done this before but using a slightly different syntax
      [+introtext:isnot=``:then=`[+introtext+]...`:else=`[+content:word_limit=`100`+]...`+]
        [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

        Something is happening here, but you don't know what it is.
        Do you, Mr. Jones? - [bob dylan]
        • 33337
        • 3,975 Posts
        Or you can try with another syntax as well:

        [+phx:if=`[+introtext+]`:ne=``:then=`[+content+]`:else=`[+introtext+]`+]


        I think its a bit of parse order issue between Ditto’s PHx and PHx plugin.
          Zaigham R - MODX Professional | Skype | Email | Twitter

          Digging the interwebs for #MODX gems and bringing it to you. modx.link
        • Quote from: dev_cw at Mar 12, 2009, 06:36 PM

          I have done this before but using a slightly different syntax
          [+introtext:isnot=``:then=`[+introtext+]...`:else=`[+content:word_limit=`100`+]...`+]

          It shows intro well but others only "..."!

          Quote from: zi at Mar 12, 2009, 07:09 PM

          Or you can try with another syntax as well:

          [+phx:if=`[+introtext+]`:ne=``:then=`[+content+]`:else=`[+introtext+]`+]

          It shows nothing as content and for docs have intro, puts content in [+phx:if=` and `+]
          (output: [+phx:if=` page content.... `+])

            God loves me. 【ツ】


            MODX.ir (Persian Support)

            Boplo.ir/modx/ (Persian)
            • 7231
            • 4,205 Posts
            Try without the word_limit extender (not sure if that is default or extra)
            [+introtext:isnot=``:then=`[+introtext+]...`:else=`[+content+]...`+]


            If this doesn’t work try changing the Ditto call cache settings [[ ]] or [! !]
              [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

              Something is happening here, but you don't know what it is.
              Do you, Mr. Jones? - [bob dylan]
            • Quote from: dev_cw at Mar 12, 2009, 07:37 PM

              Try without the word_limit extender (not sure if that is default or extra)
              [+introtext:isnot=``:then=`[+introtext+]...`:else=`[+content+]...`+]


              If this doesn’t work try changing the Ditto call cache settings [[ ]] or [! !]
              I had been tried it ....

              I did it with Ditto summary extender. when &trunc=0, Ditto will check for introtext and replace it with [+summary+] else (there is no intro) uses content without "Read more" link as output.
              This is what i needed but the PHx problem didn’t solved.


              Thank you for helps smiley
                God loves me. 【ツ】


                MODX.ir (Persian Support)

                Boplo.ir/modx/ (Persian)
                • 3707
                • 241 Posts
                This works for me:
                [+phx:if=`[+introtext+]`:is=``:then=`[+content+]`:else=`[+introtext+]`+]
                  • 7231
                  • 4,205 Posts
                  Quote from: AHHP at Mar 12, 2009, 07:54 PM
                  I did it with Ditto summary extender. when &trunc=0, Ditto will check for introtext and replace it with [+summary+] else (there is no intro) uses content without "Read more" link as output.
                  I did not know that trick. Good to know grin But I wonder why it did not work with PHx?
                    [font=Verdana]Shane Sponagle | [wiki] Snippet Call Anatomy | MODx Developer Blog | [nettuts] Working With a Content Management Framework: MODx

                    Something is happening here, but you don't know what it is.
                    Do you, Mr. Jones? - [bob dylan]
                    • 33337
                    • 3,975 Posts
                    I think that word_limiter is not in default package. Thats why....
                      Zaigham R - MODX Professional | Skype | Email | Twitter

                      Digging the interwebs for #MODX gems and bringing it to you. modx.link