|
Posted by Joe Estock on 06/25/06 15:26
Ben Holness wrote:
> Hi all,
>
> I have a function, say:
>
> function printTable($Variables)
> {
> ?>
> <table>
> <tr><td>Your name is</td></tr>
> <tr><td>
> <?php
> print $Name;
> print "</td></tr></table>";
> }
>
> (Obviously not my exact function, but a simple one to demonstrate my
> needs... The function I have inherited is much bigger with much mixed php
> and html like the example)
>
> It is currently used to print the same data table on many pages.
> I have been asked to have the system send this data table by email, so
> what I want to do is run the function, but send the output of the function
> to a variable, in the same way that print_r($arr,1) will return the output
> instead of printing it.
>
> Is this possible?
>
> Cheers,
>
> Ben
>
>
Try output buffering.
ob_start();
callMyNiftyFunction();
$contents = ob_get_contents();
ob_end_clean();
Navigation:
[Reply to this message]
|