RE: Re: How to take output from an include, and embed it into a variable?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Output buffering will do it.

Also I am not sure but did you try retrieving content with fopen() ?

Something like

$file = 'invoicetable_bottom.php';
fopen("http://yoursite.com/folder/$file","r";);

http://tr.php.net/function.fopen

worth trying. Easier than output buffering

-----Original Message-----
From: Puiu Hrenciuc [mailto:hpuiu@xxxxxxxxx]
Sent: Wednesday, September 23, 2009 1:36 PM
To: php-general@xxxxxxxxxxxxx
Subject:  Re: How to take output from an include, and embed it into a variable?

Hi,

The simplest way (actually the single way I know :) ) would be to
capture the output using output buffering functions, something like this:

// start output buffering
ob_start();

// include the file that generates the HTML (or whatever content)
include "....";

// get output buffer content
$output=ob_get_contents();

// clean output buffer and stop buffering
ob_end_clean();

// the content generated in the included file is now in $output variable
// use it as you consider fit
.........


Regards,
Puiu


Rob Gould wrote:
> I have an invoice table that is drawn on a number of pages, so I have
> all the logic in an include-file like this:
>
> include "invoicetable_bottom.php";
>
>
> However, now I'm needing to take the output from that include file and
> pass it as an email.  To do that, I need to somehow take the output from
> this include file and get it into a variable somehow.  Is there a simple
> way to do this?
>
> Something like:  $emailtcontent = include "invoicetable_bottom.php"?

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



  ________________________________
Bu mesaj ve ekleri, mesajda g?nderildi?i belirtilen ki?i/ki?ilere ?zeldir ve gizlidir. Size yanl??l?kla ula?m??sa l?tfen g?nderen kisiyi bilgilendiriniz ve mesaj? sisteminizden siliniz. Mesaj ve eklerinin i?eri?i ile ilgili olarak ?irketimizin herhangi bir hukuki sorumlulu?u bulunmamaktad?r. ?irketimiz mesaj?n ve bilgilerinin size de?i?ikli?e u?rayarak veya ge? ula?mas?ndan, b?t?nl???n?n ve gizlili?inin korunamamas?ndan, vir?s i?ermesinden ve bilgisayar sisteminize verebilece?i herhangi bir zarardan sorumlu tutulamaz.

This message and attachments are confidential and intended for the individual(s) stated in this message. If you received this message in error, please immediately notify the sender and delete it from your system. Our company has no legal responsibility for the contents of the message and its attachments. Our company shall have no liability for any changes or late receiving, loss of integrity and confidentiality, viruses and any damages caused in anyway to your computer system.

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux