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 have FF 2.0.0.11 PC (current version).

    I notice that the blinking cursor isn’t always there. It comes and goes as I scroll up and down a line or two.

    I have a bunch of FF plugins installed so it may be caused by one of them.

    Bob
      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
      • 28025
      • 50 Posts
      Hi Bob,

      That may be it, ’cause I’ve tried to force the cursor to appear with different approaches but with no luck (luckily smiley

      Soren
        • 3749
        • 24,544 Posts
        Quote from: Soreng at Dec 22, 2007, 10:12 AM

        Hi,
        The FAQ is a custom solution, which can easily be made into a snippet. I’l do this, and make it available in the repository.

        Cheers,
        Soren

        Hi Soren,

        I didn’t mean to get ahead of you, but I had some time and started playing around and I have the guts of a working FAQ snippet. I got the script you used from the DynamicDrive.com and it works really well.

        It was your idea so you definitely deserve to build the snippet if you want, but I can do it if you don’t have the time or inclination. Either way, I thought you’d like to see the code I have.

        It assumes that the FAQ content is in a standard MODx document (published or unpublished) with the following form:

        Q:Question one.
        A:Answer one.

        Q:Question two.
        A:Answer two.

        etc.
        The snippet is insensitive to the spacing between fields and the Q: and A: are stripped out.

        The snippet is called as
        [[FaqSnippet? &docID=`n`]]
        where n is the document ID of the document containing the content.

        Here’s the snippet code. I haven’t had time to put in the tags but it definitely outputs the questions and answers as it should:

        $doc = $modx->getDocument((string)$docID, '*', 1); // Search published first.
        if (empty($doc)) {
            $doc = $modx->getDocument((string)$docID, '*', 0); // Un-published next?
        }
        
        $output = "";  // initialize $output
        $docString = $doc['content'];  //get the document's content
        
        $docArray = explode("Q:",$docString);  // split it at each Q:
        
        //$i = count($docArray);
        //echo "count: ".$i.'<br>';
        
        foreach($docArray as $value) {
            $items = explode("A:",$value); // split at the A:
            if ( ($items[0] != "") && ($items[1] != "") ) { // don't use any items with empty strings
        
                // tags before question go here
        
                $output .= $items[0]; // here's the question
        
                // tags after question go here
        
                // tags before answer go here
        
                $output .= $items[1];  // here's the answer
        
                // tags after answer go here
        
                //$output .= '<br>***<br>';
            }
        }
        
        return $output;
        


        Cheers,

        Bob
          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 PM’d Soreng but didn’t get a response, so I went ahead on creating the FAQ snippet based on his example.

          It isn’t quite ready for publication (I still need to figure out where to put the support files), but it has some neat parameter options and a language file. You can see the results here:

          http://bobsguides.com/modx-faq.html

          Bob
            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