jprl12

Member
Sep 7, 2004
17
0
151
Hi!

I need to use some PHP code in my cPanel skin. So, I will begin a new skin with only PHP files. This work fine.

But, how can I use cPanel variable in my code? In the normal HTML skin, this line : <cpanel print="$CPDATA{'DNS'}"> will show the domain of the account. I need to use these variables for do some search in MySQL database.

For example, I tried this :
<?php

echo $CPDATA{'DNS'};

?>

OR

<?php

echo $CPDATA['DNS'];

?>

But, no result ... Can you help me?

Regards,
Jean-Philippe Rivard Lauzier
 

kosmo

Well-Known Member
Verifed Vendor
Aug 12, 2001
400
0
316
All over Europe
CPanel will first parse its own tags, then will reparse the file, parsing any php tags. So, it should look like:

<?php
echo "<cpanel print="$CPDATA{'DNS'}">";
?>


First parsing will result to:

<?php
echo "mydomain.com";
?>

which will then lead to the desired result.

kosmo
 

jprl12

Member
Sep 7, 2004
17
0
151
Thanks!! This code work correctly!
 

kosmo

Well-Known Member
Verifed Vendor
Aug 12, 2001
400
0
316
All over Europe
Glad to have been of some help (which has been rare lately :D)

kosmo
 

jprl12

Member
Sep 7, 2004
17
0
151
I have a new question about PHP and a cPanel skin ...

This line, it's for list the MX entry : <?cp Email::listmxs(% ,mx) ?>

We can use this line : <?cp Email::listmxs(% ,mx) domain=mydomain.com ?> for list MX entry for a specific domain.

This code, will put the cPanel tag information in a PHP variable :
HTML:
<?php
$myVar = '<?cp Email::listmxs(% ,mx) domain=mydomain.com ?>';
echo $myVar;
?>
Now, my question, how I can write PHP in the cPanel tag? By example, for have a dynamic selection for the domain :
HTML:
<?php
$myDomain = 'mydomain.com';
$myVar = '<?cp Email::listmxs(% ,mx) domain='.$myDomain.' ?>';
echo $myVar;
?>
For sure, this code doesn't work ... Somebody have a solution for that?
 

activa

Well-Known Member
May 23, 2006
213
1
168
Morocco
cPanel Access Level
Root Administrator
myDomain has been declared in php tag and you have included it in cpanel tag , i think the rl code must be something lik this :

Code:
<?php
$myDomain = 'mydomain.com';
$myVar = '<?cp Email::listmxs(% ,mx) domain= ?>'$myDomain'<?cp ?>';
echo $myVar;
?>