Image path within theme CSS

Permalink
Hello,

I’ve made a really simple theme, called 'abc'. I’ve copied the following files to my site:

themes\theme_abc\default.php
themes\theme_abc\description.txt
themes\theme_abc\images\img.jpg
themes\theme_abc\main.css
themes\theme_abc\typography.css


The default.php file contains the lines in the <head>:

<link rel="stylesheet" type="text/css" href="<?php print $this->getStyleSheet('main.css'); ?>" />
<link rel="stylesheet" type="text/css" href="<?php print $this->getStyleSheet('typography.css'); ?>" />


The main.css file contains:

body {
   background:  url(images/img.jpg) repeat;
}


The problem is, when I view the site, the image cannot be found. The corresponding line in the generated CSS is:

background: url(http://www.my-domain.co.uk/themes/theme_abc/images/img.jpg) repeat;


Which looks right, but gives a 404.

I’m wondering whether this could be something to do with pretty URLs (which I have turned on) intercepting the URL of the image?

I’m not sure if it’s relevant, but the generated URL of the CSS file is:

http://www.my-domain.co.uk/index.php/tools/css/themes/theme_abc/main.css

 
Steevb replied on at Permalink Best Answer Reply
Steevb
On the face of it, it looks fine.

My stylesheet call is slightly different:

<link rel="stylesheet" href="<?php echo $this->getStyleSheet('style.css')?>">


Generated link is fine because you used 'getStyleSheet' as opposed to 'getThemePath'

Check your paths and asset placement again just to be sure everything is ok.
pjroberts replied on at Permalink Reply
Thank you :-)

I was so busy trying to understand the way that Concrete5 transforms a CSS file and how the templates work, that I forgot to check the permissions on the folder containing the template!