PHP within a string of HTML
Posted: Sat Nov 08, 2008 10:31 am
I have a PHP page that is used to create a web page. The PHP code has mutiple strings that are concatenated together and then printed to create the web page. The issue I have is that I cannot include any PHP within that string. I know I am missing something, but don't know what. Any help would be appreciated.
My string in PHP looks as follows (25 lines):
If I remove the PHP code in the <!-- #BeginEditable "scripts" --> section, the page works fine. I know it has to do with the closing PHP tag as it then thinks the code is done, but I cannot figure out how to get it to think that the PHP tags in the string are just a part of the string.
Also, all 25 lines of my code are there, but you have to scroll down within the code window.
Thanks,
Merg
My string in PHP looks as follows (25 lines):
Code: Select all
$htmltop = <<<TopOfPage
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<!-- #BeginTemplate "../styles/integral.dwt" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="en-us" />
<!-- #BeginEditable "scripts" -->
<?php
if(!empty($_GET['OrigRef'])) {
$orig_referer = urldecode($_GET['OrigRef']);
print <<<EndOfWeRemembered
<meta http-equiv="Refresh" content="8;URL=$orig_referer" />
EndOfWeRemembered;
}
?>
<!-- #EndEditable -->
<meta name="Keywords" content="" />
<meta name="Description" content="" />
<link href="../styles/default.css" rel="stylesheet" type="text/css" />
</head>
<body>
TopOfPage;
Also, all 25 lines of my code are there, but you have to scroll down within the code window.
Thanks,
Merg