[eluser]EugeneS[/eluser]
[quote author="juanvillegas" date="1284332599"] just because you can't use it for all your php sentences.[/quote]
what do you mean by "all php sentences" ?
this construction used just to show some data and this construction is part of the "PHP’s alternative syntax".
this alternative syntax allows views look like template but not like another controller or php of 90's with the mix of php and html
up to me it's good rule to not use in views objects etc and have deals only with the variables and arrays and use alternative syntax like:
Code:
<?=$variable_name;?>
<? foreach($some_array as $key => $value): ?>
<div><?=$key;?></div>
<? endforeach; ?>
<? if(isset($something)): ?>
<div><?=$some_variable;?></div>
<? endif; ?>
this way for sure looks better in views than ugly mix of php and html
Code:
<?php
if(isset($something))
{
echo '<div>'.$some_variable.'</div>';
}
?>
or even more ugly way
Code:
<?php
if(isset($something))
{
?>
<div><?php echo $some_variable; ?></div>
<?php
}
?>
complete mess
etc