Using page content in stylesheets

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
dwinters
Forum Members
Forum Members
Posts: 53
Joined: Mon Mar 17, 2008 12:46 pm

Using page content in stylesheets

Post 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
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Using page content in stylesheets

Post 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}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
dwinters
Forum Members
Forum Members
Posts: 53
Joined: Mon Mar 17, 2008 12:46 pm

Re: Using page content in stylesheets [solved]

Post 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.
Post Reply

Return to “CMSMS Core”