Jump to content

gsingh2011

Members
  • Posts

    31
  • Joined

  • Last visited

Everything posted by gsingh2011

  1. Let me clarify the issue. My document root is something like /var/www/. I have the following two files, /var/www/index.php and /var/www/foo/index.php. I have a CSS file /var/www/css/styles.css. In both index.php files, I want to include the CSS file. In the link tag, I can set href to href="<?= $_SERVER['DOCUMENT_ROOT'] ?>css/styles.css" for both files. The only issue is now if someone views the source, they see /var/www/css/styles.css. I'd prefer that in the first index.php they would see css/styles.css and in the foo/index.php they would see ../css/styles.css.
  2. I have a CSS file that all of my HTML files include. I don't like the idea of having the absolute document root path displayed in the HTML code when the file is included, so I don't want to use $_SERVER['DOCUMENT_ROOT'] as the basepath to the file. Is there a way for me to get the relative path to the document root?
×
×
  • Create New...