You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Jim Roycroft <ji...@codesilver.ca> on 2007/11/02 05:38:28 UTC
[T4] One way to get the context path when you need to inject it
straight into HTML
I just thought I'd share my experience with this one... and I'd love to hear
about alternate ways that involve even less code! Although this isn't bad at
all. Anyway:
Here's what I needed to put in the html:
<style type="text/css" media="screen">
<!-- This is an IE6 and below hack to make the menu work. -->
body{ behavior: url(/scripts/csshover2.htc); }
</style>
Note the path to csshover2.htc, obviously it's going to break if I don't get
the context path in there. Here's my solution:
<style type="text/css" media="screen">
<!-- This is an IE6 and below hack to make the menu work. -->
body{ behavior: url(); }
</style>
And:
@Asset("/scripts/csshover2.htc")
public abstract IAsset getCssHoverScript();
In the backing class.
Now I can run the app with any context path I like, for example
'squirrelycontext', and the asset will generate
'/squirrelycontext/scripts/csshover2.htc' for my HTML.
Cheers,
Jim
--
View this message in context: http://www.nabble.com/-T4--One-way-to-get-the-context-path-when-you-need-to-inject-it-straight-into-HTML-tf4735543.html#a13542208
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org
Re: [T4] One way to get the context path when you need to inject it straight into HTML
Posted by Kalle Korhonen <ka...@gmail.com>.
Thanks Jim, good stuff! I was pondering about the same issue just the other
day.
Kalle
On 11/1/07, Jim Roycroft <ji...@codesilver.ca> wrote:
>
>
> The mailinglist/nabble formatting cut out some stuff... here's the
> relevant
> snippet:
>
>
> Jim Roycroft wrote:
> >
> > ...
> >
> > Note the path to csshover2.htc, obviously it's going to break if I don't
> > get the context path in there. Here's my solution:
> >
> > <style type="text/css" media="screen">
> > <!-- This is an IE6 and below hack to make the menu work. -->
> > body{ behavior: url(< span jwcid="@Insert"
> > value="ognl:cssHoverScript.buildURL()" / >); }
> > </style>
> >
> > ...
> >
>
> --
> View this message in context:
> http://www.nabble.com/-T4--One-way-to-get-the-context-path-when-you-need-to-inject-it-straight-into-HTML-tf4735543.html#a13542238
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>
Re: [T4] One way to get the context path when you need to inject it
straight into HTML
Posted by Jim Roycroft <ji...@codesilver.ca>.
The mailinglist/nabble formatting cut out some stuff... here's the relevant
snippet:
Jim Roycroft wrote:
>
> ...
>
> Note the path to csshover2.htc, obviously it's going to break if I don't
> get the context path in there. Here's my solution:
>
> <style type="text/css" media="screen">
> <!-- This is an IE6 and below hack to make the menu work. -->
> body{ behavior: url(< span jwcid="@Insert"
> value="ognl:cssHoverScript.buildURL()" / >); }
> </style>
>
> ...
>
--
View this message in context: http://www.nabble.com/-T4--One-way-to-get-the-context-path-when-you-need-to-inject-it-straight-into-HTML-tf4735543.html#a13542238
Sent from the Tapestry - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org