Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-01-07 14:50:27
- stef25
- Member
- Registered: 2005-12-26
- Posts: 88
do i have to use absolute img paths?
for example a css rule: background: url(images/browsebox_backg.gif); would work for domain.com/index.php but not for domain.com/section/index.php if the images folder is domain.com/images. the second url would be looking for rj.com/section/images
so the alternative is to use background: url(http://domain.com/images/browsebox_backg.gif)
but since we are on a testing server with different url, that means we have to change all the xhtml pages and css files when moving to a new server
correct?
I need someone to protect me from all the measures they take in order to protect me
Offline
#2 2007-01-07 15:37:34
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: do i have to use absolute img paths?
Try url(/images/browsebox_backg.gif)
.
Offline
#3 2007-01-07 15:41:42
- stef25
- Member
- Registered: 2005-12-26
- Posts: 88
Re: do i have to use absolute img paths?
when in domain.com/section/article-test.php the line you posted would be looking for domain.com/section/images/browsebox_backg.gif
right?
I need someone to protect me from all the measures they take in order to protect me
Offline
#4 2007-01-07 18:22:33
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: do i have to use absolute img paths?
No, it would look for the images directory in the root of your domain. ../images
might also work.
Offline
Re: do i have to use absolute img paths?
Don’t think relative will work either because with the rewriting rules the files are faked to be in a directory type structure. The best way is to use the css portion of txp interface to import a css file, and have that import be absolute. So when you move servers you just have to change the import.
After that … any calls form the imported css file nuff-respec.css will be relative to the css directory.
Last edited by dbulli (2007-01-08 16:11:32)
nuff-respec ::: dannyb
Offline
#6 2007-01-08 20:25:58
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: do i have to use absolute img paths?
Don’t think relative will work either because with the rewriting rules the files are faked to be in a directory type structure.
If the path is a valid pointer to a real file, it will work, the rewrite rules should not interfere.
An absolute relative url, “as Els posted“http://forum.textpattern.com/viewtopic.php?pid=136480#p136480, will work regardless of what page is loading the stylesheet.
Offline
Re: do i have to use absolute img paths?
Els wrote:
Try
url(/images/browsebox_backg.gif)
.
Sorry for thread digging; just thought that a new thread wasn’t really necessary. :)
Problem: Currently I’m coding my site within my localhost before uploading it, but it seems absolute path not working.
My index.php could not locate the stylesheet ( <link rel=“stylesheet” href=”/css/hm.css” /> is not working) as well as all the images path in the CSS.
I could get it to work with relative path (href=“css/hm.css”) but I’m quite uncomfortable with relative path. Clean URL is working for my TXP setup.
Any idea whats happening around?
Last edited by Cyrus (2007-07-02 12:06:25)
Offline