Home » Forum
NoNumber!

Joomla!® Websites & Extensions
development  -  support  -  consultancy

I try to respond within 48 hours (excluding weekends).
If I haven't responded by then, feel free to post a reminder or bug me via email.

My last reply was: 2 Hours, 54 Minutes ago.

Welcome, Guest
Please Login or Register.    Lost Password?

foreach loop not working as expected
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: foreach loop not working as expected
#5256
foreach loop not working as expected 2 Years, 2 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 2 Years, 2 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: 9091
User OfflineClick 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 2 Years, 2 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 2 Years, 2 Months ago  
{source}<?php
foreach ($houses as $house) {
   echo '[[tr]][[td]]'.$house->number.'[[/td]][[/tr]]';
}
?>{/source}

Peter van Westen
Admin
Posts: 9091
User OfflineClick 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 2 Years, 2 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 2 Years, 2 Months ago  
btw: You can use the Sourcerer editor button to convert the code to/from double bracket syntax.
Peter van Westen
Admin
Posts: 9091
User OfflineClick 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.
 
#5262
foreach loop not working as expected 2 Years, 2 Months ago  
Thanks.
yesudo
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
#5265
foreach loop not working as expected 2 Years, 2 Months ago  
Including the looping code in an external file works also.

Marvellous.
yesudo
Posts: 6
User OfflineClick here to see the profile of this user
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: Peter van Westen
Open Source Training | Online Joomla! Training and Support
hosting joomla
MaxCDN | Content Delivery Network | Accelerate your site to the max