AbstractFire Posted November 24, 2007 Share Posted November 24, 2007 So I discovered heredoc syntax recently (<<<EOF blah blah EOF;) and I want to be able to use it. Problem is that I have multiple classes (a member management class, group management, skin templates, etc.) and I want to know I can make this work across classes and such. $this->afscore->html = <<<EOF <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <head> <meta http-equiv="Content-Language" content="en-us" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Admin CP</title> <link rel="stylesheet" type="text/css" href="{$SOURCEPATH}stylesheet_global.css" /> <link rel="stylesheet" type="text/css" href="{$SOURCEPATH}stylesheet_menubar.css" /> <script type="text/javascript" src="sources/admin_source/menubar.js"></script> </head> <body> <!--End of Header--> EOF; The code above is part of my template class. afscore is the main class. But, if I'm in another class, It doesn't work right.... I hope I made enough sense here for someone to help me >< Link to comment https://forums.phpfreaks.com/topic/78652-heredoc-syntax-and-classes/ Share on other sites More sharing options...
trq Posted November 24, 2007 Share Posted November 24, 2007 I hope I made enough sense here for someone to help me Nope. What is the problem? Link to comment https://forums.phpfreaks.com/topic/78652-heredoc-syntax-and-classes/#findComment-397983 Share on other sites More sharing options...
PHP_PhREEEk Posted November 24, 2007 Share Posted November 24, 2007 I believe his problem was: But, if I'm in another class, It doesn't work right.... whatever "doesn't work right" means to him... = D PhREEEk Link to comment https://forums.phpfreaks.com/topic/78652-heredoc-syntax-and-classes/#findComment-397995 Share on other sites More sharing options...
AbstractFire Posted November 26, 2007 Author Share Posted November 26, 2007 Ok. Let me try this again since I wasn't thinking straight before. I want to use Heredoc Syntax in my application. The problem is using it in multiple classes and trying to add to it. I have a main class that I use for database connection and other things and that is where I want to keep my variable that holds the HTML until I print it. One example is that I am in a different class editing a user and want to add to the current code using heredoc. $this->mainclass->html .= <<<EOF Blah blah. EOF; Problem is when I tried this, it didn't work. What do I need to do? Link to comment https://forums.phpfreaks.com/topic/78652-heredoc-syntax-and-classes/#findComment-399101 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.