Note that there are some explanatory texts on larger screens.

plurals
  1. POhref in css link won't load from previous directory
    text
    copied!<p>So currently I'm a starting off web developer. I don't have much experience with how websites "should" be formatted. I am trying my hardest though to keep everything as organized as possible and I'm trying to think ahead before I program anything large ( ie: a website with a number of pages that may need to be updated in the future. ). </p> <p>So I decided to learn php so I can make websites more update-able and workable with a vast array of projects. So, I'm starting simple and seeing if I can keep all css in one spot so that it would be easy for any page to load from. Loading these cascading sheets I made a function in PHP to find their directory and then to load the actual php. BUT when I load the css from the direct path it doesn't seem to actually load. It actually seems that it is trying to load from the current directory as a relative path to the full path that I have. Thus problems of "file url forbidden" and what not. </p> <p>I've tried manually inserting the .css 's path, and using my php code -- But neither work.</p> <p>My php code looks like this </p> <pre><code>&lt;?php // This gives us the current path needed. $direct = __DIR__; $dirList = explode( "\\", $direct ); $length = count( $dirList ); $curPath = ""; $curPart = ""; for( $i = 0; $i &lt; $length; $i ++ ) { $curPart = $dirList[ $i ]; $curPath .= $curPart . "/"; if ( $curPart == "mSite" ) break; } $curPath = str_replace("\"", "", $curPath ); ?&gt; </code></pre> <p>And my linker looks like this</p> <pre><code> &lt;link rel="stylesheet" type="text/css" href="/&lt;?php echo ($curPath."css_sheets/navBar_sheet.css"); ?&gt;" /&gt; &lt;link rel="stylesheet" type="text/css" href="/C:/Users/UserName/Desktop/unServ/New Testing/css_sheets"/&gt; </code></pre> <p>Yeah, my code may definitely not look good, but I'm just starting out. Any help appreciated! I've looked all over the web and on this site but I just could not figure out how to word it properly - or no one seems to really have had this problem before.</p> <p>Ps: I've tried using "SRC" instead of "HREF" and i've tried putting the "/" before the path but none of its worked.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload