Hello

I am trying to wrap my osticket application in drupal.

ostickets calls
include_once(header)
include_once(includefile)
include_once(footer)

I need to get the content of include_once(includefile_ and return to drupal view function as $output

Could someone please let me know how can I do this?

e.g
function osticket_page(){

$OSTICKET_PATH = drupal_module_path

$output = somehow include_once($OSTICKET_PATH."/includefile)

return $output
}

basically wrapping the content of include once file in an output variable..
Thanks in advance

Comments

kdecapite’s picture

Sounds like you want to use output buffering. Here's a modified snippet taken from the PHP documentation page readfile() function (http://us3.php.net/manual/en/function.readfile.php).

function osticket_page()
{
    ob_start();
    readfile('example.file'); // Use instead of include_once()
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}

I use this for my own (very simple) templating scheme on most of the (non-Drupal) sites I build. You may also want to look into http://us3.php.net/manual/en/function.file-get-contents.php as well. Hope this helps!

- Kevin