Hi,
I am trying to display certain parts of a form only to a certain user.
I am using the following method, which works outside of the Chronoforms environment:
The related Brendan.php file is as follows:
The problem is that the layout/CSS gets messed up.
Is there a way of doing this correctly so that CSS is maintained?
Thanks,
Brendan
I am trying to display certain parts of a form only to a certain user.
I am using the following method, which works outside of the Chronoforms environment:
<?PHP $user = JFactory::getUser(); ?>
<?php
if($user->username ='Brendan')
{
?>
<?php
include 'schemes/Brendan.php';
?>
<?php
}
?>
The related Brendan.php file is as follows:
<?php
<select>
<option value="">Select Scheme...</option>
<option value="wex-1">Scheme1</option>
<option value="wex-2">Scheme2</option>
<option value="wex-3">Scheme3</option>
</select>
</div>
</div>
?>
The problem is that the layout/CSS gets messed up.
Is there a way of doing this correctly so that CSS is maintained?
Thanks,
Brendan
Hi mapme,
You've missed an = and been overrun by PHP tags :-(
Including HTML in the middle of a PHP statement might not be what you want here though. Another version is
Bob
You've missed an = and been overrun by PHP tags :-(
<?php
$user = JFactory::getUser();
if ( $user->username == 'Brendan' ) {
include 'schemes/Brendan.php';
}
?>
<select>
<option value="">Select Scheme...</option>
<option value="wex-1">Scheme1</option>
<option value="wex-2">Scheme2</option>
<option value="wex-3">Scheme3</option>
</select>
Including HTML in the middle of a PHP statement might not be what you want here though. Another version is
<?php
$user = JFactory::getUser();
if ($user->username == 'Brendan') {
include 'schemes/Brendan.php';
}
// . . .
echo $select;
?>
<?php
$select = "<select>
<option value=''>Select Scheme...</option>
<option value='wex-1'>Scheme1</option>
<option value='wex-2'>Scheme2</option>
<option value='wex-3'>Scheme3</option>
</select>";
?>
Bob
This topic is locked and no more replies can be posted.