Alternate string variable definition in PHP?
Posted: Sat Dec 18, 2004 1:53 pm
Hello everyone. I'm trying to define a variable that contains a large amount of HTML code, but I want that HTML code to contain both " and ' characters. I defined a skeleton function that just prints the general page format with two variables, one for the page title and one for the page content, which is to be located in a center cell of a table.
I have code like that shown below on all of the pages, which defines the HTML content for the cell in the skeleton page. Whenever I run one of these pages, I get a parse error (at the <h2>You PARSE ERROR when I use a ' in the definition, or at one of the HTML tags when I use the " for definition.)
I was wondering if anyone knows a smarter way to do this, or perhaps some way to let php define variables with a character I'd rarely use in my html, such as :
$variable = ~Hey~;
Using frontpage, so I'm using <% %> tags, and have already turned that option in the php.ini to "1".
Any help is appreciated,
James.
I have code like that shown below on all of the pages, which defines the HTML content for the cell in the skeleton page. Whenever I run one of these pages, I get a parse error (at the <h2>You PARSE ERROR when I use a ' in the definition, or at one of the HTML tags when I use the " for definition.)
I was wondering if anyone knows a smarter way to do this, or perhaps some way to let php define variables with a character I'd rarely use in my html, such as :
$variable = ~Hey~;
Using frontpage, so I'm using <% %> tags, and have already turned that option in the php.ini to "1".
Code: Select all
<%
include "skeleton.php";//this includes the skeleton function.
//define the content of the page in HTML between these lines.
$pagecontent = '%>
<h2>You're one step closer to doing the right thing:</h2>
<div align="left">
<table border="0" id="table1" width="500" bgcolor="#C0C0C0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</div>
<%';
//END define the content of the page in HTML between these lines.
$pagetitle = "Page title";
skeleton($pagetitle, $pagecontent);
%>James.