gibigbig Posted April 27, 2007 Share Posted April 27, 2007 im trying to "include" a file with a php tag with the following code: <?php [junk code] include ('test.php'); [junk code] ?> i get the " include ('test.php'); " as plain text, is something wrong with my code? ??? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/ Share on other sites More sharing options...
snowdog Posted April 27, 2007 Share Posted April 27, 2007 paste up the entire code and I will look at it. Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240108 Share on other sites More sharing options...
gibigbig Posted April 27, 2007 Author Share Posted April 27, 2007 <?php include ('protect.php'); echo <<<html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://www.purl.org/dc"><head><title>PHP ADVANCE USER MANAGEMENT</title> <link rel="stylesheet" href="style.css"> <style type="text/css"> <!-- .style4 {font-size: 10px} .style5 {color: #66FF66} .style6 {font-size: 10px; color: #66FF66; } .style7 {color: #FF9900} .style8 { color: #FFFFFF; font-weight: bold; font-size: 16px; } .style10 {color: #66FF66; font-size: 16px; } --> </style> <body leftmargin="0" topmargin="0" bgcolor="#ffffff" marginheight="0" marginwidth="0" text="#000000"> <div align="center"> <!--top row: main navigation--> <!--UdmComment--> <table width="795" height="0" border="0" cellpadding="0" cellspacing="0"> <tbody><tr bgcolor="#ffffff"> <td width="347" height="0" bgcolor="#0F0F0F"><img src="pics/header.gif" width="347" height="131" /></td> <td width="448" background="pics/header_scatter.JPG" bgcolor="#ffffff"><p align="left" class="attribution style7" style="margin: 0.6em 0em; line-height: 1.2em;"><span class="attribution style7" style="margin: 0.6em 0em; line-height: 1.2em;"><span class="style8">WELCOME</span> <span class="style10">$clientname</span></span><span class="style10">,</span> <span class="style4">You are logged in. You can manage your account below. </span></p> <p align="right" class="attribution" style="margin: 0.6em 0em; line-height: 1.2em;"><font face="Arial Black"><span class="style4"><span class="style5"><a href="main.php">[HOME]</a></span></span></font><span class="style6"> [ <font face="Arial Black"><a href="inbox.php">INBOX</a> $tmsgs</font>] <font face="Arial Black"><a href="compose.php">[COMPOSE] [ </a><a href="memberlist.php">MEMBERLIST] </a></font></span></p> <p align="right" class="attribution style4 style5" style="margin: 0.6em 0em; line-height: 1.2em;"><font face="Arial Black"><a href="memberlist.php"> [ </a><a href="edituser.php">SETTINGS] [ </a><a href="uploadpic.php">UPLOAD PIC] [ </a><a href="index.php?id=logout">LOGOUT</a></font>] </p></td> </tr></tbody> </table> <table width="797" height="167" border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <td width="264" valign="top" background="pics/ok_01.gif"> </p> <div><br />include ('mangatop.php'); </div></td> <!--middle column: main content--> <td width="264" valign="top" background="pics/ok_02.gif"><p> </p> <p> </p> <p> </p></td> <!--right column: navigation--> <td width="263" valign="top" background="pics/ok_03.gif"><p> </p> <!--/UdmComment--></td> <td width="8" valign="top"><img src="pics/ok_04.gif" width="8" height="165" /></td> </tr></tbody> </table> <table border="0" cellpadding="0" cellspacing="0" width="794"> <tbody><tr> <td height="20" colspan="2"> </td> </tr> <tr><td height="1" colspan="2" bgcolor="#ffffff"></td></tr> <tr align="right"> <td width="369" height="93" background="pics/newletter.gif"><div align="left"></div></td> <td width="438" rowspan="3" background="pics/back.jpg"><div align="left"></div></td> </tr> <tr align="right"> <td height="166"><div align="left"><img src="pics/random.gif" width="363" height="218" /></div></td> </tr> <tr align="right"> <td height="114"><div align="left"><img src="pics/adver.gif" width="368" height="114" /></div></td> </tr> <tr><td height="20" colspan="2"><img src="pics/bottom.gif" width="803" height="188" /></td> </tr> </tbody> </table> <p> </p> </div> </body></html> html; ?> heres the code Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240114 Share on other sites More sharing options...
sanfly Posted April 27, 2007 Share Posted April 27, 2007 im trying to "include" a file with a php tag with the following code: <?php [junk code] include ('test.php'); [junk code] ?> i get the " include ('test.php'); " as plain text, is something wrong with my code? ??? Try speech marks rather than apostrophes. Something to do with absolute values maybe? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240115 Share on other sites More sharing options...
snowdog Posted April 27, 2007 Share Posted April 27, 2007 To me it looks like your trying to execute a php include inside of html code. You need to turn PHP on. I would try this html code <? include('myfile.php'); ?> continue with html code Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240118 Share on other sites More sharing options...
gibigbig Posted April 28, 2007 Author Share Posted April 28, 2007 yes, i'm trying to run a php file but instead in another php file when i go test the script, it just says include ('mangatop.php'); in plain text and the script is not executed. why is this? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240140 Share on other sites More sharing options...
sanfly Posted April 28, 2007 Share Posted April 28, 2007 1. Is the file you are using that code in a .php file? 2. Is php installed correctly? To check this, make a new file called phpinfo.php. inside that file, put the following code <? phpinfo(); ?> Upload the file and run it. Does the page display a whole bunch of info about your php installation? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240148 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 OK look at the code below <?php echo "hello world<br>"; ?> echo "hello world"; this will display hello world echo "hello world"; now This is a great day <?php , i should go out ?> echo "hello world"; This will error out as , i should go out isn't in the php syntax, NOW.. lets look at the code you posted <tbody><tr> <td width="264" valign="top" background="pics/ok_01.gif"> </p> <div> include ('mangatop.php'); </div></td> <!--middle column: main content--> again this will NOT parse the "include ('mangatop.php');" as its in the html (to be printed to screen) so to fix it <tbody><tr> <td width="264" valign="top" background="pics/ok_01.gif"> </p> <div> <?php include ('mangatop.php'); ?> </div></td> <!--middle column: main content--> Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240163 Share on other sites More sharing options...
gibigbig Posted April 28, 2007 Author Share Posted April 28, 2007 yes madtechie, i know about that. but if u look carefully at my code, you'll see the top and the bottom are already enclosed in php tags, so the include function should work anywhere inside these tags....right? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240283 Share on other sites More sharing options...
sanfly Posted April 28, 2007 Share Posted April 28, 2007 Did you try this? 1. Is the file you are using that code in a .php file? 2. Is php installed correctly? To check this, make a new file called phpinfo.php. inside that file, put the following code <? phpinfo(); ?> Upload the file and run it. Does the page display a whole bunch of info about your php installation? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240286 Share on other sites More sharing options...
gibigbig Posted April 28, 2007 Author Share Posted April 28, 2007 yes, my server uses php. i'm baffeled at this problem ??? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240287 Share on other sites More sharing options...
sanfly Posted April 28, 2007 Share Posted April 28, 2007 Okay, well whats this stuff here? echo <<<html Ive never used it before, but seen it a couple of times. Are you able to use php functions when using that sort of syntax? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240289 Share on other sites More sharing options...
gibigbig Posted April 28, 2007 Author Share Posted April 28, 2007 u know i have no idea this was from a premade login/logout script i downloaded and editing to suite my site it works fine, as you can see a my site www.narutoking.com/main.php however, for the life of me i cant figure out why i cant put another <?php tag inside another open <?php tag. i mean, it DOES make sense right? Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240291 Share on other sites More sharing options...
MadTechie Posted April 28, 2007 Share Posted April 28, 2007 it pulls html data into a string, ok my last post in this thread is a queation gibigbig how would you print "include ('mangatop.php');" to a html page ? and is <div> valid in php syntax. ok last question what would this do <?php echo "<div> include ('mangatop.php'); </div></td>"; ?> when you work them out your resolve the problem at hand. Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240293 Share on other sites More sharing options...
sanfly Posted April 28, 2007 Share Posted April 28, 2007 Thats a shame, im interested to know what that syntax is Try this code below. There are some UBBC tags in there I dont know why, but otherwise, does this work? <?php include ('protect.php'); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://www.purl.org/dc"><head><title>PHP ADVANCE USER MANAGEMENT</title> <link rel="stylesheet" href="style.css"> <style type="text/css"> <!-- .style4 {font-size: 10px} .style5 {color: #66FF66} .style6 {font-size: 10px; color: #66FF66; } .style7 {color: #FF9900} .style8 { color: #FFFFFF; font-weight: bold; font-size: 16px; } .style10 {color: #66FF66; font-size: 16px; } --> </style> <body leftmargin="0" topmargin="0" bgcolor="#ffffff" marginheight="0" marginwidth="0" text="#000000"> <div align="center"> <!--top row: main navigation--> <!--UdmComment--> <table width="795" height="0" border="0" cellpadding="0" cellspacing="0"> <tbody><tr bgcolor="#ffffff"> <td width="347" height="0" bgcolor="#0F0F0F"><img src="pics/header.gif" width="347" height="131" /></td> <td width="448" background="pics/header_scatter.JPG" bgcolor="#ffffff"><p align="left" class="attribution style7" style="margin: 0.6em 0em; line-height: 1.2em;"><span class="attribution style7" style="margin: 0.6em 0em; line-height: 1.2em;"><span class="style8">WELCOME</span> <span class="style10"><?php echo $clientname; ?></span></span><span class="style10">,</span> <span class="style4">You are logged in. You can manage your account below. </span></p> <p align="right" class="attribution" style="margin: 0.6em 0em; line-height: 1.2em;"><font face="Arial Black"><span class="style4"><span class="style5"><a href="main.php">[HOME][/url]</span></span></font><span class="style6"> [ <font face="Arial Black"><a href="inbox.php">INBOX[/url] <?php echo $tmsgs; ?></font>] <font face="Arial Black"><a href="compose.php">[COMPOSE] [ [/url]<a href="memberlist.php">MEMBERLIST] [/url]</font></span></p> <p align="right" class="attribution style4 style5" style="margin: 0.6em 0em; line-height: 1.2em;"><font face="Arial Black"><a href="memberlist.php"> [ [/url]<a href="edituser.php">SETTINGS] [ [/url]<a href="uploadpic.php">UPLOAD PIC] [ [/url]<a href="index.php?id=logout">LOGOUT[/url]</font>] </p></td> </tr></tbody> </table> <table width="797" height="167" border="0" cellpadding="0" cellspacing="0"> <tbody><tr> <td width="264" valign="top" background="pics/ok_01.gif"> </p> <div> <?php include ('mangatop.php'); ?> </div></td> <!--middle column: main content--> <td width="264" valign="top" background="pics/ok_02.gif"><p> </p> <p> </p> <p> </p></td> <!--right column: navigation--> <td width="263" valign="top" background="pics/ok_03.gif"><p> </p> <!--/UdmComment--></td> <td width="8" valign="top"><img src="pics/ok_04.gif" width="8" height="165" /></td> </tr></tbody> </table> <table border="0" cellpadding="0" cellspacing="0" width="794"> <tbody><tr> <td height="20" colspan="2"> </td> </tr> <tr><td height="1" colspan="2" bgcolor="#ffffff"></td></tr> <tr align="right"> <td width="369" height="93" background="pics/newletter.gif"><div align="left"></div></td> <td width="438" rowspan="3" background="pics/back.jpg"><div align="left"></div></td> </tr> <tr align="right"> <td height="166"><div align="left"><img src="pics/random.gif" width="363" height="218" /></div></td> </tr> <tr align="right"> <td height="114"><div align="left"><img src="pics/adver.gif" width="368" height="114" /></div></td> </tr> <tr><td height="20" colspan="2"><img src="pics/bottom.gif" width="803" height="188" /></td> </tr> </tbody> </table> <p> </p> </div> </body></html> Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240294 Share on other sites More sharing options...
gibigbig Posted April 28, 2007 Author Share Posted April 28, 2007 hey, i figured it out, all i had to do is close the old <?php tah before opening a new one. i removed the top and bottom <?php tags completely and left the little ones in between and the scripts works fine now. thanks for your help guys, couldnt have figured it without u. ps: admins, you can put htis thread as "solved" now Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240296 Share on other sites More sharing options...
sanfly Posted April 28, 2007 Share Posted April 28, 2007 You can hit the solved button yourself.... Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240299 Share on other sites More sharing options...
snowdog Posted April 28, 2007 Share Posted April 28, 2007 Ok this is an easy fix. If the code is being output to the screen then it is not being executed as php but as html. You need to turn php back on just before you execute the include and then turn it back off. So this code. <html> <some html code> include('mangatop.php'); <some more html code> </html> becomes this code <html> <some html code> <? start php include('mangatop.php'); ?> end php <some more html code> </html> By putting in the start <? and ?> end php it will execute the code of include('mangatop.php'); instead of outputting the wording to the screen Snowdog Quote Link to comment https://forums.phpfreaks.com/topic/49017-help-php-tag-within-a-php-code-snippit-error/#findComment-240304 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.