Jump to content

Archived

This topic is now archived and is closed to further replies.

dragon2309

PHP Include() Function

Recommended Posts

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
ok, below is the code for my whole index.php page, you can see the tiny PHP block midway down in a cell -

[code]<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>[/code]

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

[b][u]*EDIT* - server is experiencing downtime, sorry, site unavailable[/u][/b]

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites

×

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.