IntraHost
01-16-2002, 06:30 PM
Hey, does anyone know how to get php to work in a cpanel theme?
Thanks!
Thanks!
![]() | View Full Version : php in cpanel? IntraHost 01-16-2002, 06:30 PM Hey, does anyone know how to get php to work in a cpanel theme? Thanks! akashik 01-18-2002, 11:54 AM Interested in this myself. I swear I came across it in their forums, but could never find it again. When I asked around no-one seemed to have seen it either. Would certainly go a long way to making it more user friendly when it comes to editing it... Greg Moore SiperNet 01-18-2002, 05:57 PM Ya I had a good design going using a little php but when I tried it it didn`t work, talk about pissed. Oh well. :D MCHost-Marc 01-18-2002, 06:12 PM If you set your server to process .html pages as PHP scripts, it should work ;) KDAWebServices 01-19-2002, 11:22 AM Originally posted by Kiwi If you set your server to process .html pages as PHP scripts, it should work ;) I'd be very surprised if it did seen as CPanel uses it's own httpd to serve itself and not apache. It's definately in there but I can't find any reference to it on CPanel.net apart from people saying it didn't work in one of the builds. Matt Lightner 01-19-2002, 03:32 PM In order to use PHP in your Cpanel themes, you simply have to rename your file with the .php extension. When you do that, the cpaneld webserver will automatically switch the engone over to cpanelphp rather than cpanel. The cpanelphp engine will first run the page through the Cpanel parser, so that all cpanel tags will be replaced. It will then run it through PHP and PHP will display the output. So you can do something fancy like this: <?php $maxpops = "<cpanel print="$CPDATA{'MAXPOP'}">"; $usedpops = "<cpanel Email="countpops()">"; if ($maxpops < 0) { $percentpops = ($usedpops / $maxpops) * 100; echo "You are allowed a maximum of $maxpop POP accounts. ". "You are currently using $usedpops (or ".$percentpops."%) of ". "your allowed POP accounts."; } elseif ($maxpops == 0) { echo "You are not allowed any POP accounts with your ". "accont."; } else { echo "You are allowed an unlimited number of POP accounts ". "with your account. You are currently using $usedpops POP ". "accounts. } ?> That's just an example--and someone will probably want to check my code--but it gives you an idea of what is possible when using PHP through Cpanel. Essentially, you can have Cpanel drop the output of Cpanel tags into PHP variables, and then process those variables in your PHP code accordingly. Let me know if you have any trouble with this feature. |