Hello,
first, let me thank the author for the nice plugin, it really saved my day!
Second, I have a couple of questions:
Take a look at this php code:
| Code: |
<?php
$value=1;
if ($value==1)
{
// perform some php code
?>
<!-- this is html, output only if $value=1 -->
<strong>the value is 1</strong>
<?php
// again some php code, runs only if $value=1
}
else
{
// perform other code, runs if $value!=1
?>
<!-- this is html again, output only if $value!=1 -->
<strong>the value is not 1</strong>
<?php
}
?>
|
works fine when it runs directly (outside from Joomla I mean), but it does not when run into Joomla content via directphp.
In this case the output is
"the value is 1 the value is not 1"
After some tests I found that directphp does not work if php code is output together with HTML AND you enclose it inside {} brackets to run only when some conditions are met.
To have it run correctly, I must use
| Code: |
<?php
$value=1;
if ($value==1)
{
// perform some php code
printf ("%s","<strong>the value is 1</strong>");
// again some php code, runs only if $value=1
}
else
{
// perform other code, runs if $value!=1
printf ("%s","<strong>the value is not 1</strong>");
}
?>
|
This works perfectly. This would be more than acceptable, but the second problem arises then.
If I have to output everything via PHP output functions, it seems directphp is unable to output a line feed+carriage return:
this php code works if used directly:
| Code: |
<?php
printf("%s", "this is first line<br><br>this is second line");
?>
|
It outputs, as expected, 2 text lines separated by 2 empty lines.
But it does not inside Joomla content via directphp; it outputs the following:
"this is first line this is second line".
I tried different methods to provide line feed+cr:
| Code: |
echo JText::_('<br>'); or, printf("<br>" |
and whatever I could think of, but none of these methods work.
Of course, being unable to output carriage returns is a real problem when dealing with complex data output.
Any suggestions are welcome!
Ciao