Page 1 of 1

why css image linking adds tmp/cache?

Posted: Mon Sep 27, 2010 9:45 am
by JiiPee
I am building a new site and I am using cmsms mle 1.8.2 full.
When I try to add images in css, like:

Code: Select all

#header {
    background: url(uploads/images/header.jpg) no-repeat center top; 
    width: 940px;
    height: 220px;
}
Image dont show and when I click to see image path, it gives http://www.mydomain.com/web/tmp/cache/u ... header.jpg. I am curently building the site inside the web folder, so no problem there but where does it take that tmp/cache to the address?

Edit: All the images attached from page editor to the content are showing ok, so this only happens when I try to link images from css file.

Re: why css image linking adds tmp/cache?

Posted: Mon Sep 27, 2010 9:51 am
by uniqu3
use:
background: url([[root_url]]/uploads/images/header.jpg) no-repeat center top;
or
background: url(../../uploads/images/header.jpg) no-repeat center top;

Re: why css image linking adds tmp/cache?

Posted: Tue Sep 28, 2010 6:23 pm
by Dr.CSS
Actually I find you don't need (../../  just (/uploads  ...

Re: why css image linking adds tmp/cache?

Posted: Tue Sep 28, 2010 6:48 pm
by uniqu3
Didn'T know about that ond Dr.CSS or i actually never tried it since i tend to use root_url or even subdomain.

Re: why css image linking adds tmp/cache?

Posted: Wed Sep 29, 2010 7:41 am
by JiiPee
It seems that because I am building it in the web/ sub folder, it needs to be /web/uploads to work.
I just thought that before I didnt needed to modify any links after I transfer site from sub folder to root.

Re: why css image linking adds tmp/cache?

Posted: Wed Sep 29, 2010 7:53 am
by RonnyK
This depends, on using {stylesheet} or {cms_stylesheet}.

As {cms_stylesheet} is cached, it works from that folder. This requires that [[root_url]] is placed in front of relative paths.

When you use {stylesheet}, then the paths are relative and not cached. The the uploads/ should work.

I guess that you use {cms_stylesheet} in the page-template, and with that [[root_url]] is required.

Ronny

P.S. This board is for official CORE, NOT for the MLE-fork.... Please move this topic to the MLE-board.