Jump to content

Archived

This topic is now archived and is closed to further replies.

4xjbh

twig: pass include to div for popup

Recommended Posts

I have a div I use for dialogs and I want to pass a string to the div and then show the specific twig template as an include. The div dialog is displayed without the template embedded, What am I doing wrong, is there a better way to do it?

$('#new').click( function() {
   var str = " {% include 'catalogue_form.html' %} ";
   $('#dialog').text(str).html();
  showDialog();
});


function showDialog() {             
   $('#dialog_wrapper').fadeIn();
   $('#dialog').fadeIn("slow");                     
} 

Thanks in advance, James

Share this post


Link to post
Share on other sites

Surely you are better of putting the content in the actual div instead of into a Javascript variable?

 

<div id="dialog">
{% include 'catalogue_form.html' %}
</div>

Share this post


Link to post
Share on other sites

Yes I could but single.html (master layout) would not be able to be used for say contacts because I would need to include contacts_form.html

 

If I have single.html and contact.html that extends single.html how do I assign note.html, review.html, expense.html (dialog templates) to the one div if I cannot dynamically assign it based on the selected action. Do I have to have 3 divs with display:none, and individual includes?

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.