如何在WHMCS自定义页面中加入文章?

问题描述 投票:0回答:1

我想创建一个WHMCS自定义页面,然后在这个页面中包含一个指定的文章,这可能吗?

我已经通过以下方式创建了自定义页面 公文但我不知道如何收录文章。

任何帮助,先谢谢了

whmcs
1个回答
0
投票

您的模板 :

<!-- C:\xampp\htdocs\my\templates\redo\my_page.tpl-->
{foreach $arr as $elem}
<div>{$elem.title}</div>
<div>{$elem.article}</div>
<div>{$elem.views}</div>
{/foreach}

您的页面 。

<?php
// file : ROOTDIR / my_page.php
use WHMCS\ClientArea;
use WHMCS\Database\Capsule;

define('CLIENTAREA', true);

require_once  __DIR__ . '/init.php';
require_once(ROOTDIR . '/includes/dbfunctions.php');
//require_once(ROOTDIR . '/includes/functions.php');
//require_once(ROOTDIR . '/includes/clientfunctions.php');
//require_once(ROOTDIR . '/includes/modulefunctions.php');

$ca = new ClientArea();
$ca->setPageTitle('My Page');
$ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname'));
$ca->addToBreadCrumb('my_page.php', 'This is my page');
$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.

$knowledgebase=array();
//https://developers.whmcs.com/advanced/db-interaction/
//$res=select_query('tblknowledgebase','*',array());
$res=full_query('SELECT * FROM tblknowledgebase');
while($data=mysql_fetch_array($res))
{
    $knowledgebase[]=$data;
    var_dump($data);
}
// You must write   
//tblknowledgebase , tblknowledgebasecats , tblknowledgebaselinks , tblknowledgebasetags
file_put_contents("C:/xampp/htdocs/my_website/sss.txt",var_export($knowledgebase,true),FILE_APPEND);

$ca->assign('arr', $knowledgebase); // $arr will be used in template.
$ca->assign('pagetype',redo);
// Check login status
//Menu::addContext();
$ca->setTemplate('my_page'); // without .tpl
$ca->output();
 ?>
© www.soinside.com 2019 - 2024. All rights reserved.