We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 3749
    • 24,544 Posts
    I ran into a quirk in Revolution that didn’t exist in 0.9.6. EZfaq keeps the FAQ content in a standard, unpublished MODx document in this format:

    Q:Question one
    A:Answer one
    EXTRA: this will appear between questions
    Q:Question two
    A:Answer two

    This gets the content:

    $doc = $modx->getDocument((string)$docID, '*', 1); // Search published first.
    if (empty($doc)) {
        $doc = $modx->getDocument((string)$docID, '*', 0); // Un-published next?
    }
    if (empty($doc)) { // user requested a non-existing document
       return $faq_lang['ezfaq-doc-not-found'];
    }
    $docString = $doc['content'];


    Then explode() progressively parses the document for display.

    I found that in Revo, the process was choking on "EXTRA:" until I changed it to "Extra:"

    I’m guessing it’s a reserved word issue, but one that didn’t exist in Evolution and, maybe, shouldn’t exist in Revolution?


      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
      • 22303 MODX Staff
      • 10,725 Posts
      How would this be affected by the core? I don’t understand the problem BobRay or how this could be affected by MODx in any way. Where is the code that would be looking at anything that says EXTRA:?
        • 3749
        • 24,544 Posts
        Quote from: OpenGeek at Sep 28, 2008, 10:00 AM

        How would this be affected by the core? I don’t understand the problem BobRay or how this could be affected by MODx in any way. Where is the code that would be looking at anything that says EXTRA:?

        Beats the heck out of me -- I was hoping you’d know. wink

        I’ve done a search and can’t find anything relevant in the core. All I know is that when EZfaq parses the document content using vanilla PHP explode(), it works fine if the token is Extra: but not when it’s EXTRA:

        Results with Extra: as the token in the snippet and the content document:

        Extra: This will appear between questions.     -->   appears on the page as "This will appear between questions."

        Results with EXTRA: as the token in the snippet and content document:
        EXTRA: This will appear between questions.     -->   appears on the page as "EXTR"


        I’ve changed it back and forth several times and the results are consistent. The "EXTRA:" lines are the only ones affected, the rest of the parsing goes fine.

        If it was an error in my code, you’d think the case of the token wouldn’t matter.

        I’ve tried creating a much simpler snippet with a single explode() and I can’t duplicate the problem so it seems almost certain that MODx isn’t the culprit. It’s a mystery all right.

        EZfaq is in the SVN repo now if you’re curious enough to try it yourself. smiley
          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
          • 3749
          • 24,544 Posts
          I’m an idiot.  embarrassed tongue embarrassed

          I’m also parsing the content with Q: and A: as tokens. Do you think one of those might be contained in EXTRA: but not Extra: huh (sound of hand hitting forehead).
            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