Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 7 of 7
  1. #1
    Member
    Join Date
    Sep 2008
    Posts
    98

    Default using cpanel branding includes within livephp

    Hi,

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

    I tried this, but it doesnt work:

    PHP Code:
    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 Code:
    <cpanel Branding="include(header.php)"
    What am I doing wrong here?

  2. #2
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    Unfortunately API1 calls (like the branding calls) will not work via livephp - you will need to phpcp or phpcp to do this.
    Last edited by cPanelMatt; 08-14-2009 at 10:19 AM.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  3. #3
    Member
    Join Date
    Sep 2008
    Posts
    98

    Default

    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/All...des08/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. #4
    cPanel Staff cPanelMatt's Avatar
    Join Date
    Apr 2005
    Location
    Houston, TX
    Posts
    409

    Default

    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.
    Last edited by cPanelMatt; 08-14-2009 at 02:06 PM.
    Matt Dees
    Integration Developer
    cPanel, Inc.
    cPanel Integration Blog

  5. #5
    Member
    Join Date
    Nov 2006
    Posts
    8

    Default 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.

  6. #6
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    525

    Default

    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
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Request

  7. #7
    Member
    Join Date
    Nov 2006
    Posts
    8

    Default 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.

Similar Threads & Tags
Similar threads

  1. Branding livePHP
    By SE_Frank in forum cPanel Developers
    Replies: 4
    Last Post: 03-29-2012, 07:48 AM
  2. [case 45745] livephp/API2 Fileman::fileop issue
    By kris.x15 in forum cPanel Developers
    Replies: 4
    Last Post: 01-04-2011, 10:52 AM
  3. [API] Drop requirement of .live.php / .livephp
    By SE_Frank in forum Feature Requests for cPanel/WHM
    Replies: 3
    Last Post: 12-27-2010, 10:49 PM
  4. php vs cpphp vs phpcp vs livephp
    By sirbrent in forum cPanel Developers
    Replies: 3
    Last Post: 08-14-2009, 09:25 AM
  5. Edit DNS taking minutes to load (includes cPanel error message)
    By joshuag in forum cPanel and WHM Discussions
    Replies: 0
    Last Post: 12-11-2007, 06:29 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube