Page 1 of 1

"Include" into a CMS $Content variable?

Posted: Sun Sep 02, 2007 8:06 am
by Ballam
Hey.

I'm working on a system I made about a year ago, and having a few problems. The system I used was to load the page, with a SWITCH, and depending on what the action GET variable was, I would load different data into a $content variable which would be displayed into the html layout.

That was all fine when I just wanted simple html and text etc... however now I am needing to output a table of MySQL results onto a page on there, i've made a php file to create the table etc, and I want it to be included into my html layout, however i'm not sure how to do it, as the "include" function isn't quite working in the way I had hoped!

Any help appreciated :oops:

Ballam

Posted: Sun Sep 02, 2007 8:33 am
by kaszu
You need to get output what is generated by that php file into $content variable?

Code: Select all

<?php
    //...

    ob_start();
    include('that_php_file_you_metioned.php');
    $content = ob_get_contents();
    ob_end_clean();

    //...
?>

Posted: Mon Sep 03, 2007 6:55 am
by Ballam
Thanks loads! Will give it a whirl next time I get some chance to do some programming :)