[opencms-dev] Best location for resources like images and css

Yves Glodt yg at mind.lu
Tue Feb 26 08:56:24 CET 2008


On Monday 25 February 2008, RuiXian BAO wrote:
> Hello Yves,

Hello RuiXian,

> On Mon, Feb 25, 2008 at 11:49 AM, Yves Glodt <yg at mind.lu> wrote:
> > Hello,
> >
> > I successfully created a template, and I put css and images to the
> > resources/css and resources/images subfolders.
> >
> > This works well, but what bothers me is that when I want to link to an
> > image,
> > (which Editors will also have to do soon), they have to browse through
> > the /system folder deep into my template to find the image. I do not want
> > that editors can even enter into /system.
>
> Editors usually don't directly deal with css files. For images, you can
> change the image folder to the type of Image gallery, then edtiors can
> access  them when editing.

After reading your comment I think I will keep the css and template-related 
images in /system/modules/*/resources/images, and I will put just the 
content-related images to /sites/default/*/images. This way template and 
content are clearly separated, and editors can upload there, and stay out 
of /system/modules completely

> > Also, when I link to the css files from my template, currently I do like
> > this:
> > <link href='<cms:link>../../resources</cms:link>/css/main.css'
> > rel='stylesheet' type='text/css' />
> >
> > This feels strange for me... :-)
>
> You can use the absolute path starting with "/system", then OpenCms will
> correctly parse them by the aid of <cms:link>..</cms:link> tag.

Yes you are right of course, I have already changed my template to reflect 
that.

Thank you very much for your comments!
Best regards,

Yves

> > What speaks agains putting the images and css (or at least the images,
> > which
> > editors might need to upload or work with) into
> > the /sites/default/mysite.com/images folder?
>
> Not in a convention way, at least.
>
> Best
>
> - RuiXian
>
> > Then I could just do:
> > <link href='/css/main.css' rel='stylesheet' type='text/css' />
> >
> > Of course it would break the separation between content and template.
> > Could a sibling be a used for that?
> >
> > Best regards,
> > Yves



More information about the opencms-dev mailing list