Page 1 of 1

Aquiring site content from folders

Posted: Sun Nov 05, 2006 9:31 pm
by MrPotatoes
this is a question that i honsetly haven't been able to figure out on my own. normally i do but this one has really been bothering me

i have resources on my webserver (local) and this system has a specific folder structure and way of doing things. currently the way that i have it i include the files that i need and work from there. takes alot of the guess work out of knowing how to do my includes in other files.

now, my images are in a folder from the root index called "images". so it looks like this:

Code: Select all

index.php
    +---images
    +---templates
    +---includes
here is my question. in C++ i'm used to just telling it where my static content is. in which folder depending on which folder i am in. well i tried that and it doesn't seem to listen to me. instead what i have to do is give it the "directions" via the URL. like this: 'http://localhost/framework/templates/de ... /error.css'

i would prefer to tell it where it is in a fashion like i do includes. relative to the folder that is including. so, for instance. when i am in the index.php and i include something the include structure is relative to index.php. not the URL.

so i wanted my html/code to end up looking like

<img src="templates/default/styles/error.css"></img>

and not like:
<img src="http://localhost/framework/templates/de ... css"></img>


thanx for the help

[edit] and yes. i have tried giving it the EXACT path to the content

Posted: Sun Nov 05, 2006 9:35 pm
by feyd
Build the full URL of the target file, build the full URL of the current file. Remove what is the same.

viewtopic.php?p=199996&highlight=geturl#199996 could be of interest.

Posted: Sun Nov 05, 2006 9:56 pm
by MrPotatoes
friend helped me figure it out. much simpler than i thought it would be. i needed to add the '/' beginning and remove everything else. that makes it relative. that takes a load off my back.

not happy about the way that it works though lol but i'm happy that it does :D

feel free to lock it up