Jump to content

custom pagetitle


msaunders

Recommended Posts

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

Link to comment
Share on other sites

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 by laszlof
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 4 months later...

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"

Link to comment
Share on other sites

  • 9 years later...
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 by esjakshie
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