Page 1 of 1

How to make PiFaq show all questions/answers onload instead of clicking each

Posted: Sun Sep 17, 2006 7:26 pm
by kwansan
Hi,

I am not sure if this is possible.  I am using PiFaq on a new client's site and they are requesting that PiFaq shows all Q&A when the page loads instead of clicking each section or question to view the answers.  Is this possible by adding something to {cms_module module="Pifaq" } like {cms_module module="Pifaq" show_catagory="All"}

I looked at the source code to see if I can modify it to fit my client's request.  Not sure where to begin.  I have limited php knowledge (enough to be dangerous) and I do not speak German.  Wondering if anyone else have already done this or if someone could give me a quick pointer.  Thank you in advance.

Re: How to make PiFaq show all questions/answers onload instead of clicking each

Posted: Sun Sep 17, 2006 7:33 pm
by Dr.CSS
Have you looked at the 'Help" section of the module?
Extensions » Modules the word Help to the right, or the name of the module in newer Ver., click it and you get the Help for that module.

Re: How to make PiFaq show all questions/answers onload instead of clicking each

Posted: Sun Sep 17, 2006 7:52 pm
by kwansan
Hi Mark,

You've always help me so much since I joined cms ms.  :)  I have looked under Help in PiFaq module and it does not have that answer.  But I poked around with the code and got it to do what I need.  Below are the lines I deleted from PiFaq to show all catagories, questions the answers when the page loads.  It is the last function named function UserDisplay.  I just removed some of the if and else statements.  The original code if catagory= than display something else display question.  Etc.  By removing this if/else it displays all questions and answers when page loads. 

Original piratos code

Code: Select all

if ($kategorie_id == $kategorie['kategorie_id'])
                   {
                     while  ($row = $rs->FetchRow())
                     {
                        if ($row['faq_id'] <> $faq_id)
                        {
                         $default_link = $this->CreateLink($id, 'default', $returnid, $contents=$row['frage'], $params=array('kategorie_id'=>$kategorie['kategorie_id'],'faq_id'=>$row['faq_id'],'language'=>$this->language,'all'=>$all,'class'=>'showpifaq_f_link','katname'=>$katname));

                         $out .='<div class="showpifaq_simplelink">'."\n".$default_link."\n</div>";
                        }else

                          $out .='<div class="showpifaq_frage">'."\n".stripslashes($row['frage']).'</div>'."\n".'<div class="showpifaq_antwort">'."\n".stripslashes($row['antwort']).'</div>'."<br />\n";
                        }  // if

                     }  //while

		   }  //if
I removed opening

Code: Select all

 if ($kategorie_id == $kategorie['kategorie_id'])"
lines 581-582

Code: Select all

if ($row['faq_id'] <> $faq_id)
lines 585-586

Code: Select all

}else
line 590 and the matching closing if 593.  I think that was all.  Below is what it looks like with those removed

Code: Select all

  while  ($row = $rs->FetchRow())
                     {
                         $default_link = $this->CreateLink($id, 'default', $returnid, $contents=$row['frage'], $params=array('kategorie_id'=>$kategorie['kategorie_id'],'faq_id'=>$row['faq_id'],'language'=>$this->language,'all'=>$all,'class'=>'showpifaq_f_link','katname'=>$katname));

                         $out .='<div class="showpifaq_simplelink">'."\n".$default_link."\n</div>";


                          $out .='<div class="showpifaq_frage">'."\n".stripslashes($row['frage']).'</div>'."\n".'<div class="showpifaq_antwort">'."\n".stripslashes($row['antwort']).'</div>'."<br />\n";


                     }  //while
I need to tinker with it further to get it exactly the way I need it.  However, it was a start.  Mark I have another post under layouts about niftycorners/niftycubes.  You helped me before and now I am having a strange problem with it.  I don't want to double post but if you have time can you see my original post here http://forum.cmsmadesimple.org/index.ph ... 912.0.html

No one knows niftycubes like you do.  :)

Thanks again.