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

    This is an awesome snippet, thanks for sharing it.

    When I was modifying the snippets CSS "ezfaq.css" in noticed a small mistake

    Line 18 - padding: 10px; 15px 35px 15px;

    You got the extra ; after 10px

    Otherwise works perfectly, thanks again
    Free
      • 3749
      • 24,544 Posts
      Quote from: cackalufabogus at Jul 05, 2008, 11:59 PM

      Hi Bob,

      This is an awesome snippet, thanks for sharing it.

      When I was modifying the snippets CSS "ezfaq.css" in noticed a small mistake

      Line 18 - padding: 10px; 15px 35px 15px;

      You got the extra ; after 10px

      Otherwise works perfectly, thanks again
      Free

      Thanks, I’ll add that to the list.

      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
        • 4455
        • 76 Posts
        Cool cool

        Another issue I (eventually) noticed was that If the answer has more than one block level element (paragraph, list etc), there was no margin between the first paragraph and the next element if the "Q:" was inside the same paragraph tag as the answer. eg.
        <p>Q:This is the first part of the answer</p>
        <p>This is the second</p>
        


        While it’s no problem for me to move the Q: outside the p tags eventually the FAQ will be updated by a non-technical user from the RTE (I figure this will probably often be the case too sad )

        Being a front-end guy that’s pretty lousy at "real" code it took me a while, but eventually tracked it down to around line 160:
             $output .= '<p id="faq'.$itemCount.'-title" class="handcursor">';
             $output .= '<span class="faqQuestion">';
             $output .= $items[0];
             $output .= '</span>';
             $output .= '</p>';
             $output .= '<div id="faq'.$itemCount.'" class="switchgroup1">';
                //$output .= '<p class="faqAnswer">';
             $output .= $items[1];
                //$output .= '</p>';
             $output .= '</div>';
        


        A quick look at the generated source shows:
        <div class="faqContainer">
        <p id="faq1-title" class="handcursor"><span class="faqQuestion">The question</p>
        <p></span></p>
        <div id="faq1" class="switchgroup1">This is the first part of the answer</p>
        <p>This is the second part of the answer</p>
        


        So I figure that the snippet is cutting off the initial opening <p> that the RTE is using, but is adding the closing </p>

        Eventually I got it going right by changing the snippet to:
             $output .= '<div id="faq'.$itemCount.'" class="switchgroup1"><p>';
        


        Not sure if that will help anyone other than me, but I thought I should let you know. Anyway, I’m new to the whole MODx scene, just tell me to shutup if I’m banging on about nothing smiley

        Cheers
        Free
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          You are being a genuine member of the MODx community. grin grin

          We encourage bug findings and fixes, especially in "corner cases" that may not ever be exposed under ordinary use. Every snippet eventually gets used in ways not expected by the original authors, and as long as the bugs get reported (preferably with the fix!) the snippets get updated and improved.
            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
            • 4749
            • 623 Posts
            Bob,

            Thanks for taking another look at it. I added the code, but it’s still swallowing up the anchor. Maybe (read as: most likely) I’m not understanding the code, but it seems that the closing div is still enclosing the anchor. Shouldn’t this part:
            $aArray = explode("Extra:",$items[1]);  // added  - Split the answer at the "Extra:" tag (if there is one).


            come after the div closes? That’s how the code works statically. Like this:
            <a name="section1">Section 1</a>
            <h3>Term</h3>
            <div>Definition</div>
            <h3>Term</h3>
            <div>Definition</div>
            <a name="section2">Section 2</a>
            <h3>Term</h3>
            <div>Definition</div>
            <h3>Term</h3>
            <div>Definition</div>
            


            So, in the code it should look for the anchor outside of the div, not within it. I tried messing with it, but can’t get it to work. Thanks for all your help.


              The MODx has you...
              Utah Web Design
              • 3749
              • 24,544 Posts
              Quote from: cbaone at Jul 07, 2008, 09:04 AM

              Bob,

              Thanks for taking another look at it. I added the code, but it’s still swallowing up the anchor. Maybe (read as: most likely) I’m not understanding the code, but it seems that the closing div is still enclosing the anchor. Shouldn’t this part:
              $aArray = explode("Extra:",$items[1]);  // added  - Split the answer at the "Extra:" tag (if there is one).


              come after the div closes?

              That line doesn’t create any output so moving it wouldn’t help with your problem.

              How about if you attach your version of the .php file and the contents of your FAQ content document so I can try to figure our what’s happening?

              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
                • 4749
                • 623 Posts
                Thanks Bob, I’ve attached the content and the php file I’m using.
                  The MODx has you...
                  Utah Web Design
                  • 3749
                  • 24,544 Posts
                  Quote from: cackalufabogus at Jul 06, 2008, 04:37 PM

                  Cool cool

                  Another issue I (eventually) noticed was that If the answer has more than one block level element (paragraph, list etc), there was no margin between the first paragraph and the next element if the "Q:" was inside the same paragraph tag as the answer. eg.
                  <p>Q:This is the first part of the answer</p>
                  <p>This is the second</p>
                  


                  While it’s no problem for me to move the Q: outside the p tags eventually the FAQ will be updated by a non-technical user from the RTE (I figure this will probably often be the case too sad )


                  Thanks for the input. When I created the snippet, I found that the JS often interracted with the .CSS in weird ways. The current form evolved through a lot of trial and error and there are things that I don’t remember why I did them but I remember that alternatives went badly wrong in some circumstances so I’m hesitant to mess with it.

                  I found that what worked best for me (and perhaps for your non-tech editor) was to turn off the RTE and have no html at all in the FAQ content document other than

                  to split paragraphs withing an answer, when necessary. All the other styling can be done in the .CSS file.

                  Let me know if that doesn’t solve your problem and I’ll look more closely at the way things are formatted. I’m no .CSS genius and I’m open to doing it another way if there’s one that would be more bulletproof.

                  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
                    • 4455
                    • 76 Posts
                    I found that what worked best for me (and perhaps for your non-tech editor) was to turn off the RTE and have no html at all in the FAQ content document other than

                    to split paragraphs withing an answer, when necessary. All the other styling can be done in the .CSS file.

                    That would work, I might give it a go in my own builds.

                    In this particular case I’m contracting for another web company. Turning of the RTE is not an option I’m afraid.

                    So far opening the paragraph tag within the snippet seems to be working OK, with no unexpected issues. I’ll let you know if something goes wrong with it.

                    Quote from: sottwell at Jul 07, 2008, 05:27 AM

                    You are being a genuine member of the MODx community. grin grin

                    We encourage bug findings and fixes, especially in "corner cases" that may not ever be exposed under ordinary use. Every snippet eventually gets used in ways not expected by the original authors, and as long as the bugs get reported (preferably with the fix!) the snippets get updated and improved.

                    Cheers, glad to help, I’ve actually got a template in the works (for my own site) that I’ll be uploading to the template section, hopefully it won’t be too long away, gotta take care of the paid work first wink
                      • 4749
                      • 623 Posts
                      Hey Bob,
                      I was wondering if you had a chance to look at the files I attached in my earlier post. Thanks for all your help so far.


                        The MODx has you...
                        Utah Web Design