Limit display of last FAQ

Hey ...

Is there a way to to limit the "Siste spørsmål/Last FAQ" to for example 5 or 10 in customer center online ?

I dont want to start making new tables and other cuztomizations.

RE: Limit display of last FAQ

Hi,

Unfortunately there is no option for specifying any limit without writing your own code for printing this, similar to how "old" customer center faq listing was implemented. 

Snippet for how it used to look to give you inspiration:

       <div class='rightBar'>
         <div class='box'>
         <div class='searchDiv'>
           <input class='smartField faqSearcherGlobal' type='text' name='searchString' id='faqSearchString' alt='%lang("lang_customer_framework_faq_search")%' value=''/><img src='%WwwRoot%graphics/SevenCustomer/search.png' alt='Search' />
         </div>
         
         <h3>%lang("lang_customer_framework_faq_top")%</h3>
%EJSCRIPT_START%
<%
  String action = getCgiVariable("action");
  String kbRoot;
  String kbRootName;

  String lang = getParserVariable("GfxPath").afterLast("/").toLower();

  Void doKbRoot()
  {
    if (action == "viewKbCategory")
    {
      kbRoot = getCgiVariable("id");          
    }

    if (kbRoot == "")
    {

      SearchEngine se;
      se.addField("cust_lang.kb_root");
      se.addField("cust_lang.kb_root.fullname");
      se.addCriteria("cust_lang.lang_code", "OperatorEquals", lang, "OperatorAnd", 0);
      if (se.select() > 0)
      {
        kbRoot = se.getField(0);
        kbRootName = se.getField(1);
      }     
    }
  }

  doKbRoot();

  Integer accessLevel = 4;
  if (getParserVariable("authenticated") == "true")
    accessLevel = 3;
    
  SearchEngine se;
  se.addField("kb_entry.id");
  se.addField("kb_entry.title");
  se.addField("kb_entry.question");
  se.addCriteria("kb_entry.workflow_phase", "OperatorEquals", "-2", "OperatorAnd", 0);
  se.addCriteria("kb_entry.access_level", "OperatorGte", accessLevel.toString(), "OperatorAnd", 0);

  if (kbRootName != "")
  {
    se.addCriteria("kb_entry.category_id.fullname", "OperatorEquals", kbRootName, "OperatorOr", 1);
    se.addCriteria("kb_entry.category_id.fullname", "OperatorBeginsWith", kbRootName + "/", "OperatorAnd", 1);
  }
  
  se.setLimit(3);  
  se.addOrder("kb_entry.score", false);

  print("<ul id='faqTopList'>");
  for (se.select(); !se.eof(); se.next())
  {
    print("<li><a title='" + htmlConvToText(se.getField("kb_entry.question")).substitute("\'", "\"").stripLeadingAndTrailing("\n\t ").xmlEncode()  + 
    "' href='" + getParserVariable("AuthProgram") + "&action=viewKbEntry&id=" + se.getField(0) + "'>" + htmlConvToText(se.getField("kb_entry.question")).stripLeadingAndTrailing("\n\t ").prettyChop(50).xmlEncode() + "</a></li>\n");
  }
  print("</ul>\n");
%>
<ul id="faqSearchResultList" class='hidden'></ul>
<div id='faqLoadingImg' class='hidden' style='text-align: center; margin-top: 17px;'> <img src='<% print(getParserVariable("WwwRoot")); %>graphics/SevenCustomer/loading.gif' /></div>
</div>
<div class='box'> 
  <h3>Newest FAQ</h3>
  <%
  SearchEngine se1;
  se1.addField("kb_entry.id");
  se1.addField("kb_entry.title");
  se1.addField("kb_entry.question");
  se1.addField("kb_entry.last_changed");
  
  se1.addCriteria("kb_entry.workflow_phase", "OperatorEquals", "-2", "OperatorAnd", 0);
  se1.addCriteria("kb_entry.access_level", "OperatorGte", accessLevel.toString(), "OperatorAnd", 0);
  if (kbRootName != "")
  {
    se.addCriteria("kb_entry.category_id.fullname", "OperatorEquals", kbRootName, "OperatorOr", 1);
    se.addCriteria("kb_entry.category_id.fullname", "OperatorBeginsWith", kbRootName + "/", "OperatorAnd", 1);
  }
  se1.setLimit(4);
  se1.addOrder("kb_entry.last_changed", false);
  print("<ul>");
  for (se1.select(); !se1.eof(); se1.next())
  {
    print("<li><a title='" + htmlConvToText(se1.getField("kb_entry.question")).substitute("\'", "\"").stripLeadingAndTrailing("\n\t ").xmlEncode() + "' href='" + getParserVariable("AuthProgram") + "?action=viewKbEntry&id=" + se1.getField("kb_entry.id") + "'><span class='date'>" + se1.getField("kb_entry.last_changed").toDate().toString() + "</span>&nbsp;" + htmlConvToText(se1.getField("kb_entry.question")).stripLeadingAndTrailing("\n\t ").prettyChop(30).xmlEncode() + "</a></li>\n");
  }
  print("</ul>\n");

  %>
</div>
By: Michel Krohn-Dale 10 Jun 2020

RE: Limit display of last FAQ

Found a workaround for limiting max number of rows in a list by adding this in the CSS code: 

    li:nth-of-type(1n+11) {
        display: none;
        }
By: Ummair Tahir 11 Jun 2020