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!
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 trial

Kahlil Calavas
9,238 PointsJson feed code challenge
On code challenge. Look at the comment to see the output of your JSON feed. Echo out the name of the user. I echo{'name"}; and still am not passing. What am I doing wrong? What we learned was to extract out of decoded json feed with a variable such as $wptreehouse_profile yet I am not sure how to answer this without those details. here is what I have now <?php
// { // "name":"Username", // "profile_name":"profile_username", // "profile_url":"http://myapi.net/profile_username" // } echo {"name"};
?>
11 Answers

Kahlil Calavas
9,238 Pointsecho $my_plugin_profile{'name}; worked. I only was able to guess it by looking at the second code challenge. Maybe giving users a little more data would help :) Ok off to the next challenge BTW Good job Zac. Very happy this course hit the roster.

Kahlil Calavas
9,238 Points<li><?php echo $my_plugin_profile->{'courses'}[$i]->{'name'} ?></li>
just figured out how to block code. That was the final answer I used

Ann Cascarano
17,191 PointsThanks for this! I was really stuck. I kept entering: <?php echo $my_plugin_profile->{'courses'}->{'name'}[$i] ?> and could not puzzle out why it wasn't working!

Jill Sheeks
11,169 PointsThis worked for me:
<?php // { // "name":"Username", // "profile_name":"profile_username", // "profile_url":"http://myapi.net/profile_username" // }
echo $my_plugin_profile->{'name'} ?>

Seth Duncan
10,339 PointsThank you for this, I was also confused as to what variable we were accessing 'name' from.

Seth Duncan
10,339 PointsWell now I'm stuck on challenge 2:
Is this not correct ?
<ul>
<?php for( $i = 0; $i < count($my_plugin_profile->courses); $i++ ): ?>
echo '<li>' . $my_plugin_profile->{'courses'}[$i]->{'name'} . '</li>';
<?php endfor; ?>
</ul>
Keeps coming back: Bummer! You have not output the first course: "WordPress Plugin Development"

Kahlil Calavas
9,238 PointsI also think since you aren't technically in a php block(just inside a loop) you will also need to open up the php tag instead of just typing echo

Kahlil Calavas
9,238 PointsSeth I dont think you need to echo out the li
<li> <?php echo $my_plugin_profile->{'courses'}[$i]->{'name'} ?> </li>

Kahlil Calavas
9,238 PointsI think you technically can echo the li but the program has been set to look for the formatting taught in the project files

Seth Duncan
10,339 PointsKahlil,
Gah, you're correct forgot the <?php ?> block. Thank you for the feedback. </Rookie Mistakes>

Kahlil Calavas
9,238 Pointsno problem seth. Hopefully you can download the project files in the next section. I am waiting for them to fix the project file download so I can keep going on the Plugin lesson. Im hungry to make a plugin right now I have a few great ideas.

Ajay Maheshwari
Courses Plus Student 6,423 Points<?php echo $my_plugin_profile->{'name'} ?>

Shai Yahav
7,153 Points<?php echo $my_plugin_profile->{'courses'}[$i]->{'name'}; ?>
Luke Wenke
32,294 PointsLuke Wenke
32,294 PointsThanks but it should actually be:
echo $my_plugin_profile->{'name'};