AceInfinity
Emeritus, Contributor
Okay, so this is the reason why I never became a web developer... Too much hassle for something that seems as though it should be so simple. What i'm trying to do is get an include path to work for all directory levels so that I don't end up having to just hardcode the hyperlink in everywhere as an absolute path. The thing is, even if I was to do that, it basically eliminates the benefit of having apache and all of that on my local system for web development. And using the $_SERVER["DOCUMENT_ROOT"] variable also doesn't seem like a good thing because where I am developing locally, is not going to be the same path relative to $_SERVER["DOCUMENT_ROOT"] by the time I upload it to public view... So I would have hardcoded everything with paths relative to $_SERVER["DOCUMENT_ROOT"] locally, and before uploading via FTP to my website, they would yet again have to be changed.
So... What's the trick? Modifying php.ini for the include path? (Seems to be the best strategy thus far... Although this does mean that I need a php.ini everwhere where include is used am I right?)
Thing is... I've got stuff like this:
So I'm assuming I'm going to have to <?php echo... those image paths as well relative to the root somehow. I've got .htaccess set up so that my includes folder denies access to public, for security reasons.
Just looking for some feedback on this before I go bald from pulling my hair out. :lol: This has always been annoying for me whenever I attempt to develop a PHP based website instead of strictly HTML. PHP makes web development faster, as long as you can get past annoying issues like this as far as I'm concerned. I just don't have enough PHP experience to know all the tricks.
So... What's the trick? Modifying php.ini for the include path? (Seems to be the best strategy thus far... Although this does mean that I need a php.ini everwhere where include is used am I right?)
Thing is... I've got stuff like this:
PHP:
<?php include('vars/variables.php'); ?>
<!-- START #Social_Bar -->
<div id="t_social_bar">
<span><a href="https://twitter.com/TechLifeForum" target="_blank"><img src=<"images/social/twitter.png"></a></span>
<span><a href="http://blogs.msmvps.com/aceinfinity/" target="_blank"><img src="images/social/wordpress.png"></a></span>
</div>
<!-- END #Social_Bar -->
So I'm assuming I'm going to have to <?php echo... those image paths as well relative to the root somehow. I've got .htaccess set up so that my includes folder denies access to public, for security reasons.
Just looking for some feedback on this before I go bald from pulling my hair out. :lol: This has always been annoying for me whenever I attempt to develop a PHP based website instead of strictly HTML. PHP makes web development faster, as long as you can get past annoying issues like this as far as I'm concerned. I just don't have enough PHP experience to know all the tricks.
Last edited: