On Wed, Feb 3, 2010 at 4:48 PM, Pablo Antonio <[email protected]> wrote:
> On Tue, Feb 02, 2010 at 10:13:13PM -0800, alecwh wrote:
>> Hello list,
>
> Hello,
>
>>
>> I'm trying to run several javascript (specifically jQuery)  files
>> through the the web.py filtering system, but I'm encountering an
>> obvious problem: jQuery uses the '$' sign a lot. And that also the
>> sign that the web.py templator system uses... which means I would need
>> to escape all the dollar signs, like in this example:
>
> I'm not sure why you're doing this but the two alternatives I can think
> of right now make me think you're doing something wrong:
> 1) If you're doing this because you're using the template engine to
>   process the HTML output, but you have Javascript embedded in the HTML
>   code, then you should consider putting the Javascript into separate
>   files. Thus, you won't need to make the Javascript be processed by
>   Templetor.
> 2) If you're doing this because you're using the template engine to
>   process Javascript itself, that, in my experience, doesn't sound
>   really nice. Maybe you should write your HTML so that you don't need
>   to change the Javascript every time so it works.
>
> Can you tell us why you're doing this? Maybe there's another alternative
> I haven't considered.

I've used this kind of templating for JS when I had situations where I
can only know the ID's of some elements at run-time (for example, if I
need a specific <li> element, whose ID is tied to a row in the
database). In such cases, I'd make an AJAX request that waits for
jQuery code to be sent back by the server. That's where I'd use a
template.

-- 
Branko Vukelić

http://foxbunny.tumblr.com/
http://www.flickr.com/photos/16889...@n04/
http://www.twitter.com/foxbunny
http://github.com/foxbunny

-- 
You received this message because you are subscribed to the Google Groups 
"web.py" 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/webpy?hl=en.

Reply via email to