4xjbh Posted July 31, 2013 Share Posted July 31, 2013 (edited) 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 Edited July 31, 2013 by 4xjbh Quote 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> Quote 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? Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.