Hello all and many thanks to the developers for such a powerful product. I am new to MODx, css and html so an ultra-newbie.
I am trying to call the css as a template variable and it is not working. I’ve spent many hours playing, troubleshooting, googling and searching the forums. There’s lots of information but, even after following the good how to’s, I’m still not working.
I’m running MODx 0.9.5 on Ubuntu 6.0.6 with MySQL 4.1.15 and PHP 5.1.2 and working in Firefox 1.5.0.11.
I do understand that I cannot use template variables within a css. For that, I’ve used a style tag in my template header to do things like control the background image. However, I’d like to be able to have the editors choose from among varying css for different sections of the site.
I created a TV named CSS with input type number, a default value of @INHERIT and no widget and assigned it to my basic template.
I created a folder named CSS and in it created a document named css_basic with an alias of basic2.css. It used a blank template, is not included in the menu, it is published, is not a container, is not searchable, is not rich text, is type text/css, does not log visits and is inline. It is a simple, functioning css and has been tested when called externally. The parent container is id 4 and the basic.css is id 5.
In my template, I’ve tried (not together but separately):
<link type="text/css" href="[(site_url)][~[*CSS*]~]" rel="stylesheet" />
<link type="text/css" href="[(site_url)][~5~]" rel="stylesheet" />
<style type="text/css">
@import url([(site_url)][~5~]);
#container { background: url([(site_url)]assets/images/[*BackgroundImage*]Trans.jpg);}
#mainbanner { background: url([(site_url)]assets/images/[*BackgroundImage*]Banner.jpg);}
</style>
Friendly URLs are enabled with no default extension and with friendly alias path enabled.
I set the template variable in my home page to "5". No matter what I do, it does not find the style sheet or does not parse it.
When I look at the source for my preview, I see:
<link type="text/css" href="
https://localhost/sow/4/basic2.css" rel="stylesheet" />
I do not want to use the alias. I’d like to use the TV value. What am I doing wrong? Thanks - John