Page 1 of 1

[RP] {FAQ_LIST} - List FAQ items to jump inside the site

Posted: Thu 1. Feb 2007, 17:12
by marcus@localhorst
Hello friends,

here I will post a simple Replacement Tag to generate a List of FAQ items (if you use the new Contentpart FAQ on your site).
No magic here and maybe this will be implemented by oliver g. in future?!
I need that now and so, I wrote it.

PLEASE NOTICE: This is experimental and without guarantee!!

drop the following code into your frontend_render folder and place the {FAQ_LIST} in a CP in your FAQ Article, that's all.

Code: Select all

// RP: {FAQ_LIST} v. 0.1 beta carotin
// by marcus@localhorst
// 01.02.2007 16:52:13
// Info: If you use the new Contenpart FAQ you can place the Tag {FAQ_LIST} above your
// FAQ Article and it will print a List with anchors to your FAQ CPs
// use the ul.faqList class to style the list

// -----------------------------------------------------------------------------
function show_faq_list($id, $db)
{
   $CNT_TMP = '';      
   $sql =  "SELECT * " .
           "FROM " . DB_PREPEND . "phpwcms_articlecontent " .
           "WHERE acontent_aid = " . $id . " " .
           "AND acontent_type = 27 ". // this is the ID for FAQ CP
           "AND acontent_visible = 1 " .
           "AND acontent_trash = 0 " .
           "ORDER BY acontent_sorting, acontent_id;";
           
   
  // echo $sql;       
   if($cresult = mysql_query($sql, $db) or die("error retrieving article from database"))
   {
      while($crow = mysql_fetch_array($cresult))
      
      {
         
       $CNT_TMP .= "<li><a href=\"#faq_id".$crow["acontent_id"]."\">".$crow["acontent_text"]."</a></li>"; 
         
      }
      
     $CNT_TMP= "<ul class=\"faqList\">".$CNT_TMP."</ul>";
   
   }
   return $CNT_TMP;
}

if( ! ( strpos($content["all"],'{FAQ_LIST}')===false ) )
{

   $content["all"] = preg_replace('#\{FAQ_LIST\}#ie', 'show_faq_list($GLOBALS[content][article_id], $db)', $content["all"]);
}
Frontend
Image
Backend
Image

best marcus

Re: [RP] {FAQ_LIST} - List FAQ items to jump inside the site

Posted: Tue 30. Jun 2009, 13:20
by indyone_de
Hello,

is there any update for this add on? I am afraid not. I just tried it and it doesn't work with R307, unfortunately. :(


Cheers indyone_de