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 trial

PHP

Extending Object Oriented PHP: Updating the Display

Whenever I use the switch {} statement on this line of code

echo '<div class="listing panel panel-default">' . PHP_EOL;

to update the display, all data-content for the categories is invisible (the outline of the site is visible). I wrote the statement same as the teacher:

echo '<div class="listing panel ';
  switch ($listing->getStatus()) {
    case 'premium':
      echo 'panel-info';
      break;
    case 'inactive':
      echo 'panel-danger';
      break;
    default: 
      echo 'panel-default';
  }
echo '">' . PHP_EOL;

```if (is_a($listing, 'ListingPremium') && !empty($listing->getDescription() { echo '<p>' . $listing->getDescription() . '</p>';

No fixes at this point => hoping that I have not overlooked something simple!

1 Answer

Niki Molnar
Niki Molnar
25,698 Points

Hi Mister Moody

In this line, you may be missing a ) bracket after getDescription() and possibly a } bracket at the end:

if (is_a($listing, 'ListingPremium') && !empty($listing->getDescription() { echo '<p>' . $listing->getDescription() . '</p>';

Try the following (I've separated out the lines so you can see the ( ) and { } brackets easier):

if (
   is_a($listing, 'ListingPremium') && 
   !empty($listing->getDescription() 
) 
{ 
   echo '<p>' . $listing->getDescription() . '</p>'; 
} 

Hope that helps!

Niki

Personally, I find the simplest of oversights to be the most soul crushing aspects of this craft. ~Thank you. It looks spot on & will implement it soonest!

Update: You were right! Forgot to use two closing parenthesis's.

Thank you again.