Jump to content

Recommended Posts

I need a variable to contain a bunch of HTML... something like this...

 

<?php
$html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n\n<html xmlns="http://www.w3.org/1999/xhtml">\n\n<head>\n\n<title>'.SITE_TITLE.' - '.$html->output->page_title.'</title>\n\n<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />\n\n<link type="text/css" rel="stylesheet" href="http://www.starwarsrevolution.net/main.css" />\n\n<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>\<script type="text/javascript" src="http://www.starwarsrevolution.net/js/contextmenu.js"></script>\n<script type="text/javascript" src="http://www.starwarsrevolution.net/js/matchcolumns.js"></script>\n\n</head>';
?>

 

But that looks messy as hell.. isn't there a way where I can type it like...

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title><?php echo(''.PAGE_TITLE.' - '.$html->output->page_title.''); ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<link type="text/css" rel="stylesheet" href="http://www.starwarsrevolution.net/main.css" />

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script type="text/javascript" src="http://www.starwarsrevolution.net/js/contextmenu.js"></script>
<script type="text/javascript" src="http://www.starwarsrevolution.net/js/matchcolumns.js"></script>

</head>

<body>

 

I'm sure there's a way to do it like

 

[EOF]>>

 

HTML here...

 

<<[EOF]

 

...or something like that, I saw it in one of IPB's (Invision Power Board's) files... but I can't find it again.

Link to comment
https://forums.phpfreaks.com/topic/72833-looks-messy/
Share on other sites

what you are looking for can be found here:

http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc

 

you could also use output buffering, explained here:

http://us.php.net/manual/en/function.ob-start.php

 

good luck

Link to comment
https://forums.phpfreaks.com/topic/72833-looks-messy/#findComment-367304
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.