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?
External page
Moderator: General Moderators
You could use output buffering to do it.
(though i'm not sure why you'de want to contents of a php file in a variable
)
Code: Select all
ob_start();
require_once 'page.php';
$myvariable = ob_get_contents();
ob_end_clean();
echo $myvariable;-
magicrobotmonkey
- Forum Regular
- Posts: 888
- Joined: Sun Mar 21, 2004 1:09 pm
- Location: Cambridge, MA