align-toparrow-leftarrow-rightbackbellblockcalendarcamerachatcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-crosscrosseditfacebookglobegoogleimagesinstagramlocation-pinmagnifying-glassmailmoremuplabelShape 3 + Rectangle 1outlookpersonplusImported LayersImported LayersImported Layersshieldstartwitteryahoo

Re: [javascript-12] underscore.js templates

From: alex k.
Sent on: Thursday, April 12, 2012 3:17 PM
I was pointing to that article because it describes a way of embedding
templates into HTML.



On Apr 12, 2012, at 2:54 PM, Janos Mucsi <[address removed]> wrote:

> Thanks but the problem is that the templating engine (ERB) will try to
> process the microtemplate and emit errors.
>
> On Thu, Apr 12, 2012 at 2:27 PM, alex kessinger <[address removed]> wrote:
>> http://ejohn.org/...­
>>
>> On Thu, Apr 12, 2012 at 2:17 PM, Janos Mucsi
>> <[address removed]> wrote:
>>>  Hi,
>>>
>>>  I need to embed an underscore.js template in an ERB or JSP. It uses
>>>  the <% %> syntax which I want to preserve (anybody has to be able to
>>>  edit the template).
>>>  What's the best way to embed the template so I can retrieve it with
>>>  jQuery for processing?
>>>  Any ideas?
>>>
>>>  One solution is to add this line in the ERB referencing the template
>>>  file. This avoids the processing of the <% %> tags:
>>>
>>>  <div id="template1"><­%=
>>> File.read(File.dirna­me(__FILE__)+"/templ­.file") %></div>
>>>
>>>  If I don't want to dynamically load the template (through Ajax), what
>>>  is an other solution?
>>>
>>>  Thanks.
>>>
>>>  Janos
>>>
>>>
>>>
>>> --
>>> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
>>> http://www.meetup...­
>>> This message was sent by Janos Mucsi ([address removed]) from BayJax - The Bay Area Ajax and JavaScript Meetup.
>>> To learn more about Janos Mucsi, visit his/her member profile: http://www.meetup...­
>>> Set my mailing list to email me
>>>
>>> As they are sent
>>> http://www.meetup...­
>>>
>>> In one daily email
>>> http://www.meetup...­
>>>
>>> Don't send me mailing list messages
>>> http://www.meetup...­
>>> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>>>
>>
>>
>>
>> --
>> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
>> http://www.meetup...­
>> This message was sent by alex kessinger ([address removed]) from BayJax - The Bay Area Ajax and JavaScript Meetup.
>> To learn more about alex kessinger, visit his/her member profile: http://www.meetup...­
>> Set my mailing list to email me
>>
>> As they are sent
>> http://www.meetup...­
>>
>> In one daily email
>> http://www.meetup...­
>>
>> Don't send me mailing list messages
>> http://www.meetup...­
>> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>>
>
>
>
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
> http://www.meetup...­
> This message was sent by Janos Mucsi ([address removed]) from BayJax - The Bay Area Ajax and JavaScript Meetup.
> To learn more about Janos Mucsi, visit his/her member profile: http://www.meetup...­
> Set my mailing list to email me
>
> As they are sent
> http://www.meetup...­
>
> In one daily email
> http://www.meetup...­
>
> Don't send me mailing list messages
> http://www.meetup...­
> Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]
>

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy