Hey this is an odd question. So I'm designing a website with certain elements repeating. So I put the code for those sections into individual files, then would have php load the html into the page, so if I wanted to change something I would only have to change it in one place. The problem is that some of the parts contain php code, that is echoed into the document as straight text, and not interpreted. Is there a way to have php do multiple passes, or is there a way to find the path to the php executable on a server? ("/usr/bin/php" on *nix I think) Thanks for the help guys!
Parse interpret code from file?
Collapse
X
-
Tags: None
-
haha sorry, so in the main file I have:
then in static-items/menu I haveCode:<?php function writestatic($item) { $path = softrootpath() . '/static-items/'.$item; $f = fopen($path, 'r'); $data = fread($f, filesize($path)); echo $data; } ?>
so then back in the main fileCode:<div id="menucontainer"> <div id="menunav"> <ul> <li><a href="<?php echo rootpath(); ?>/index.php" title="Home" class="current"><span>Home</span></a></li> </ul> </div> </div>
so when I try to link to home It tries to take me to "<?php echo rootpath(); ?>/index.php"Code:<?php writestatic('menu')?>
thanks guys!Comment
-
Comment