Aureole Posted October 11, 2007 Share Posted October 11, 2007 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 More sharing options...
Orio Posted October 11, 2007 Share Posted October 11, 2007 Yes, using the HEREDOC syntax. Orio. Link to comment https://forums.phpfreaks.com/topic/72833-looks-messy/#findComment-367299 Share on other sites More sharing options...
freakstyle Posted October 11, 2007 Share Posted October 11, 2007 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 More sharing options...
Aureole Posted October 11, 2007 Author Share Posted October 11, 2007 Thank you very much, can I make the identifier anything I want and does it have to be 3 characters? Like could I use... $html = <<<HTML Heredoc syntax is great. HTML; Thanks for the link to output buffering, I'll read up on it... Link to comment https://forums.phpfreaks.com/topic/72833-looks-messy/#findComment-367306 Share on other sites More sharing options...
Orio Posted October 11, 2007 Share Posted October 11, 2007 It doesn't matter the length Orio. Link to comment https://forums.phpfreaks.com/topic/72833-looks-messy/#findComment-367308 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.