Jump to content


Photo

PHP Include() Function


  • Please log in to reply
5 replies to this topic

#1 dragon2309

dragon2309
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 03 June 2006 - 07:04 PM

Hi, i have a .htm file whihc contains SCRIPT src links to a javascript menu, this file is called menu.htm... On my index.php file i have a general layout set up using tables. In one of the table cells i have entered <?php include("menu.htm"); ?>

This works fine, the menu gets displayed on the index.php file, only one problem, the menu gets displayed as it nwould do on the menu.htm file, theis means its butted up against the left hand side of the window, even though i put the INCLUDE function into the table cell, what i wanted it to do is shove the mune into the table cell (obviously it doesnt work like that)...

So my question, is there any alternative to the INCLUDE function... or is there some parameter im missing?? Sorry, this probably sounds really n00bish, lol. Any help given is much apreciated.

dragon

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 03 June 2006 - 07:17 PM

If thats the result you are getting then you may not be coding your HTML correctly.

include does what it is told to do, include a file thats it! The way you want the menu to look like is down how you style or code your HTML.

Post your code here and we might be able to help.

There is another alternative which is require but it'll probably do the same thing as include does.


#3 dragon2309

dragon2309
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 03 June 2006 - 07:31 PM

ok, below is the code for my whole index.php page, you can see the tiny PHP block midway down in a cell -

<html>

<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>CamberCaravan.co.uk</title>
</head>
<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<p></p>
<div align="center">
    <table border="0" width="60%" id="table1" style="border-collapse: collapse" height="684">
        <tr>
            <td colspan="2" height="202">
<img src="img/mainhead1.jpg" width="800" height="200"></td>
        </tr>
        <tr>
            <td width="24%" height="90%"><?php include("menu.htm"); ?></php></td>
            <td width="76%" height="90%">&nbsp;</td>
        </tr>
    </table>
</div>
</body>
</html>

I cant see how else i would have to code it, surely it should be putting the menu inside that table cell???

if you want to see a live version then go to [a href=\"http://www.cambercaravan.co.uk\" target=\"_blank\"]http://www.cambercaravan.co.uk[/a]

cheers, dragon

*EDIT* - server is experiencing downtime, sorry, site unavailable

#4 poirot

poirot
  • Members
  • PipPipPip
  • Advanced Member
  • 646 posts
  • LocationAustin, TX

Posted 03 June 2006 - 07:34 PM

The "live" version is not working. The problem MAY be HTML related, and not PHP.

Try to look into the source code, if the contents of menu.htm are IN THE cell, this means PHP did its part.
~ D Kuang

#5 dragon2309

dragon2309
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 03 June 2006 - 07:42 PM

ok, yeh, server is messing about at the moment, i checke the source, and your right, the contents of menu.htm ARE NOT in the cell, it is simply shoved at the bottom of the code when index.php finishes.... which is strange.... how do i get it to actually shove all of menu.htm INTO THE CELL, and not just ina seemingly random place...

cheers, dragon

#6 dragon2309

dragon2309
  • Members
  • PipPip
  • Member
  • 18 posts

Posted 03 June 2006 - 08:44 PM

any ideas anyone...?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users