WHMCS技巧:首页标题

2019年6月4日 | 分类: 【技术】

WHMCS默认模板下的首页标题有点尴尬。

参考:https://www.hostloc.com/thread-355185-1-1.html

编辑:WHMCS/templates/six/header.tpl

<head>
    <meta charset="{$charset}" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
    {include file="$template/includes/head.tpl"}
    {$headoutput}
</head>

修改为:

{if $templatefile == 'homepage'}
<head>
	<meta charset="{$charset}" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$companyname}</title>
	{include file="$template/includes/head.tpl"}
	{$headoutput}
</head>
{elseif $templatefile != 'homepage'}
<head>
	<meta charset="{$charset}" />
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>{if $kbarticle.title}{$kbarticle.title} - {/if}{$pagetitle} - {$companyname}</title>
	{include file="$template/includes/head.tpl"}
	{$headoutput}
</head>
{/if}

新代码加了一个判断,如果是首页,则A标题组合模式;如果不是首页,则B标题组合模式。