php includes

just after a small bit of help, i want to tidy my site up with php includes. i used the following code

i have the div tag

<div id="nav">
<?php
include_once("nav.php")
?>
</div>

when i implement it in dreamweaver it works fine, but using on local host when i test it in the browser it just doesnt even appear. Can anybody shed any light on this please

regards karl

lines with php code need a semi-colon at the end:

[php]
include_once(“nav.php”);
[/php]

i missed that out by mistake, it is in my actual code. its strange because it works fine in the dreamweaver design window just not in the browser

regards

karl

try turning error reporting on and see if any errors show up.

i used the following code as a way to error report

<?php
ini_set('display_errors', 1);
 ini_set('log_errors', 1);
 ini_set('error_log', dirname(__FILE__) . '/error_log.txt');
 error_reporting(E_ALL);
 ?>

but i get no errors, really getting frustrating because ive use php includes before and works fine only difference is i have never used the local host for testing only ever on a live server (ftp).

I use dreamweaver too. It doesnt care if the code is right because its only looking at the html and layout aspects. It knows if its php, just not if its proper. Its not going to tell u that ur missing a ; or a }

Yea I don’t really use dreamweaver to its full potential. Only use to write the code one as its handy to refer back to the design view. I’ve tried running the php error code script through the local host and still don’t get an error. Could it have anything to do with the local host, later I’ll try uploading to a server see if that has any different impact.

Regards
Karl

It could be an error inside the nave file.

after uploading to a remote server the include works fine. Has anyone experience this or know what i need to change to allow it to work on the local host. i use xampp.

reagrds

karl

theres an extension in the php ini, register globals I think, maybe anothet 1 too

Sponsor our Newsletter | Privacy Policy | Terms of Service