2

I begin by saving the file as template.php

I create a folder titled 'includes'

I create two files, 'header.php' and 'footer.php'

Here's the code I'm cutting up:

<!-- start page -->
<div id="page">

    <img src="images/bookshelf.jpg"
        alt="Bookshop Logo"
        id="logoImage" name="logoImage"
        width="800" height="110"/>

  <!-- start content -->
  <div id="content">
    <h1>Welcome to <?php echo $pagetitle?></h1>
  </div>
  <!-- end content -->
</div>
<!-- end page -->

</body>
</html>

I cut the following code out:

<!-- start page -->
<div id="page">

    <img src="images/bookshelf.jpg"
        alt="Bookshop Logo"
        id="logoImage" name="logoImage"
        width="800" height="110"/>

  <!-- start content -->
  <div id="content">

I open header.php

I replace all the content with the above content I cut.

I save header.php

I return to template.php and cut the following and paste it into footer.php, replacing the code there:

<h1>Welcome to <?php echo $pagetitle?></h1>
  </div>
  <!-- end content -->
</div>
<!-- end page -->

I save changes and go back to the template file.

At this stage I'm being told there's a syntax error on line 5. 'Code hinting may not work until you fix this error'.

At this stage, my graphics are different from the course instructor's which shouldn't be the case.

He's only got a little music note left on a brown background. I've still got a jpeg showing.

Now I add commands to include headers and footers as follows:

At the stage of adding <?php include("); ?> there's meant to be an autosuggest to browse, this happens for the instructor but not for me so I type ("includes/header.php"); ?>

By this time, when I go into live view, I'm given a white page with nothing, completely different from the instructor's page. Very frustrating because I'm following the steps using video and can't understand what I am doing differently. I've done this twice with a failed result.

The exercise is demonstrated in CS4. I'm using CS5. Does this have anything to do with it?

I am sorry. I have used design view up until now and this is the beginning of me moving to code which is extremely intimidating. I hope the way I've presented my problem isn't useless to you understanding it.

Please explain slowly for me. I'm not a pro.

1
  • You really should edit this question down to show us what is currently in header.php, the main file, and footer.php. From there, it is a relatively simple exercise to see where you are going wrong.
    – JCL1178
    Oct 26, 2012 at 3:42

1 Answer 1

0

This post might be way past needing answering, but as I came across it I thought I'd throw my hat in the ring and try to assist.

This might be too simple of a suggestion, but if you created the files (header.php and footer.php) into a subfolder called includes but the images remained in the root then you must also adjust the location of the files to which you are pointing to (as they remain in the parent/images folder which is no longer native you the location of your included files - change the <img src="images/bookshelf.jpg" sections of both include files to <img src="../images/bookshelf.jpg".

Note that the change here is to instruct the viewer that the images are in fact up one directory level inside a sub-directory called images.

In regards to the "code hints" that could just be a simple issue with having to enable the code hints? Check :

  • Edit -> Preferences
  • Options
  • Enable Code Hints

Is turned on.

Hope that helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.