chiquero Posted November 3, 2009 Share Posted November 3, 2009 Basically, I'm trying to get phpMyEdit to work with the Smarty template engine. There doesn't seem to be an easy way to do this since the only way to display the results of phpMyEdit tables is to call the constructor: new phpMyEdit($opts); ...phpMyEdit will then generate the table with a series of echo statements. But it seems the only way to use the Smarty template is to feed the template file a bunch of variables. ... $smarty->assign('var', $var); $smarty->display('template.tpl.php'); So I would somehow have to get phpMyEdit to return a string of all its output. Or maybe there is some way to encapsulate the echo statements into a buffer, bypass display and then store them in a string to send to the template engine. I can't easily replace phpMyEdit since my client is committed to it, but I can use a different template engine if an alternate would solve this problem. Thanks to anyone who can help!! Link to comment https://forums.phpfreaks.com/topic/180055-use-phpmyedit-in-a-smarty-template-encapsulate-echoprint-statements/ Share on other sites More sharing options...
chiquero Posted November 3, 2009 Author Share Posted November 3, 2009 Solved. I found this http://www.tequilafish.com/2009/02/10/php-how-to-capture-output-of-echo-into-a-local-variable/ which explains how to turn manipulate and store the output buffer using ob_start(). Here's the code: // Store echo in string instead of displaying ob_start(); new phpMyEdit($opts); $pme_content = ob_get_contents(); ob_end_clean(); // Now pass string into the Smarty template $smarty->assign('content', $pme_content); $smarty->display('template.tpl.php'); I hope this helps someone out there who runs into this problem. Link to comment https://forums.phpfreaks.com/topic/180055-use-phpmyedit-in-a-smarty-template-encapsulate-echoprint-statements/#findComment-949898 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.