Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialsondus zatar
8,604 PointsUsing the JSON feed in the comments and the existing loop, echo out each of the course names inside the list items.
<?php if( $my_plugin_profile->{'badges'}['url'] == $my_plugin_profile->{'icon_url'} ): ?>
<li class="WordPress Plugin Development">
<? php echo $WordPress Plugin Development-> {'badges"}[$iP]->{"name"}; ?></li>
<li class="WordPress Theme Development">
<? php echo $WordPress Theme Development-> {'badges"}[$iP]->{"name"}; ?></li>
<li class="Introduction to PHP">
<? php echo $Introduction to PHP-> {'badges"}[$iP]->{"name"}; ?></li>
where is the wrong ?
1 Answer
James Oh
39,169 PointsThis seems to have worked for me:
<?php for( $i = 0; $i < count($my_plugin_profile->courses); $i++ ): ?>
<li>
<?php echo $my_plugin_profile->{"courses"}[$i]->{"name"} ?>
</li>
<?php endfor; ?>