Knowledgebase on Frontpage (like chess.com)

Discussion in 'Style and design' started by ron.defreitas, Feb 21, 2011.

  1. ron.defreitas

    ron.defreitas Member

    I noticed in the spotlight that Chess.com's support center ( http://support.chess.com/ ) skinning was featured, and in their support system they have the Knowledgebase as their front page with no recent news updates. Does anyone know offhand if this possible with only template modifications or is there something that needs to be modified on the code?

    Nevermind... I spoke with the guys at chess.com and they were glad to fill me in, they simply integrated their KB articles manually in the homeindex template rather than automatically through a module or code reference.

    If anyone knows how to make this happen automatically though, I'm sure I won't be the only one grateful.
     
  2. supportskins

    supportskins Kayako Guru

    I suppose this can be done using some simple PHP coding in the templates. Should not be that tough (provided you are not hosted with Kayako which does not allow you to use PHP codes in templates).
     
  3. ron.defreitas

    ron.defreitas Member

    Yeah, not hosted with Kayako, we're running our own installation. So you'd recommend writing up some php to access the mysql backend directly and pull out the categories and articles and drop that into the homeindex template?
     
  4. supportskins

    supportskins Kayako Guru

    Yes that would be the best way around to make it dynamic.
     
  5. ron.defreitas

    ron.defreitas Member

    I discovered another method actually...

    I made a copy of the __modules/Knowledgebase/class.Controller_List.php in the same folder and named it class.Controller_HomeIndex.php. I then modified the code in the new HomeIndex controller, had it reference a new template called "knowledgebasehomeindex" wherein I copied the knowledgebaselist template and added a welcome message, then added the following mod_rewrite rules (all of our urls are /index.php/whateverpath):

    Code:
    # Rewriting HOME Requests to new KB Controller
    RewriteCond %{QUERY_STRING} ^$
    RewriteRule ^/index.php$   /index.php?/Knowledgebase/HomeIndex 
    RewriteRule ^/$   /index.php?/Knowledgebase/HomeIndex [L]
    RewriteRule ^/index.php/Core/Default/Index$ /index.php?/Knowledgebase/HomeIndex [L]
    RewriteRule ^/index.php/$ /index.php?/Knowledgebase/HomeIndex [L]
    This way the new controller can be easily updated for new builds without having to rehack Kayako code all the time, and without having to write out all of the mysql code for the homeindex.
     
  6. ron.defreitas

    ron.defreitas Member

  7. Dario Spadaro

    Dario Spadaro New Member

    Hi All,

    I would like to do the same for our helpdesk. We've been able to do that inside v3, so I wish to be able to do the same into v4.

    I'm trying to follow Ron's alternative method but I don't know how to reference to the new template as described.

    I read it's possible to add php code inside the template but I'm looking for a way which doesn't get me crazy everytime I have to update the whole system.

    Any help would be appreciated.

    Thanks in advance and Best Regards.
     
  8. Dario Spadaro

    Dario Spadaro New Member

    [update]

    After a further read, I acknowledged that this method shows "Knowledgebase" as "Home Page". This is not what I'm trying to do. I just want to show latest and most popular articles into home page, together with the news. Everytime I try to show them inside home, I get "undefined index" notices. I even tried to put the entire class of "class.Controller_List.php" under "__modules/knowledgebase/client/" inside "class.Controller_client.php" under "__swift/library/Controllers" resulting in the same notice.
     
  9. Lubos Lagin

    Lubos Lagin New Member

    Hello, guys. I figured that out after few hours of thinking and trying to beat core of Kayako.
    If you does not matter of one more request on that page, you can load this from Knowledgebase, of course if you have it allowed in admin.
    All you need is loaded jQuery and one tools.js (or whatever) file included in header and in that file 1(3) line(s) of code.
    PHP:
    if($("#kb-articles").length 0) {
      $(
    "#kb-articles").load("/eng/Knowledgebase/List #kb-articles");
    }
    Note: That code is JS, not PHP. ;) And of course, you have to add div placeholders in Templates. But all of that you can do, only by editing Templates and writing few lines of code.
     
  10. bs01

    bs01 Established Member

    I tried your Javascript solution as I am also trying to get the knowledgebase block onto the front page, but it doesn't seem to work. What DIV placeholders did you add to your tremplate?
     
  11. Lubos Lagin

    Lubos Lagin New Member

    In your knowledgebaselist template wrap needed area by div with
    HTML:
    <div id="kb-articles">
                    <{if $_knowledgebaseCategoryID == 0 && $_showEmptyViewWarning == false}>
                    <table cellpadding="0" cellspacing="0" width="100%" border="0">
                    <tr>
                    <{if $_settings[kb_enpopulararticles] == '1'}>
                    <td width="50%" align="left" valign="top"><div class="kbrightstrip">
                    <table class="hlineheader hlinegray"><tr><th rowspan="2" nowrap><{$_language[mostpopular]}></th><td>&nbsp;</td></tr><tr><td class="hlinelower">&nbsp;</td></tr></table>
                    </div>
                    <ol>
                    <{foreach key=_kbArticleID item=_knowledgebaseArticle from=$_knowledgebaseArticleContainer_Popular}>
                    <li class="kbarticlelist">
                    <div class="kbarticlelistitem"><a href="<{$_baseName}><{$_templateGroupPrefix}>/Knowledgebase/Article/View/<{$_knowledgebaseArticle[kbarticleid]}>/<{$_knowledgebaseCategoryID}>/<{$_knowledgebaseArticle[seosubject]}>"><{$_knowledgebaseArticle[subject]}></a></div>
                    </li>
                    <{/foreach}>
                    </ol>
                    </td>
                    <{/if}>
    
                    <{if $_settings[kb_enlatestarticles] == '1'}>
                    <td width="<{if $_settings[kb_enpopulararticles] == '1'}>50%<{else}>100%<{/if}>" align="left" valign="top">
                    <div><table class="hlineheader hlinegray"><tr><th rowspan="2" nowrap><{$_language[recentarticles]}></th><td>&nbsp;</td></tr><tr><td class="hlinelower">&nbsp;</td></tr></table></div>
                    <ol>
                    <{foreach key=_kbArticleID item=_knowledgebaseArticle from=$_knowledgebaseArticleContainer_Recent}>
                    <li class="kbarticlelist">
                    <div class="kbarticlelistitem"><a href="<{$_baseName}><{$_templateGroupPrefix}>/Knowledgebase/Article/View/<{$_knowledgebaseArticle[kbarticleid]}>/<{$_knowledgebaseCategoryID}>/<{$_knowledgebaseArticle[seosubject]}>"><{$_knowledgebaseArticle[subject]}></a></div>
                    </li>
                    <{/foreach}>
                    </ol>
                    </td>
                    <{/if}>
                    </tr>
                    </table>
                    <{/if}>
    </div>
    Then place on needed place <div id="kb-articles"></div> in homeindex template.

    Btw, you can change id of that divs to whatever. But you need to change it also in that JS code.
     
  12. bs01

    bs01 Established Member

    Thanks for that. I still can't get it to work but will investigate further.
     
  13. jlc

    jlc Established Member

    Ron,

    I was trying to follow your directions but seem a bit lost. Can you point me in the right path?

    This is what Ive done so far:
    1. Create HomeIndex directory (__modules/knowledgebase)
    2. Create knowledgebasehomeindex template in AdminCP and copy knowledgebaselist template code into it.
    3. Add your mod rewrite rules at the end of knowledgebasehomeindex
    4. Copy __modules/knowledgebase/client/class.Controller_List.php as class.Controller_HomeIndex.php
    5. Modified class.Controller_HomeIndex.php at the end of the script to point to knowledgebasehomeindex
    6. Did not know where to create the Welcome Message?

    Thanks!
     
  14. idlelimey

    idlelimey New Member

    I would have thought this would work without any extra effort but it tells me the indexes for popular and recent articles are undefined (when used on the indexhome page). At what point are these indexes defined as they work fine on the Knowledge-base index page?!
     
  15. Ben in CA

    Ben in CA Member

    I'm running Kayako Resolve v. 4.4, and I would like to put the Knowledgebase page content directly on the home page like on https://support.socketlabs.com/. What is the simplest way to do this?
     
  16. Chris Plapp

    Chris Plapp Established Member

    Is it possible to use Lubos' javascript example above and load a specific parent category of KB articles? For example, if I wanted to lump all of one templates articles under a folder, can I call that parent category so only the sub categories and articles would display on that given template?
     
  17. Chris Plapp

    Chris Plapp Established Member

    Could I also take Ron's example and create additional copies of the PHP file, and call specific templates to allow my satellite help desk sites to reference different main KB categories dynamically? Since I cannot hide parent KB categories from view on the client support site, this would be a nice hack to displaying different sub-categories in the KB per template, without having to show the main KB category they are underneath.
     
  18. Chris Plapp

    Chris Plapp Established Member

    Can someone confirm the proper steps to get this working using Lubos example? I have also tried to follow these steps, but it does not work.

    1. I wrapped the section of code from the knowledgebaselist in the div as Lubos suggested:
    2. Code:
      <div id="kb-articles">
                      <{if $_knowledgebaseCategoryID == 0 && $_showEmptyViewWarning == false}>
                      <table cellpadding="0" cellspacing="0" width="100%" border="0">
                      <tr>
                      <{if $_settings[kb_enpopulararticles] == '1'}>
                      <td width="50%" align="left" valign="top"><div class="kbrightstrip">
                      <table class="hlineheader hlinegray"><tr><th rowspan="2" nowrap><{$_language[mostpopular]}></th><td>&nbsp;</td></tr><tr><td class="hlinelower">&nbsp;</td></tr></table>
                      </div>
                      <ol>
                      <{foreach key=_kbArticleID item=_knowledgebaseArticle from=$_knowledgebaseArticleContainer_Popular}>
                      <li class="kbarticlelist">
                      <div class="kbarticlelistitem"><a href="<{$_baseName}><{$_templateGroupPrefix}>/Knowledgebase/Article/View/<{$_knowledgebaseArticle[kbarticleid]}>/<{$_knowledgebaseCategoryID}>/<{$_knowledgebaseArticle[seosubject]}>"><{$_knowledgebaseArticle[subject]}></a></div>
                      </li>
                      <{/foreach}>
                      </ol>
                      </td>
                      <{/if}>
       
                      <{if $_settings[kb_enlatestarticles] == '1'}>
                      <td width="<{if $_settings[kb_enpopulararticles] == '1'}>50%<{else}>100%<{/if}>" align="left" valign="top">
                      <div><table class="hlineheader hlinegray"><tr><th rowspan="2" nowrap><{$_language[recentarticles]}></th><td>&nbsp;</td></tr><tr><td class="hlinelower">&nbsp;</td></tr></table></div>
                      <ol>
                      <{foreach key=_kbArticleID item=_knowledgebaseArticle from=$_knowledgebaseArticleContainer_Recent}>
                      <li class="kbarticlelist">
                      <div class="kbarticlelistitem"><a href="<{$_baseName}><{$_templateGroupPrefix}>/Knowledgebase/Article/View/<{$_knowledgebaseArticle[kbarticleid]}>/<{$_knowledgebaseCategoryID}>/<{$_knowledgebaseArticle[seosubject]}>"><{$_knowledgebaseArticle[subject]}></a></div>
                      </li>
                      <{/foreach}>
                      </ol>
                      </td>
                      <{/if}>
                      </tr>
                      </table>
                      <{/if}>
      </div>
    3. I added the div to the header template:
      Code:
      <div id="kb-articles"></div>
    4. What else am I missing here? I tried to insert the JS code that was referenced above, but that did not work either. What am I missing here?
     
  19. masterctrl1

    masterctrl1 Kayako Guru

    Looks like you have the same problem we all do. :(
    Go to your help desk link.
    Note the default articles listed. One of those top articles has "Message ID" in the title.
    Search for "message ID" on your site.
    That article isn't even listed in the results at all, possibly because you have results limited to 6 entries.
    More importantly, the KB search is just plain broken in the current release.
    I sure hope this is fixed in 4.60 because sadly this means customers cannot find the content you write to help them.
     
  20. Chris Plapp

    Chris Plapp Established Member

    Kayako - please tell us this will be fixed!

    We also need a way to insert the Most Popular and Recently Added sections onto our support site homepages.
     

Share This Page