3212 Posts in 847 Topics by 809 members
| Go to End | ||
| Author | Topic: | 3747 Views |
-
Re: <% require %> custom CSS

23 April 2009 at 11:51am
am I missing something here....doesn't the customCSS requirement just stick it in the <head> section of the page anyway??
-
Re: <% require %> custom CSS

23 April 2009 at 3:19pm
Yeah, I'm not sure what the problem is. Requirements will always put them in the right place.
Adding requirements from the template is a relatively new feature. You could add a feature request for more power in the customCSS method, at http://open.silverstripe.com, or just do the old way (adding it to your page class).
-
Re: <% require %> custom CSS

23 April 2009 at 7:39pm
Because the <% require %> feature isn't allowing me to reference a variable inside it?
-
Re: <% require %> custom CSS

23 April 2009 at 10:16pm
function init() {
parent::init();
Requirements::customCSS( "background : url(" . $this->LeftBlock2_Image()->URL . ");");
}
Thats off the top of my head so the syntax may be slightly different but you get the idea.
-
Re: <% require %> custom CSS

24 April 2009 at 10:31am
Thanks Aram for all your help - it's really appreciated!
I'll give that a go and post the code I succeed with (well hopefully)
-
Re: <% require %> custom CSS

27 April 2009 at 6:12am
I got this working by using Arams suggestion. I put the following code inside the init function of my Page_Controller
if($this->TopImage()->ID) {
Requirements::customCSS(".top-image { background : url(".$this->TopImage()->URL.") no-repeat !important; height : ".$this->TopImage()->getHeight()."px !important; }");
}Thanks for helping Aram and Hamish
| 3747 Views | ||
| Go to Top |



