Jump to content

help, php tag within a php code snippit error


gibigbig

Recommended Posts

<?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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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-->

 

 

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

u know i have no idea :P

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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>

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
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.