anutosh Posted March 25, 2010 Share Posted March 25, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted March 25, 2010 Share Posted March 25, 2010 (edited) 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 March 25, 2010 by m00 0 Quote Link to comment Share on other sites More sharing options...
anutosh Posted March 25, 2010 Author Share Posted March 25, 2010 Thanks "m00". Really this worked for me as a cake. Wow it is amazing to see now. Many thanks again. _______________ Thanks & Regards, Anutosh 0 Quote Link to comment Share on other sites More sharing options...
kurieuo Posted April 9, 2010 Share Posted April 9, 2010 This also works: {php} $this->assign('categoryname', $GLOBALS['catname']); {/php} 0 Quote Link to comment Share on other sites More sharing options...
anutosh Posted April 9, 2010 Author Share Posted April 9, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
kurieuo Posted April 14, 2010 Share Posted April 14, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.