Jump to content

Recommended Posts

hi all,

 

newbie here having difficulting using the include fuction. i am trying to set up a template for a webpage but for some reason the menu does not display.  Any ideas please?

 

have looked at w3 and followed the instructions on there but no luck.

code posted below.

 

thank you

 

here is the menu

<?
<TABLE cellpadding="10">
<tr>
  <td><img src="Images/Banner.JPG" alt="banner"> </td>
  <td><li> <a href="customer_login.php" rel="nofollow">Log in</a></li>
       <li><a href="customer_create.php" rel="nofollow">Register</a></li>
       <li><a href="password_get.php" rel="nofollow">Forgotten password?</a></li></td>
  </tr>
  <table>
  <table cellpadding="20">
     <tr>
         <td><a href="homepage.php" title="Home"    >Home</a>    </td>
         <td><a href="register.php" title="Register">Register </a>   </td>
         <td><a href="main.php"title="main"         >Members</a>      </td>
         <td><a href="disclaimer.php"title="contact">Fixtures</a>       </td>
         <td> <a href="reports.php"title="Reports">Match Reports</a>     </td>
         <td> <a href="mailto:[email protected]">Contact Us</a>           </td>
         <td> <a href="logout.php"title="logout"     >League Table</a></td>
     </tr>

</TABLE>
?>

 

and the page calling it

<?php
  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
  <head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <LINK rel="stylesheet" href="CSS/home.css" type="text/css">
  <title>Home</title>
  </head>
  <body>
        <?
          include ('menu.php');
        ?>


  </body>
  </html>

?>

Link to comment
https://forums.phpfreaks.com/topic/197992-inserting-a-menu/
Share on other sites

You can call the file anything you want as long as you use the same name (and extension) in the include.  Personally, I would leave it as .php, then if I later decide to put some php code in the file, I don't have to change anything.  Besides, you should add comments to the file to remind you of what is there, etc. and using php comments is cleaner since they don't get sent to the browser:

 

<?php /* menu.php - This file outputs the menu ... */?>

 

By the way use full php tags (as in the example above) rather than short tags (like in your example).  If you later move to a server that does not support short tags, you will not have to edit every single file in your system to fix the tags.

 

Link to comment
https://forums.phpfreaks.com/topic/197992-inserting-a-menu/#findComment-1039070
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.