Forum Moderators: coopster
I want to do the following here is my attempt at an example
www.beer.com/molson/canadian/marketing/country/state/mode/1/ <---info I want.
www.beer.com/brands/marketing/bubba/ <--- Where I want to include the information from the link above.
So that every time my bubba page loads it pulls the information from mode/1/
Please Help,
Ryan
<html>
<head>
<title>includer</title>
<whatever else>
</head>
<body>
Valid so far...
<!-- next line is 'require("directory/includee.php");' -->
<html> <!-- see the problem? -->
<head>
<title>includee</title>
</head>
<body>
Content we were after with the include
</body>
</html>
Do we even see this?
</body>
</html>
ob_start();
require('directory/page.php');
$included_code = preg_replace(array(
"'(<[!\?][^>]+)?\s*<html\s*>.*?<body[^>]*>'",
"'</body\s*>\s*</html\s*>'"), '', ob_get_contents());
ob_end_clean();
echo $included_code;
Andreas
[edited by: andreasfriedrich at 8:44 pm (utc) on Nov. 14, 2002]
function crazy_callback($buf) {
return(preg_replace(array(
"'(<[!\?][^>]+)?\s*<html\s*>.*?<body[^>]*>'",
"'</body\s*>\s*</html\s*>'"), '', $buf));
}
#
ob_start('crazy_callback');
require('directory/page.php');
ob_end_flush(); Andreas
<edited>While the code is more elegant my use of an adjective instead of an adverb in my intoductory sentence was not. I hope I got it right this time.
BTW feel free to point out grammatical errors in my posts if you feel like it and have the time. Iīm always eager to improve my English.</edited>
[edited by: andreasfriedrich at 11:15 pm (utc) on Nov. 14, 2002]
And I learned something new: Output buffers are stackable. That is why this code will work even if output buffering is already used.
Andreas