Convergence Posted April 10, 2010 Share Posted April 10, 2010 Greetings, Looking to add the knowledge base title to the browser title so the title reads: Knowledgebase - Category - Article Title Thanks! 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted April 11, 2010 Share Posted April 11, 2010 (edited) here is a start for you... change your title tag in your header.tpl to this <title>{if $kbarticle.title}{$pagetitle} - {$kbarticle.title}{else}{$companyname} - {$pagetitle}{/if}</title> Edited April 11, 2010 by sparky 0 Quote Link to comment Share on other sites More sharing options...
sgrayban Posted April 11, 2010 Share Posted April 11, 2010 retracted -- sparky says you can 0 Quote Link to comment Share on other sites More sharing options...
sgrayban Posted April 11, 2010 Share Posted April 11, 2010 I just figured out how to do this. It's pretty easy to do. Open your header.tpl and at the top before <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> add {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 edit your <title> to be <title>{$companyname} - {$pagetitle} {if $categoryname} - {$categoryname}{/if}{if $kbarticle.title} - {$kbarticle.title}{/if}</title> This took me about 10 minutes to figure out from a previous posting that m00 gave. 0 Quote Link to comment Share on other sites More sharing options...
Convergence Posted April 11, 2010 Author Share Posted April 11, 2010 (edited) Thanks! Getting closer, but not quite there... <title>{$companyname} - {$pagetitle} {if $categoryname} - {$categoryname}{/if}{if $kbarticle.title} - {$kbarticle.title}{/if}</title> Does put the Category in the title: <title>DomainName.ext - Knowledgebase - Billing</title> When someone clicks on: DomainName.ext/whmcs/knowledgebase/2/Billing However, When someone clicks on an article, the title reads: <title>DomainName.ext - Knowledgebase - Will my credit card statement show DomainName.ext?</title> I'd like it to show: <title>DomainName.ext - Knowledgebase - Billing - Will my credit card statement show DomainName.ext?</title> Where the Category Name is inserted between "Knowledgebase" and "Article". Any suggestions and thanks again! PS: Thanks sparky, but your suggestion did not work for me. Edited April 11, 2010 by Convergence 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted April 11, 2010 Share Posted April 11, 2010 Hi there. Try this code in top of you header.tpl file: {php} if($_GET['action'] == "displaycat" OR $_GET['action'] == "displayarticle") { if(is_numeric($_GET['catid'])) $catid = $_GET['catid']; elseif(is_numeric($_GET['id'])) $catid = $this->_tpl_vars['kbarticle']['categoryid']; $result = full_query("SELECT name FROM tblknowledgebasecats WHERE id = '" . sanitize($catid) . "' LIMIT 1;"); $data = mysql_fetch_array($result); $this->assign('categoryname', $data['name']); } {/php} 0 Quote Link to comment Share on other sites More sharing options...
Convergence Posted April 11, 2010 Author Share Posted April 11, 2010 BINGO! We have a winner! Thanks m00 and everyone else who responded! 0 Quote Link to comment Share on other sites More sharing options...
sgrayban Posted April 11, 2010 Share Posted April 11, 2010 damn and i was so close 0 Quote Link to comment Share on other sites More sharing options...
Convergence Posted April 11, 2010 Author Share Posted April 11, 2010 here is a start for you... change your title tag in your header.tpl to this damn and i was so close Yes, you were, bravo! For the life of me I couldn't figure out how to get the database involved to pull the category. Thanks again to everyone for their great efforts! 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.