dongzan1970 2010-02-26 21:51
浏览 33
已采纳

如何将symfony网站与whmcs集成

I'm trying to find a way to integrate my website, coded using Symfony with my billing system, WHMCS.

The first thing I tried was creating a new symfony module called whmcs and in that module, I was using ob_start/require_once/ob_get_contents to retreive the page but it kept resulting in a blank page, without any error in the logs or anywhere else. Since this was going to be a navigation nightmare anyway, I gave up on that idea.

My second idea was to take advantage of the WHMCS hooks system. So far, it worked except for one thing. I have no idea how to call my layout.php file. Here is my current code:

function getSymfonyLayout()
{
    require_once($_SERVER['DOCUMENT_ROOT'].'/../config/ProjectConfiguration.class.php');
    $configuration = ProjectConfiguration::getApplicationConfiguration('frontend', 'prod', true);
    $context = sfContext::createInstance($configuration);
    $context->getRequest()->setRelativeUrlRoot('');
    $context->getInstance()->getConfiguration()->loadHelpers('Partial');
    echo get_partial("global/header");
}

add_hook("ClientAreaPage",1,"getSymfonyLayout");

My issue here is that, while the header does load, there is no meta, no css, no javascript. Those settings are saved in my view.yml file and partials don't load that file.

I need to find a way to do something like echo get_layout("layout"); or echo get_methodaction("whmcs", "index");

It's probably something silly but I've been going thru wikis, forums and my symfony book and I just can't find the code I need to use.

  • 写回答

2条回答 默认 最新

  • dongyulian5801 2010-02-28 12:56
    关注

    In your action method, use:

    $output = $this->getController()->getPresentationFor("module", "action");
    

    This will render the output of the specified module and action into $output; see http://www.symfony-project.org/api/1_2/sfController#method_getpresentationfor for details

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 TLS1.2协议通信解密
  • ¥40 图书信息管理系统程序编写
  • ¥20 Qcustomplot缩小曲线形状问题
  • ¥15 企业资源规划ERP沙盘模拟
  • ¥15 树莓派控制机械臂传输命令报错,显示摄像头不存在
  • ¥15 前端echarts坐标轴问题
  • ¥15 ad5933的I2C
  • ¥15 请问RTX4060的笔记本电脑可以训练yolov5模型吗?
  • ¥15 数学建模求思路及代码
  • ¥50 silvaco GaN HEMT有栅极场板的击穿电压仿真问题