We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24981
    • 109 Posts
    From this thread http://modxcms.com/forums/index.php/topic,1372.0.html

    NeatFAQ is an Etomite snippet, isn’t it ?
    Does it needs modification for use with MODx and if so, do you plan to make it available (Googled the forums didn’t find it) ?

    Yep NeatFAQ is an Etomite snippet.  I didn’t modify at all, and it runs fine except when you tick to open all FAQs, the first FAQ stays closed. see http://www.mail2grow.com/help-tips-faqs.htm for example

    Don’t have the skill to de-bug myself, but want to get this fixed, as its a very simple alternative for single category FAQs.  Happy to do some testing if anyone wants to look at the bug, then we can put it into the modX Repository...

    Richard
      • 10487 MODX Staff
      • 1,535 Posts
      Hi Richard,

      Just had a quick glance as I might have a use for this soon, the checkbox problem can be rectified by changing the following lines in the snippet:

      $javascript .= 'for(var j=1; j<=secCount; j++)'."\n";
      $javascript .= '{'."\n";
      $javascript .= 'for (var i=1; i<=faqEntryCount; i++)'."\n";


      to:

      $javascript .= 'for(var j=0; j<=secCount; j++)'."\n";
      $javascript .= '{'."\n";
      $javascript .= 'for (var i=0; i<=faqEntryCount; i++)'."\n";


      Basically, loops should start from 0 and not 1, which is why the first title is never expanded.

      Hope that helps, Garry
        Garry Nutting
        Senior Developer
        MODX, LLC

        Email: [email protected]
        Twitter: @garryn
        Web: modx.com
        • 6726
        • 7,075 Posts
        Did you miss the ListFaqFolder snippet from Aour ?

        Or does the NeatFAQ snippet have additionnal features ?
          .: COO - Commerce Guys - Community Driven Innovation :.


          MODx est l&#39;outil id
          • 28042 ☆ A M B ☆
          • 24,524 Posts
          I’ve been using this one for ages...

          //[[FAQ?faqFolder=foldernumber]]
          //Replace foldernumber with the id of the folder
          //Page title is displayed as the question and content is the answer.
          //The question is in a CSS class "faq" 
          
          $resourceparent = isset($faqFolder) ? $faqFolder : $modx->documentIdentifier;
          $output = "<script type="text/javascript">
          function expand(thistag) {
             styleObj = document.getElementById(thistag).style;
             if (styleObj.display=='none') {styleObj.display = '';}
             else {styleObj.display = 'none';}
          }
          </script>";
          $faq = $modx->getActiveChildren($faqFolder,'pagetitle', 'ASC', $fields=' id, pagetitle, content');
          $limit=count($faq);
          if($limit<1) { 
             $output .= 'No Questions Found<br />'; 
          } 
          for ($y = 0; $y < $limit; $y++) {
          $output .= '<div onclick="expand(''.$faq[$y]['id'].'');" style="cursor:pointer;"><div class="faq">'.$faq[$y]['pagetitle'].'</div><div class="pop" id="'.$faq[$y]['id'].'"  style="display:none">'.$faq[$y]['content'].'</div></div><br />';
          }
          return $output;


          I just use CSS to position the pop-out where I want it if a simple drop-down isn’t enough.
            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
            • 1764
            • 680 Posts
            moo.fx has a great and very easy to use accordian feature that would make something like this very simple to do I’d think.

            They use the accordian on their homepage (http://moofx.mad4milk.net/). It would only keep one open at a time by default but I kinda think that’s nice personally.
              • 6726
              • 7,075 Posts
              Quote from: sottwell at Feb 23, 2006, 07:05 AM
              I’ve been using this one for ages...

              @Susan : I think it’s the one that Aour improve with ListFaqFolder...

              @Adam : About the moofx thing, great idea !
                .: COO - Commerce Guys - Community Driven Innovation :.


                MODx est l&#39;outil id
                • 1876
                • 835 Posts
                Hi,

                In ListFaqFolder you do not have javascript be cause I don’t want to use javascript. So it impossible to expand answser for example.
                You have only a static list of Q/A

                It’s like Lore but I need to add some functionnality.

                  • 28042 ☆ A M B ☆
                  • 24,524 Posts
                  Actually, you can do it with CSS alone, if you use a :hover pseudoclass, it’s just a variation on styling for drop-down menus.

                  This works in FF, I haven’t gotten around to fixing it to work with IE yet (it should just be a matter of including the assets/js/csshover.htc in an IE conditional in the template head).

                  http://www.alandaniel.co.uk/index.html&template=Swan

                  mouse over the list on the upper right.

                  /**** PopupList **************************
                  *  Snippet for MODx
                  *  Generates a simple list menu
                  *  with the title of the document
                  *  as the menu item
                  *  and the document's content
                  *  in a <p> container suitable for
                  *  a CSS-managed popup system.
                  *
                  *  Created 26.10.2005
                  *  [email protected]
                  *  License: GPL
                  *
                  *  Parameters:
                  *    id - the ID of the folder 
                  *    containing the documents to list
                  *
                  *  Usage:
                  *    [[PopupList?id=x]]
                  *****************************************/
                  if(!isset($id)) return;
                  $children = $modx->getActiveChildren($id,'menuindex','ASC','pagetitle, content');
                  if($children == false) return;
                  $list = '<ul id="popupList">';
                  foreach($children as $child) {
                    $list .= '<li class="item"><div class="title">'.$child['pagetitle'].'<div class="content">'.$child['content'].'</div></div></li>';
                  }
                  $list .= '</ul>';
                  return $list;
                  


                  and the CSS

                  #popupList{
                  list-style:none;
                  }
                  #popupList div.title{
                  padding:3px; 
                  color: #FFF;
                  margin:3px 0;
                  cursor:pointer;
                  }
                  #popupList li div.content{
                  display: none;
                  }
                  #popupList li:hover div.content{
                  display:block;
                  position: absolute; 
                  top: 170px; 
                  right:290px; 
                  padding:10px;
                  width: 280px;
                  z-index: 100;
                  color: #193E58; 
                  background: #d1d1d3; 
                  border: 1px solid #FFF;
                  font-family:Arial, Helvetica, sans-serif; 
                  font-size:12px;
                  }

                    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
                    • 32241
                    • 1,495 Posts
                    I think newslisting is powerful enough to take on this project, don’t you guys think so?
                      Wendy Novianto
                      [font=Verdana]PT DJAMOER Technology Media
                      [font=Verdana]Xituz Media
                      • 24981
                      • 109 Posts
                      Hi,

                      I think the Aour version is great! I just don’t need categories for a simple list, and I like the JS fold-outs smiley NeatFAQ fits the bill for a simple list.

                      Richard