Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

PHP Build a Basic PHP Website (2018) Building a Media Library in PHP Using Variables for the Title Tag

Martina Carrington
Martina Carrington
15,754 Points

i received a error message

ok i follow the steps on the basic php lesson but some reason i received Parse error: syntax error, unexpected end of file, expecting variable (T_VARIABLE) or ${ (T_DOLLAR_OPEN_CURLY_BRACES) or {$ (T_CURLY_OPEN) in /home/treehouse/workspace/index.php on line 22. but everything look fine

Can you paste your code please?

Martina Carrington
Martina Carrington
15,754 Points

this is INDEX.PHP

<?php

$pageTitle = "Personal Media Library";

include("inc/header.php"); ?> <div class="section catalog random">

        <div class="wrapper">

            <h2>May we suggest something?</h2>

                            <ul class="items">
                <li><a href="details.php?id=201"><img src="img/media/forest_gump.jpg" alt="Forrest Gump"><p>View Details</p></a></li><li><a href="details.php?id=204"><img src="img/media/princess_bride.jpg" alt="The Princess Bride"><p>View Details</p></a></li><li><a href="details.php?id=302"><img src="img/media/elvis_presley.jpg" alt="Elvis Forever"><p>View Details</p></a></li><li><a href="details.php?id=303"><img src="img/media/garth_brooks.jpg" alt="No Fences"><p>View Details</p></a></li>                              
            </ul>

        </div>

    </div>

<?php include("inc/footer/php);?> <!--end content-->

3 Answers

Could it be that your footer is "inc/footer/php" when it should be "inc/footer.php"?

Let me know if that works

Martina Carrington
Martina Carrington
15,754 Points

Hi rhysadams it works but now it say Parse error: syntax error, unexpected ';' in /home/treehouse/workspace/index.php on line 19 .

martina carrington Try adding a ">" after the "include("inc/footer.php);?". To close of the PHP tag.

Martina Carrington
Martina Carrington
15,754 Points

<?php

$pageTitle = "Personal Media Library";

include("inc/header.php"); ?> <div class="section catalog random">

        <div class="wrapper">

            <h2>May we suggest something?</h2>

                            <ul class="items">
                <li><a href="details.php?id=201"><img src="img/media/forest_gump.jpg" alt="Forrest Gump"><p>View Details</p></a></li><li><a href="details.php?id=204"><img src="img/media/princess_bride.jpg" alt="The Princess Bride"><p>View Details</p></a></li><li><a href="details.php?id=302"><img src="img/media/elvis_presley.jpg" alt="Elvis Forever"><p>View Details</p></a></li><li><a href="details.php?id=303"><img src="img/media/garth_brooks.jpg" alt="No Fences"><p>View Details</p></a></li>                              
            </ul>

        </div>

    </div>

<?php include("inc/footer/php);?> <!--end content-->

You're more than welcome :) - If you're happy Like my original answer and mark as solved!

Thank you.