On Friday 20 August 2010 04:20 AM, Wyatt Baldwin wrote:
You can put Mako/JS templates in your templates directory and then
render them from your HTML template with something like<script src="$
{url('/templates/javascripts/whizbang.js')}"></script>.
NO, the problem at hand is not that complex and large.
Otherwise, if you're writing the JS inline in the HTML template (ew?),
then you should just be able to use `c` in the usual way:
<script>
var get_pants = function () {
var pants = '${c.pants}';
return pants;
}
var make_stuff_from_list = function () {
% for thing in c.list_of_things:
new Thing('${thing.title}', ${thing.quantity});
% endfor
}
</script>
Oh, does this work?
I remember last time I tryed to use ${h.url_for} inside a javascript and
it did not work.
May be things have improved after that?
Any ways, I must also mention that when I had tryed to use the ${}
syntax inside a javascript function, the script was inside a header
section and not inside a body section.
could that be a problem?
Happy hacking.
Krishnakant.
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.