Including PHP files in CPanel themes

amard

Well-Known Member
Jan 18, 2003
100
0
166
Herts, UK
Hi,

I thought it was as simple as adding

PHP:
<cpanel include="script.php">
To include a PHP scripts output in a CPanel theme, although it just prints the contents of the PHP file.

How do you execute a php script and then include the contents in a theme?

For example, this would print "hello" in the theme and not <?PHP print "hello"; ?>:
PHP:
<?PHP print "hello"; ?>

Thanks,

Rob

:)

cPanel.net Support Ticket Number:
 

ciphervendor

Well-Known Member
Aug 26, 2002
1,052
0
166
Not really possible since cPanel runs its own web server for WHM & cPanel.

cPanel.net Support Ticket Number:
 

Faldran

Well-Known Member
May 28, 2002
136
0
316
You have to rename that file .php instead of .html that you are having that include in..

cPanel.net Support Ticket Number:
 

[email protected]

Well-Known Member
Mar 5, 2002
493
0
316
Los Angeles California
Not true. That will not work.
You have to use the Cpanel include tag even if you are using PHP in cpanel.

To include php in cpanel, just put the include file in your PHP library directory, easy as that.

Originally posted by Faldran
You have to rename that file .php instead of .html that you are having that include in..

cPanel.net Support Ticket Number:
 

SoftmegUK

Well-Known Member
Feb 13, 2002
372
0
316
UK
The best way I found was to make all the files .php then use good old PHP includes... worked a treat for me, if you use the cpanel includes i dont think it will run any code you have specified, would be like viewing it locally on your harddrive with no webserver :)
 

[email protected]

Well-Known Member
Mar 5, 2002
493
0
316
Los Angeles California
It does not work. Cpanel directory does not allow you to include PHP files like you normally do.

You have to include then in the PHP library.
Try it out and you will see what I mean

Originally posted by SoftmegUK
The best way I found was to make all the files .php then use good old PHP includes... worked a treat for me, if you use the cpanel includes i dont think it will run any code you have specified, would be like viewing it locally on your harddrive with no webserver :)
 

SoftmegUK

Well-Known Member
Feb 13, 2002
372
0
316
UK
Originally posted by [email protected]
It does not work. Cpanel directory does not allow you to include PHP files like you normally do.

You have to include then in the PHP library.
Try it out and you will see what I mean

Oh yeah sorry my mistake! Been a long time since I wrote my theme for cPanel!