using cpanel branding includes within livephp

sirbrent

Well-Known Member
Sep 30, 2008
98
1
58
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?
 

MattDees

Well-Known Member
Apr 29, 2005
416
1
243
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.
 
Last edited:

sirbrent

Well-Known Member
Sep 30, 2008
98
1
58
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?
 

MattDees

Well-Known Member
Apr 29, 2005
416
1
243
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.
 
Last edited:

carbonturtle

Member
Nov 26, 2006
10
0
151
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:
 

cPanelDavidN

Well-Known Member
Staff member
Dec 17, 2009
571
3
68
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
 

carbonturtle

Member
Nov 26, 2006
10
0
151
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.