We've all seen websites with code like this:
<!-- begin /a4/includes/nav_include.php -->
<div ... >
<!-- end /a4/includes/nav_include.php -->
This is sloppy and annoying, but I understand the need to be able to figure out what file is responsible for the source code you're seeing. What I'd prefer is a way to make all include
d and require
d files automatically spit this info out, but only when in a toggleable dev mode.
Obviously, I could do something like this:
<?php
if($devmode){ echo "<!-- begin /a4/include/snav_include.php -->"; }
include("/a4/includesnav_include.php");
if($devmode){ echo "<!-- end /a4/includes/nav_include.php -->"; }
?>
But that just becomes annoying and sloppy on a whole other level. I'd prefer to get the best of both worlds, where I have the functionality of above but can still write my includes like this:
<?php include("/a4/includes/nav_include.php"); ?>
Is there a way to do this?