753 Posts in 312 Topics by 289 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 305 Views |
-
access widget in template outside of the sidebar

9 February 2012 at 12:11pm
Hi,
how could I access widgets in e.g. the <head> of a template file. I need to define some local CSS styles depending on the content of a widget, and the CSS should go into the head of the HTML.
I tried something like this
<style type="text/css">
<% control SideBar %>
<% control blogPosts %>
.latest-blog-post-$ID {
/* CSS here */
}
<% end_control %>
<% end_control %>
</style>but it doesn't work. I would appreciate any ideas.
Cheers!
Anatol -
Re: access widget in template outside of the sidebar

9 February 2012 at 12:21pm Last edited: 9 February 2012 12:23pm
Hm, why is the answer always obvious a minute after I posted here? Anyway, it might be helpful for others. This works:
<style type="text/css">
<% control SideBar %>
<% control Widgets %>
<% if class = LatestBlogPost %>
<% control blogPosts %>
.latest-blog-post-$ID {
/* CSS here */
}
<% end_control %>
<% end_if %>
<% end_control %>
<% end_control %>
</style>Maybe there's a shorter way with less nesting, but for now that's sufficient.
| 305 Views | ||
|
Page:
1
|
Go to Top |
