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 Designing Interfaces in PHP Using Interfaces Testing for Interfaces

Interface Implodes during Testing

Having troubles understanding how the entire site fell apart after I began testing interfaces. Once I updated the list.php, share.php, track.php, single.php files, details from the database.json file were omitted and the function that allowed single-items to expand no longer functioned as constructed.

I deleted all new code for this particular video, and everything worked fine. Because I included my own CSS I will review <html> tag placement to ascertain if that could be the culprit, but this is one of those 'f*#$' me moments where I have double-checked typos and rewatched the entire series only to realize that I'm in big trouble.

You can view a snapshot of the project for analysis.

Thank you in advance.

Your snapshot is missing a colon after https

https://w.trhou.se/1n5y29pmxa

1 Answer

Hey Mister Moody - Have a look at views/track.php line 3:

<?php echo $content-getAuthor(); ?>

Also, take a look at src\classes\jsonRepository line 23:

<?php
//
public function find($entity, $value, $field = 'id')
{/* LOOP through json File Items */
    foreach ($this->all($entity) as $key=>$data) {
        /* LOAD 'json' File */
        if ($data->field == $value) { // THIS LINE IS MISSING AN IMPORTANT CHARACTER ;)
            return array($data);
        }
    }
}

Hopefully that helps.

Cheers,

Ben

Thank you for your assistance Ben. That single omission of the > character was indeed the culprit, and all systems are functioning as intended! I have different working copies for this project; one using the teachers CSS and one where I am implementing my own styles that incorporates a grid layout and it is causing me some fuss, but all is good in my world for the weekend thanks to your help!