Interesting .. will give this a shot but just FYI - I'm using if_url in the HEAD section of the layout.
I'm still curious why it's not matching. I think that's the real question. And I completely failed to mention that I'm trying to do this in a layout. Does the <r:if_url> tag work within layouts? Thanks! On Feb 21, 4:46 pm, Anton J Aylward <[email protected]> wrote: > craayzie said the following on 02/21/2011 07:22 PM: > . > > > I'm trying to use if_url to conditionally include jquery on my / > > contact page but it doesn't seem to be working: > > > <r:if_url matches="^/contact"> > > <script type="text/javascript" > > src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"> > > </script> > > </r:if_url> > > > Any ideas what I might be doing wrong? > > I don't know about "doing wrong" > but I have something that works. > > In my layout I have this > > <head> > <meta http-equiv="content-type" content="text/html; charset=utf-8" /> > ..... > <r:if_content part="head"> > <r:content part="head" /> > </r:if_content> > .... > </head> > > Why do I do this? > > I'm one of those obsessive people who think that script and css belong > in the <HEAD> and not in the <BODY> > This lets me set up a page part which means that if any page needs > special JS or CSS is can have it ... in the <HEAD> > > Now if you were to add in there > > inherit="true" > > you could put a page-part "head" in the "/contact" > with the JS and it would apply to everything below it. > > which is what you are trying to achieve. > > And it would not appear in any other pages. > No need for the <r:if_ur> > > You've localised the scope of the impact and made it much more general, > something that can be applied and expanded later without the need to > revise your layout. > > As for the syntax of your <script> ..... > Dunno. But now, sicne its in the head, it should work sicne it looks > like all the JS I have in my <HEAD> sections > > -- > Experience teaches only the teachable. > Aldous Huxley (1894 - 1963)
