Jump to content

Folders, Files In The Web Root


bigjoe11a

Recommended Posts

Go to http://toppersbbs.dtdns.net/mapnet/blog.php and click on the link after the 1st blog and click on Add Entry. The header loads in and I'm not gettings any errors. So why doesn't the images and back ground colors work. I guess the question is how can I use the same header files and so on in my web site and use sub folders and sub, sub folders with out the need to add all the files for my web site in the main root web folder. {root}-------mapnet-------blog/addentry.php this is the basic setup I have. I been putting mapnet together for the last 3 weeks. Any way it seems to me that it's not seeing the style sheet. So this mean how can I use the same header file in all my folders no matter where they are. In my config.php file. I define('WebRoot','/');define('LIB_PATH', 'sources/'); and theres some other ones I defined all so. Just to make finding paths and file easy. It was until I desided I didn't want every thing in the mapnet folder. Is there some thing I can do to setup an option that I can use the header file from any folder with out getting these kind of problems. Joe

Link to comment
Share on other sites

You have all the paths wrong. you're making them relative to the current directory, which is /mapnet/blog/You probably want it relative to /mapnet or even just the root /

Link to comment
Share on other sites

Then maybe you can tell me, How do i setup a define() that relates to the mapnet folder. Then I can work from there. My root folder is webroot/mapnet/-->> then the rest of my folders are in the mapnet/

Link to comment
Share on other sites

You want a constant that points to the root of the system. What I did was to take dirname(__FILE__) and remove the part that matches $_SERVER['DOCUMENT_ROOT'] from the beginning.This has to be done in a file right in the mapnet directory. Then you include this file into every page you want to use the constant.

Link to comment
Share on other sites

Yes, I used them all the time. In my config.php file I have some thing like this that defines or I try and define the mapnet root folder. defined('SITE_ROOT') ? null : define('SITE_ROOT','/www/vhosts/_static/webroot/mapnet/'); This should define the web root for mapnet. Like I said I can't get this to work unless I put all my PHP script in the mapnet folder. I can't put any thing in a sub folder other then the templates.

Link to comment
Share on other sites

Something like this?

define('HTTP_SITE_ROOT','/mapnet');

If you don't know that the directory is going to be exactly there and you want to know where it is relative to the PHP file, you're going to have to work with other variables.

Link to comment
Share on other sites

Ig I add the / on the front of mapnet. Does that mean that mapnet is the root folder. I tried that and it didn't work.

Link to comment
Share on other sites

If the path starts with a slash, that means the path starts at the root of the server. So if the root of the server is http://domain.com, and you have a page at http://domain.com/dir1/dir2/file.html, and it is linking to an image called "/images/image.jpg", then since that path starts with a slash it starts looking at the root of the server (http://domain.com/images/image.jpg). If a path starts with a period or nothing (no slash), then it starts looking in the same directory as the file that has the link in it.

Link to comment
Share on other sites

To help debug this stuff, in the Chrome developer console you can click on the Network tab to see a list of all of the files that it's trying to get, and you'll be able to see the full absolute path to the file if you hover over the filename. So if you try to set up a relative link, you can check the Network tab to see the full URL that it's actually looking for to verify whether or not the relative link is correct.

Link to comment
Share on other sites

To help debug this stuff, in the Chrome developer console you can click on the Network tab to see a list of all of the files that it's trying to get, and you'll be able to see the full absolute path to the file if you hover over the filename. So if you try to set up a relative link, you can check the Network tab to see the full URL that it's actually looking for to verify whether or not the relative link is correct.
well the version I just download doesn't have those options and I'm about ready to quit on this. I can't get the paths rright and the pages don't load. I just don't know what to do.
Link to comment
Share on other sites

you can get all the developer tools tab by going to view->developer tools. just like I said in your javascript thread.

Link to comment
Share on other sites

and like I said I don't know what to look for or what to do, I never use that option before. So I don't know what to do.

Link to comment
Share on other sites

It does have those options, because any browser you just downloaded is newer than the one I'm using and my version has those options. Press Ctrl-Shift-I to open the developer tools, and click on the Network tab. Once you're there, go back and read post 12 again.

Link to comment
Share on other sites

and like I said I don't know what to look for or what to do, I never use that option before. So I don't know what to do.
and like we said in your other thread, we gave you links and tips on how to look it up and figure it out.
Link to comment
Share on other sites

I know that, it's I just get confuesed on this because it's so new to me. Like I said. I happy I got the paths working and the css working again. This makes me happy. So thank you

Link to comment
Share on other sites

Might be worth you look into Absolute and Relative paths, so you don't fall to the blunder of this in a future project.

Link to comment
Share on other sites

well when sometherguy told me about how the css, javascript and then theres the paths for classes and other php scripts. I didn't under stand him until I did a search on it. and fount out that you have to use 2 main folders and not hust one. So you need a dos root path and a http server path. and then you can use them threw out the CMS., witch makes since after I fount a sample on it.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...