Jump to content
Sign in to follow this  
msaunders

custom pagetitle

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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 ?

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

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"

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

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