Home » Forum
NoNumber!

Joomla! extensions & websites
development / support / consultancy

I try to respond within 24 hours (excluding weekends). If I haven't responded by then, feel free to post a reminder or bug me via email.
Welcome, Guest
Please Login or Register.    Lost Password?

foreach loop not working as expected
(1 viewing) (1) Guest
Go to bottomPage: 12
TOPIC: foreach loop not working as expected
#5256
foreach loop not working as expected 10 Months ago  
I need to be able to have HTML sitting inside a foreach loop e.g.:

{source}
<?php
foreach ($houses as $house) {
?>
{/source}

<tr><td>{source}<?php echo $house->number; ?>{/source}</td></tr>

{source}
<?php } ?>
{/source}

But I am getting the Sourcerer not working text in the source code.

Any ideas?

TIA
yesudo
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5257
foreach loop not working as expected 10 Months ago  
Why not do this?
{source}<?php
foreach ($houses as $house) {
   echo '<tr><td>'.$house->number.'</td></tr>';
}
?>{/source}

Peter van Westen
Admin
Posts: 4549
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#5258
foreach loop not working as expected 10 Months ago  
The HTML gets stripped.
yesudo
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5259
foreach loop not working as expected 10 Months ago  
{source}<?php
foreach ($houses as $house) {
   echo '[[tr]][[td]]'.$house->number.'[[/td]][[/tr]]';
}
?>{/source}

Peter van Westen
Admin
Posts: 4549
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
#5260
foreach loop not working as expected 10 Months ago  
Doh.

Thanks. Very handy plugin.
yesudo
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5261
foreach loop not working as expected 10 Months ago  
btw: You can use the Sourcerer editor button to convert the code to/from double bracket syntax.
Peter van Westen
Admin
Posts: 4549
User Online NowClick here to see the profile of this user
The administrator has disabled public write access.
Need to contact me directly? Go to my contact page.
If you use any NoNumber! extensions, please post a rating and a review at the Joomla! Extensions Directory.
Are you happy with the support? Please consider buying a License Code to help me to continue development and support.
 
Go to topPage: 12
Joomla Open Source Training