I have just made a first template in modx. i am a newbie. my images are in folder: ’assets/images1’.
my css file is in assets/css directory. My resource path in interface is F:/xampp/htdocs/modx-0961p2/assets/and resource url is ’assets’.when in css file I give the background url:(images1/x.gif)or url (assets/images1/x.gif), the image file is inaccessible.
fed up I copied a template from wiki and copied the css file and images respectively in directory :’assets/templates/tutorials/css/y.css’ and ’assets/templates/tutorials/images/x.gif.’ as per the template the link to css is <link rel="stylesheet" type="text/css" href="[(base_url)]/assets/template/tutorial/css/airbiopflayout.css" />whereas the link to image file is
url(../images/x.gif) no-repeat bottom;In this case the image is viewable in browser.
what errors are being committed by me that I am unable to access the files in /assets/images1.
Will you please give an example of how to use ="[(base_url)]’ when to use and when not?
or should I stop fiddling with modx.
I am in a fix.Help
vkwd7
The path to the images in your CSS file are relative to the CSS file so :
If your CSS file is in assets/CSS/ and the images are in assets/images1/ the correct path in your CSS to the image would be (../images1/x.gif)
To call the CSS file in your template :
Define the base url ( a good precaution ) :
<base href="[(site_url)]"></base>
Add the link :
<link rel="stylesheet" href="assets/css/your.css" type="text/css" media="screen" />
That should do it.
thanks!
I have tried meticulously the above guidelines which, no doubt, are o.k. But I still canot load the images unless the css file & images file are in templates/tutorial folder. What may be the possible causes of the errors on my part?/
Are there some built in features which make the css and images file to load only in template folders.
vkwd7
thanks ! it is solved. the error was on my part as while writing the code I put url: (..images/x.gif) instead of url(..images/x.gif).
So easy to do, so hard to find!
what a cool observation! thanks