Jump to content

Showing of Category Name in Knowledge Base


anutosh

Recommended Posts

Hi,

 

I am currently using the latest version 4.2.1.

 

In the Knowledge Base of my website, I am currently able to see a list of categories & articles. Now when I click a particular category, a list of all articles under this category opens in another page (whose template file is "knowledgebasecat.tpl").

 

Here in this page, I want to modify the header text from "Articles" to "Articles of CategoryName", i.e., I want to have the template variable for the Category Name.

 

However, since the corresponding PHP page is encrypted, so I am having no luck in it.

 

Can anybody please help me?

If any more information, please let me know.

Any help about this issue is greatly appreciated.

 

_______________

Thanks & Regards,

Anutosh

Link to comment
Share on other sites

Not available by default, but you can use this as workaround. Place the following code in top of your knowledgebasecat.tpl:

{php}
$result = full_query("SELECT name FROM tblknowledgebasecats WHERE id = '" . sanitize($_GET['catid']) . "' LIMIT 1;"); 
$data 	= mysql_fetch_array($result);

$this->assign('categoryname', $data['name']);
{/php}

Now you can use {$categoryname} to show the name of the selected category.

Edited by m00
Link to comment
Share on other sites

  • 2 weeks later...
This also works:

 

{php}
$this->assign('categoryname', $GLOBALS['catname']);
{/php}

 

If one is to use this quoted code (mentioned above), then he needs to have some value in $GLOBALS['catname']; otherwise when only the category ID is available, then I think the code of the user "m00" is correct.

 

Nevertheless, the efficient coding is the most suitable to use. And anybody is free here to post the relevant efficient coding so as to help others.

 

_______________

Thanks & Regards,

Anutosh

Link to comment
Share on other sites

Hi Anutosh

 

You're right - $GLOBALS['catname'] needs to have a value for it to work.

 

However on both the KB category and KB article pages this value is set to the corresponding category name so will work. These are the only two pages this variable is really useful for anyway ;)

 

Myself (and others) have asked WHMCS to add category name to the smarty variables for KB pages so we no longer have to implement our own work arounds. Hopefully the next release will fix this...

 

Regards

- Wife of kurieuo

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated