• 本帖最后由 Jetso 于 2014-7-22 12:36 编辑 *

首先在WHMCS主目录创建一个新的PHP文件

  • vim /yourwhmcsdir/文件名.php复制代码

输入下方php代码 (官方提供的代码, 传送门: http://docs.whmcs.com/Creating_Pages)

  • setPageTitle("页面标题");
  • - $ca->addToBreadCrumb('index.php',$whmcs->get_lang('globalsystemname'));
  • $ca->addToBreadCrumb('文件名.php','自定义模板页面名称');
  • - $ca->initPage();
  • - //$ca->requireLogin(); // Uncomment this line to require a login to access this page
  • - # To assign variables to the template system use the following syntax.
  • # These can then be referenced using {$variablename} in the template.
  • - $ca->assign('variablename', $value);
  • - # Check login status
  • if ($ca->isLoggedIn()) {
  • - # User is logged in - put any code you like here
  • - # Here's an example to get the currently logged in clients first name
  • - $result = mysql_query("SELECT firstname FROM tblclients WHERE id=".$ca->getUserID());
  • $data = mysql_fetch_array($result);
  • $clientname = $data[0];
  • - $ca->assign('clientname', $clientname);
  • - } else {
  • - # User is not logged in
  • - }
  • - # Define the template filename to be used without the .tpl extension
  • - $ca->setTemplate('当前主题文件夹名称');
  • - $ca->output();
  • - ?>复制代码

按一下esc退出编辑模式然后按住Shift不放再按两下zz就可以保存了。

接下来在当前模板目录创建tpl文件

  • vim /yourwhmcsdir/templates/当前主题文件夹/自定义模板页面名称.tpl复制代码

输入自定义php页面代码

  • {include file="$template/pageheader.tpl" title=页面名称}
  • 自定义php页面代码
  • 自定义php页面代码
  • 自定义php页面代码
  • 复制代码

最后按一下esc退出编辑模式然后按住Shift不放再按两下zz就可以保存了。
完!