We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28107
    • 230 Posts
    Strange, very strange ..

    in modx 2.2.8 we have the following statement in a html header:
    <meta name="description" content="[[*description:notempty=`[[*description:strip]]`:else=`[[*pagetitle:strip]]`]]" />


    After investigating http headers with Firefox and the 'Live http headers' Plugin we found the following header among other 200s etc:

    HTTP/1.1 500 Internal Server Error
    Date: Fri, 13 Sep 2013 14:56:34 GMT
    Server: Apache/2.2.22
    X-Powered-By: PHP/5.4.9
    Expires: Thu, 19 Nov 1981 08:52:00 GMT
    Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
    Pragma: no-cache
    Connection: close
    Transfer-Encoding: chunked
    Content-Type: text/html; charset=UTF-8
    


    But:
    the site renders as expected, is accessible with a browser and the description tag is filled as expected.

    So, whats wrong with the line?
      CONIN Werbeagentur . Köln
      http://www.conin.de
    • Try writing that line without the MODX tags, but put in the raw text in the content= attribute, do you get same result?
        • 28107
        • 230 Posts
        Quote from: easylancer at Sep 13, 2013, 03:55 PM
        Try writing that line without the MODX tags, but put in the raw text in the content= attribute, do you get same result?

        <meta name="description" content="[[*longtitle]]" />


        works and gives me no 500

          CONIN Werbeagentur . Köln
          http://www.conin.de
        • what happen when you do [[*description:strip]] instead?
          • Also why not do

            <meta name="description" content="[[*description:default=`[[*pagetitle]]`]]:strip" />


            That should work, but back to the problem at hand, have you worked it out asyet?
            • You might also want to consider the method of having output modifiers return only the name of the element rather than processing all of the elements inside. In this case, the description is immediately processed, the modifier applied, and the appropriate tagname inserted into the outer set of tag delimiters, which then itself gets the strip modifier applied to it.
              <meta name="description" content="[[[[*description:notempty=`*description`:else=`*pagetitle`]]:strip]]" />

              If you have whole tags inside of the output modified element, MODx will first process those inner tags, storing their values, then process the modifier. So first you'd have the description and the pagetitle both loaded, then the description again being fetched to this time be processed with the notempty modifier. The unused inner element gets discarded. See http://modx.com/blog/2012/09/14/tags-as-the-result-or-how-conditionals-are-like-mosquitoes/
                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
                • 28107
                • 230 Posts
                just forgotten that blog entry.

                <meta name="description" content="[[[[*description:notempty=`*description`:else=`*pagetitle`]]:strip]]" />


                but that also generates a 500 !?!

                Now with a nearly naked template
                <html>
                <head>
                <meta name="description" content="[[[[*description:notempty=`*description`:else=`*pagetitle`]]:strip]]" />
                </head>
                <body>yehaw</body>
                </html>


                does the same. strange

                Tried that on my 2.2.8 sandbox and it works sad

                Assumption: must be one of the plugins. I'll try to track that down.
                  CONIN Werbeagentur . Köln
                  http://www.conin.de
                  • 3749
                  • 24,544 Posts
                  It does sound like a renegade plugin. wink
                    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
                    • 28107
                    • 230 Posts
                    Quote from: BobRay at Sep 15, 2013, 04:25 AM
                    It does sound like a renegade plugin. wink

                    YMMD smiley
                      CONIN Werbeagentur . Köln
                      http://www.conin.de