msaunders Posted December 22, 2011 Share Posted December 22, 2011 Apologies if this has already been posted . I want to use a custom pagetitle for my homepage.tpl I know for custom pages I can use $pagetitle = $_LANG['customtitle']; at the top of the custom page index.php but how do I change the page title for the homepage etc . I don't want 'Portal Home' I want to use our own titles for SEO . I checked this http://docs.whmcs.com/Seo but I dont think its giving me what i want. Cheers. Martin 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted December 22, 2011 Share Posted December 22, 2011 (edited) A bit of a hack, but you could add something like this to the very top of your header.tpl: {if $pagetitle eq 'Portal Home'} {assign var='pagetitle' value='Custom Value Here'} {/if} Completely untested, but it should work. EDIT: Oh, you might want to change the var name here. $pagetitle is used in other places besides just the <title> section. Maybe something like this would be better. {if $pagetitle eq 'Portal Home'} {assign var='realpagetitle' value='Custom Value Here'} {else} {assign var='realpagetitle' value=$pagetitle} {/if} Then modify the <title> section in header.tpl to reference $realpagetitle. [/code] Edited December 22, 2011 by laszlof 0 Quote Link to comment Share on other sites More sharing options...
msaunders Posted December 23, 2011 Author Share Posted December 23, 2011 Hi Frank Thanks , that probably will work but that means then I will have to use that variable $realpagetitle for everything if I change it in the header.tpl ? Wont that mean that other WHMCS coded pages wont show any page title ? 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted December 23, 2011 Share Posted December 23, 2011 No, the point of changing the variable to something else is so it doesn't get updated on other pages. If you look at header.tpl, there are 2 places where it references pagetitle. <title>{$companyname} - {$pagetitle}{if $kbarticle.title} - {$kbarticle.title}{/if}</title> <div id="content_left"> <h1>{$pagetitle}</h1> <p class="breadcrumb">{$breadcrumbnav}</p> For this, you really only want to update the <title> on the page, not the header that is defined in the second example. For this, we simply use $realpagetitle in the <title> element. If its on the Portal Home page, we're going to change it to something custom, if not, $realpagetitle will equal $pagetitle. $pagetitle never actually gets changed, so it wont affect the display of any other pages that may reference that variable. 0 Quote Link to comment Share on other sites More sharing options...
msaunders Posted December 23, 2011 Author Share Posted December 23, 2011 Gotcha ! Thanks Frank , Merry Christmas ! 0 Quote Link to comment Share on other sites More sharing options...
carltonsent Posted April 29, 2012 Share Posted April 29, 2012 I found another way that worked for me. You just have to add it to the language file. I too want to change portal home so I added a custom name line in language file like so Before: $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a>'; so i looked for globalsystemname in language file and sure enough in said this: $_LANG['globalsystemname'] = "Portal Home"; AFTER so I added a line like so: $_LANG['globalsystemnamehome'] = "Home"; and changed the line in the newpage.php like so: $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemnamehome'].'</a>'; now it says "Home" instead of "Portal Home" 1 Quote Link to comment Share on other sites More sharing options...
esjakshie Posted September 9, 2021 Share Posted September 9, 2021 (edited) On 4/29/2012 at 3:53 PM, carltonsent said: I found another way that worked for me. You just have to add it to the language file. I too want to change portal home so I added a custom name line in language file like so Before: $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemname'].'</a>'; so i looked for globalsystemname in language file and sure enough in said this: $_LANG['globalsystemname'] = "Portal Home"; AFTER so I added a line like so: $_LANG['globalsystemnamehome'] = "Home"; and changed the line in the newpage.php like so: $breadcrumbnav = '<a href="index.php">'.$_LANG['globalsystemnamehome'].'</a>'; now it says "Home" instead of "Portal Home" This is the right way, I only want to add, that you need to copy the english.php file in the /public_html/whmcs/lang/ folder to a subfolder /public_html/whmcs/lang/overrides/ folder and make the changes you wish for any text in WHMCS in that english.php file (or only add the variables you would like to change). The reason is that you would otherwise loose those edits when updates are made to WHMCS. The /public_html/whmcs/lang/overrides/ folder is also the folder where you would create custom languages that do no currently exist in WHMCS. For more info see https://developers.whmcs.com/languages/overrides/ Edited September 9, 2021 by esjakshie 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.