【问题标题】:how to hook $service.id in whmcs (smarty)如何在 whmcs 中挂钩 $service.id (smarty)
【发布时间】:2015-08-04 10:17:19
【问题描述】:

我正在尝试将变量 $serviceid 添加到 whmcs 中的 clientareahome.tpl。

更具体地说,我需要此链接才能在 clientareahome.tpl 上工作:

<a href="clientarea.php?action=productdetails&amp;id={$serviceid}&amp;dosinglesignon=1">

我已经阅读了文档,但我仍然感到困惑。

如何创建一个挂钩来调用 $serviceid?

【问题讨论】:

  • 您如何阅读客户区主页中的产品/服务?它是一个循环吗?请添加您的代码。
  • 我已经设法弄明白了。我会在下面留下答案

标签: php smarty hook whmcs


【解决方案1】:

在帮助下,我们找到了解决方案。我已将此代码添加到 clientareahome.tpl 的顶部:

{php}
$smartyvars = $template->getTemplateVars();  
$userid = $smartyvars['clientsdetails']['id'];
$query = mysql_query("SELECT *,tblhosting.id as serviceid FROM tblhosting,tblproducts WHERE userid = $userid AND tblhosting.packageid = tblproducts.id AND tblhosting.domainstatus='Active'"); 
$result = mysql_fetch_array($query);  
$services = $result["serviceid"];
$template->assign('serviceid', $services);
{/php}

目前,它是暂时的,因为在未来,smarty 模板可能不允许模板中包含 php。在这种情况下,我将不得不制作一个单独的挂钩文件。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多