The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

using cpanel branding includes within livephp

Discussion in 'cPanel Developers' started by sirbrent, Aug 13, 2009.

  1. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    Hi,

    I am trying to include branding in a .livephp file.

    I tried this, but it doesnt work:

    PHP:
    include("/usr/local/cpanel/php/cpanel.php");

    $cpanel = &new CPANEL();

    $cpanel->exec('<cpanel Branding="include(header.php)">');
    The file header.php file exists and works just fine when called in .php file like this:

    PHP:
    <cpanel Branding="include(header.php)">
    What am I doing wrong here?
     
  2. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Unfortunately API1 calls (like the branding calls) will not work via livephp - you will need to phpcp or phpcp to do this.
     
    #2 MattDees, Aug 14, 2009
    Last edited: Aug 14, 2009
  3. sirbrent

    sirbrent Well-Known Member

    Joined:
    Sep 30, 2008
    Messages:
    98
    Likes Received:
    1
    Trophy Points:
    8
    that's very frustrating, so far with months of trying to learn how to extend cPanel functionality I am still unable to find a reliable way of mixing php and cpanel APIs while having access to all functionality.

    I had seen the AP1 "Branding" call used as example usage in some LivePHP documentation. Specifically this presentation: http://docs.cpanel.net/twiki/pub/AllDocumentation/TrainingResources/TrainingSlides08/APIs.pdf on page 65.

    When using cpphp or phpcp conditionally executing certain API code within PHP "if" clauses doesnt seem to work. It seems that when the pages are parsed the API code is executed, even if PHP conditions are not met.

    LivePHP seems to be the right approach, but from what you have told me I cant actually make pages with branded UI?
     
  4. MattDees

    MattDees cPanel Product Owner
    Staff Member

    Joined:
    Apr 29, 2005
    Messages:
    417
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    I apologize, I meant to say returning data - sometimes it does work, but over all do not expect it to work as it prints to a process rather than returns data in most cases.

    Unfortunately at this point if you want to mix cpanel and PHP for an interface there is no way to simply get a "full" feature set without using cpphp or phpcp.
     
    #4 MattDees, Aug 14, 2009
    Last edited: Aug 14, 2009
  5. carbonturtle

    carbonturtle Member

    Joined:
    Nov 26, 2006
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Any progress on this front?

    Hi,

    Has there been any progress on this front? I have exactly the same issue as sirbrent, and I have a hard time seeing why anybody would choose LivePHP for cPanel development if it lacks this [rather basic] functionality. :confused:
     
  6. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Hi carbonturtle,

    This has not changed due the underlying structure of API1 calls. Many, if not most, API1 calls print their data instead of return their data. And since the LivePHP execution is happening in a separate process, the output is not captured. The fact that it occurs when using LivePHP is not the problem: it's that API1 calls were designed for frontend development/usage and not designed to be invoked through a sub process. One can see the same behavior when trying to invoke an API1 call via the XML-API interface.

    Refactoring all the API1 calls is a huge undertaking and currently not in our product plan. Even if we were to alter all the API1 calls, we'd also have to redo all the cPanel themes, namely x3, which would be almost as much work. Additionally, anyone who has written a cPanel theme would like have to redo their work too.

    We do hope to address it and we are investigating sane paths to resolving the core issue, but there's no ETA. Your best course of action is to either use cpphp/phpcp or write custom API2 modules that perform the needed functionality.

    Best Regards,
    -DavidN
     
  7. carbonturtle

    carbonturtle Member

    Joined:
    Nov 26, 2006
    Messages:
    10
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the explanation

    David,

    Thanks for the explanation. While I appreciate the multitude of options available to developers looking to extend cPanel's functionality, I almost wish there were fewer, but more complete and better documented, options.

    But I'm new to this, and I'm learning quickly. I have rewritten my little plugin using the cPanel/PHP method.
     
Loading...

Share This Page