Jump to content

PHP Include() Function


dragon2309

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
Link to comment
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.
Link to comment
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]
Link to comment
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
Link to comment
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.