me1000 Posted November 26, 2006 Share Posted November 26, 2006 ok i have to define a variable but i want the contents to be visible in a WYSIWYG editor,so this is what i have come up with[code]<?$pagecode= ?><HTML>lalalalal</HTML><?;?>[/code]since I closed the PHP tags the WYSIWYG editor shows it in the editing windowhowever this doesnt work i get this errorParse error: parse error, unexpected ';' in /home/startr5/public_html/template/1.php on line 9this is 1.php[code]<?$id = "1" ; $title = "Main Page" ; $restricted = "0 " ; $keywords = "home page main " ; $type = "1" ; $pagecode = ?><lots of HTML><?;?>[/code]line 9 is the first "?>" tag there...any ideas how to get around this???Thanks, Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/ Share on other sites More sharing options...
markspec87 Posted November 26, 2006 Share Posted November 26, 2006 I doubt this will work but your missing " " after your = assignment anyway.[quote]<?$id = "1" ; $title = "Main Page" ; $restricted = "0 " ; $keywords = "home page main " ; $type = "1" ; $pagecode = "?><lots of HTML><?";?>[/quote] Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/#findComment-130348 Share on other sites More sharing options...
Philip Posted November 26, 2006 Share Posted November 26, 2006 [code]<?php$id = "1" ; $title = "Main Page" ; $restricted = "0 " ; $keywords = "home page main " ; $type = "1" ; $pagecode = "<lots of HTML>";?>[/code]if you do it that way, make sure to not have any double quotes Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/#findComment-130352 Share on other sites More sharing options...
me1000 Posted November 26, 2006 Author Share Posted November 26, 2006 so make sure i use single quotes in the code im showing you?BTW if i do this...[code]$pagecode = "?><lots of HTML><?";?>[/code]the ?> is considered part of the quote Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/#findComment-130355 Share on other sites More sharing options...
Philip Posted November 26, 2006 Share Posted November 26, 2006 well, if you use the $pagecode = "?> ... <?"; - it will show the php tags:[code]<?php$pagedata = "?><b>hi</b><?php ";echo $pagedata; ?>[/code]has an output of:?> [b]hi[/b]--Thats why I wouldn't bother putting in the ?> <? tags, there is no need for them. Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/#findComment-130358 Share on other sites More sharing options...
me1000 Posted November 26, 2006 Author Share Posted November 26, 2006 If i dont close the php tags then it defeats he purpose of doing it this way,I want to be able to see that code in a WYSIWYG editor so i dont have to hand edit it... Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/#findComment-130359 Share on other sites More sharing options...
kenrbnsn Posted November 26, 2006 Share Posted November 26, 2006 WYSIWYG editors and PHP really do not get along. If you're going to write PHP that generates HTML code, learn how to write good HTML code by hand and don't try to warp what PHP does.That being said, using the [url=http://www.php.net/manual/en/language.types.string.php]Heredoc format[/url] (about 1/2 way down the page) might be what you're looking for.[code]<?php$some_var = <<<EOT<lots of html>EOT;?>[/code]Ken Quote Link to comment https://forums.phpfreaks.com/topic/28485-tricking-php/#findComment-130364 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.