nurilized wrote:
Not sure I follow you. What do you mean by "no matter where they are
called from?"

i called <r:javascript name=xyz.js" /> from the content form
and it dumped everything in the place where i called it (inside body tag)
but i say it would be better if it is placed  between head tags (but there
could be some pitfalls to do this tho)

Now I've got you. First of all, this wouldn't be desirable all the time. There are plenty of times when you don't want your scripts to be in the <head> section but in the <body> -- particularly in a certain place within the body.

Now, to solve your need (I have the same one), here's what I've done:

In my layout:

<html>
 <head>
   ... some stuff ...
   <r:content part="head_scripts" />
   ... more stuff ...
 </head>
 <body>
   ...

and in your page you simply add a page part named "head_scripts" and insert:
 <r:javascript name="xyz.js" as="inline" />

and the layout will render the script for you and even wrap it in the <script> tag. You can also add other html attributes like <r:javascript as="inline" id="myId" /> and it'll pass those into the <script> tag.

Of course if you needed more control you could put the following in the layout:

<html>
 <head>
   ... some stuff ...
   <r:if_content part="head_scripts">
   <scripts>
   <r:content part="head_scripts" />
   ... some other scripts ...
   </scripts>
   ... more stuff ...
 </head>
 <body>
   ...

and in your page your "head_scripts" page part would contain:
 <r:javascript name="xyz.js" />

 also why not add a feature that will give just the src link for js/css
files
am i missing something?

You can do:
<r:javascript name="xyz.js" as="url" /> and get the path to the asset including the javascripts directory.

Or were you hoping for something like:
 <r:javascript name="xyz.js" as="link" />

that would yield:
 <script src="/path/to/xyz.js" type="text/javascript"></script>

Now that I think about it, the second solution would be ideal so that you could use the same layout solution to insert a bunch of links into the <head> section from a page part. Hmmm. I've got an updated version that wraps everything in CDATA and also moves my templates to Haml. I'll see if I can roll this into a release tomorrow.

-Chris
_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

_______________________________________________
Radiant mailing list
Post:   [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site:   http://lists.radiantcms.org/mailman/listinfo/radiant

Reply via email to