Trying to create a style with {$page_alias}
Posted: Sun May 13, 2012 11:29 am
Hi All. Using CMSMS 1.10.3
I want to change a background image on a page.
Each image is named the same as the page alias. i.e. index.php?page=test-page should display a bg image called test-page.gif
If I write a style for every page, this will work. But I want a single style to do the job.
The html:
</__body class="{$page_alias}">
<div id="header2"> THIS IS THE DIV THAT WILL DISPLAY THE BG
<h2>{cms_selflink dir="start" text="$sitename"}</h2>
<hr class="accessibility" />
</div>
The style that works:
.{$page_alias} #header2 {
background: url([[root_url]]/uploads/images/test-page.gif) no-repeat right top; }
For the above style to work, I have to write a new style for every page and there will be 100's in time.
The style that fails:
.{$page_alias} #header2 {
background: url([[root_url]]/uploads/images/{$page_alias}.gif) no-repeat left top; }
Is the {$page_alias} bit not permitted in CSS? If so, do you know a work around?
Anyone done this or know how to do this?
Grateful for any help.
I want to change a background image on a page.
Each image is named the same as the page alias. i.e. index.php?page=test-page should display a bg image called test-page.gif
If I write a style for every page, this will work. But I want a single style to do the job.
The html:
</__body class="{$page_alias}">
<div id="header2"> THIS IS THE DIV THAT WILL DISPLAY THE BG
<h2>{cms_selflink dir="start" text="$sitename"}</h2>
<hr class="accessibility" />
</div>
The style that works:
.{$page_alias} #header2 {
background: url([[root_url]]/uploads/images/test-page.gif) no-repeat right top; }
For the above style to work, I have to write a new style for every page and there will be 100's in time.
The style that fails:
.{$page_alias} #header2 {
background: url([[root_url]]/uploads/images/{$page_alias}.gif) no-repeat left top; }
Is the {$page_alias} bit not permitted in CSS? If so, do you know a work around?
Anyone done this or know how to do this?
Grateful for any help.