On Sun, Jul 29, 2012 at 1:18 PM,
<rouslan@placella.com> wrote:
rouslan@placella.com ha scritto:
Thilina Buddika Abeyrathna <thilinaabeyrathna@gmail.com> ha scritto:
Hi Rouslan,
How do I use addHtml() function for the following type code,
<div class="-------">
<?php include('libraries/example.php'); ?>
</div>
I tried,
$response->addHTML(<div class="........">)
include 'libraries/example.php'
$response->addHTML(</div>)
But nothing displayed.
Something like this:
$response->addHTML('<div class="someClass">');
ob_start();
include 'libraries/example.php';
$content = ob_get_contents();
ob_end_clean();
$response->addHTML($content);
$response->addHTML('</div>');
Oh, and ideally, you'd refactor the library, so that there is a function to call, then the above can be reduced to:
include 'libraries/example.php';
$response->addHTML('<div class="someClass">');
$response->addHTML(someFunction());