Page 1 of 1

Using page content in stylesheets

Posted: Tue Jun 10, 2008 10:06 pm
by dwinters
Can I use page content in a stylesheet

Say for backgroung images the css reads

.teamlist {
background-image:url("uploads/images/test.jpg");
float:left;
width:469px;
height:202px;
padding:0px 0px 0px 0px;
border-right: 2px solid #fff;
}

I would like it to read

.teamlist {
background-image:url("{content block="imagestring"}");
float:left;
width:469px;
height:202px;
padding:0px 0px 0px 0px;
border-right: 2px solid #fff;
}


Or a variable I could have a user change in the page view.
Is there a way?
Thanks
Dan

Re: Using page content in stylesheets

Posted: Tue Jun 10, 2008 10:25 pm
by calguy1000
unfortunately no, well not yet anyways.

However, you can put style tags in the header, and use smarty on them.

so in your stylesheet you can do:

.teamlist {
float:left;
width:469px;
height:202px;
padding:0px 0px 0px 0px;
border-right: 2px solid #fff;
}

then in the page template something like this:


{literal}
.teamlist {
{/literal}
  background-image: url("{$some_smarty_variable_or_tag}");
{literal}
}
{/literal}

Re: Using page content in stylesheets [solved]

Posted: Tue Jun 10, 2008 10:30 pm
by dwinters
Thanks for that read some thing like in that in your post telling us to read the Smarty manual which is now printed out and by my bed!

RTFM becomes RTSM !

Thanks for making that clear, great answer.