4xjbh Posted July 31, 2013 Share Posted July 31, 2013 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 Link to comment https://forums.phpfreaks.com/topic/280661-twig-pass-include-to-div-for-popup/ Share on other sites More sharing options...
trq Posted July 31, 2013 Share Posted July 31, 2013 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> Link to comment https://forums.phpfreaks.com/topic/280661-twig-pass-include-to-div-for-popup/#findComment-1442753 Share on other sites More sharing options...
4xjbh Posted August 1, 2013 Author Share Posted August 1, 2013 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? Link to comment https://forums.phpfreaks.com/topic/280661-twig-pass-include-to-div-for-popup/#findComment-1443040 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.