Best way to send the content of PHP variables to skin?

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,075
Location
GMT +7.00
Check existing example in /usr/local/directadmin/data/skins/enhanced/user/show_domain.html:

Code:
|$/usr/local/bin/php
<?php
$data = <<<END
|PLUGIN_0_TXT|
END;
if (strlen($data) > 1)
{
echo <<<END
|PLUGIN_0_TXT|<br>
|PLUGIN_1_TXT|<br>
|PLUGIN_5_TXT|<br>
|PLUGIN_7_TXT|<br>
|PLUGIN_9_TXT|
END;
}
?>
DONE|
If it's what you asked for...
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Hello,
Not exactly.
DA variables are created like this
Code:
|?DA_VAR=strawberry|
So I'd like to do something like this
Code:
$php_var="strawberry";
|?DA_VAR=$php_var|
The reason being that php variables are lost every time you call it in the template, so DA variables should be used in order to avoid doing the same thing in different places on the same page.
 
Last edited:

zEitEr

Super Moderator
Joined
Apr 11, 2005
Messages
14,075
Location
GMT +7.00
Did you try something like:

Code:
|$/usr/local/bin/php
<?php
  $php_var="strawberry";
  echo "|?DA_VAR=$php_var|";
?>
DONE|
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Hello,
Yes, that's the second thing I tried, after putting the statements in a if-then-else block.
The variable will take the value $php_var, not the content of $php_var.
 

DirectAdmin Support

Administrator
Staff member
Joined
Feb 27, 2003
Messages
8,987
Hello,

Unfortunately, no. Scripts are not re-tokenized again.
The scripts are a subset of the tokenzier, so their output doesn't get tokenized again.

If you want to describe what you're trying to do, we may be able to offer other suggestions.

John
 

interfasys

Verified User
Joined
Oct 31, 2003
Messages
2,099
Location
Switzerland
Hello John,

We want to be able to customize the UI based on variables found in user.conf and domain.conf.

DA provides a limited set of variables that are available in the skin, so we have to use php to import the ones we need.
Currently, if we want to turn on/off features at 3 places on the page, we have to load the script and variables 3 times.

Maybe a solution would be for DA to load everything that is in user.conf and domain.conf as variables?

Olivier
 
Top