I'm not 100% sure how to word this.. [Web Help] -
Luis- - 19.11.2016
Hey.
Unfortunately, I couldn't think of a suitable title for this problem.
The problem I'm having is putting files in folders, for example, I have a few admin files (which are coded in PHP), and they're in their own admin folder, and I also have a few other php files which are located in a folder called server. The dilemma I'm having is that the stylesheet won't show on some pages.
I use two php files which are called header.php & footer.php so I don't have to edit all the files one by one, I can just edit the header.php or footer.php, so the stylesheet is being fetched from the header.php like this;
Код:
<link rel="stylesheet" type="text/css" href=<?php __DIR__ ?> "/sfse/home/stylesheets/style.css" />
<link rel="stylesheet" type="text/css" media="screen" href=<?php __DIR__ ?> "/sfse/home/stylesheets/menu_css.css" />
but that is also in it's own folder called stylesheets.
How can I make it so it loads correctly?
Re: I'm not 100% sure how to word this.. [Web Help] -
TwinkiDaBoss - 19.11.2016
Okay look at this for example
Lets say our PHP file is inside a folder and we want to load something outside that folder?
PHP File location
PHP код:
"C://MyServer/PHP/myphpfile.php"
Some other file location?
PHP код:
C://MyServer/CSS/MyFile.css
Now we want to load MyFile.css from Myphpfile.php?
PHP код:
href="../CSS/MyFile.css"
Basically "../" means that you are exiting your current folder
Ie:
PHP код:
C://SAMP/Gamemodes/gm.php
Now we want to load a plugin into it?
PHP код:
href="../plugins/myplugin.dll"
Want to exit 2 folders?
I hope that is what you ment? If not please take a screenshot of your folder structure so I can understand
Re: I'm not 100% sure how to word this.. [Web Help] -
Luis- - 19.11.2016
Hm. I've tried all that.
My current structure goes like this;
Main Folder
- index.php
- .htaccess
Sub Folders
- functions -> header.php & footer.php
- images
- stylesheets
- server
- admin -> (with all the admin files inside)
Re: I'm not 100% sure how to word this.. [Web Help] -
BlackBank - 19.11.2016
Quote:
Originally Posted by Luis-
Hm. I've tried all that.
My current structure goes like this;
Main Folder
- index.php
- .htaccess
Sub Folders
- functions -> header.php & footer.php
- images
- stylesheets
- server
- admin -> (with all the admin files inside)
|
PHP код:
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
<link rel="stylesheet" type="text/css" media="screen" href="stylesheets/menu_css.css" />
This is the correct way, since index.php is the 'main' file of your webserver.
Also keep in mind, every piece of PHP code will never be reached to the user, PHP is server-side. HTML and JavaScript are client-side.