"Include" into a CMS $Content variable?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Ballam
Forum Newbie
Posts: 4
Joined: Sun Sep 02, 2007 7:32 am

"Include" into a CMS $Content variable?

Post 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
User avatar
kaszu
Forum Regular
Posts: 749
Joined: Wed Jul 19, 2006 7:29 am

Post 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();

    //...
?>
Ballam
Forum Newbie
Posts: 4
Joined: Sun Sep 02, 2007 7:32 am

Post by Ballam »

Thanks loads! Will give it a whirl next time I get some chance to do some programming :)
Post Reply