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="";>
>       </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

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <r:if_content part="head">
            <r:content part="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


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)

Reply via email to