Page 1 of 1

External page

Posted: Wed Mar 24, 2004 3:56 am
by insane
Howzit ppl

This might be a dumb question but I'm trying to make the result of a page a variable, say for example this external page's name is page.php and the other page with the main code that i'm working on is called help.php. Here is an example of what I think it must look like but I know its wrong. I hope this gives you an idea of what I'm tying to do

<?php //this page is called help.php

$myvariable = (page.php)

echo ("$myvariable")

?>

You will notice that (page.php) is where I want the external page (almost like a .css page) to be included as a variable.

Any Ideas?

Posted: Wed Mar 24, 2004 4:00 am
by markl999
You could use output buffering to do it.

Code: Select all

ob_start();
require_once 'page.php';
$myvariable = ob_get_contents();
ob_end_clean();
echo $myvariable;
(though i'm not sure why you'de want to contents of a php file in a variable ;))

Posted: Wed Mar 24, 2004 4:02 am
by insane
thanx i'll give it a try :lol:

Posted: Wed Mar 24, 2004 7:26 am
by magicrobotmonkey
hey! lets say page.php was a page that output a pdf file - could I use this to send that as an attachment in a mime email?

Posted: Wed Mar 24, 2004 1:24 pm
by markl999
Sure.