?
Solved

PHP unexpected T_CONSTANT_ENCAPSED_STRING HELP!

Posted on 2003-03-09
11
Medium Priority
?
727 Views
Last Modified: 2013-12-13
Well, I think my script is valid, but it returns various unexpected T_CONSTANT_ENCAPSED_STRINGs...

Here it is, all my points to anyone who can help...

<?php

$iconnumbertwo = $iconnumber - 1;

print ("<html><head><title></title><link rel=stylesheet href='css1.css' type='text/css'></head><body><center><?php include 'topbanner.php'; ?><?php include 'leftmenu.php'; ?><td valign='top'><table width='500' border='0'><?php include 'iconsnav.php'; ?><tr><td class='regulartitle'>");

print ("Icons: $bandname [$iconnumber]");

print ("</td><tr><td class='newstbl'>");

while ($iconnumber > 0)
{

$iconnumbertwo = $iconnumbertwo - 1;
print ("<a href='aim:BuddyIcon?src=http://www.punkaim.com/theicons/");
print ($abrev);
print ($iconnumertwo);
print (".gif'>");
print ("<img src='http://www.punkaim.com/theicons/');
print ($abrev);
print ($iconnumertwo);
print ("'.gif'")
print ("border='0'></a>");

}

print ("</td></td></tr></table>");
print ("</td><?php include 'rightmenu.php'; ?>");
print ("<?php include 'bottompage.php'; ?>");
print ("</body></html>");


?>
0
Comment
Question by:doctacrazy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
11 Comments
 

Accepted Solution

by:
__macro__ earned 248 total points
ID: 8101568
You need read more about issue the tags <?php  ?>
Good example:
<?php
if ($expression) {
   ?>
   <strong>This is true.</strong>
   <?php
} else {
   ?>
   <strong>This is false.</strong>
   <?php
}
?>


This works as expected, because when PHP hits the ?> closing tags, it simply starts outputting whatever it finds until it hits another opening tag.
0
 
LVL 6

Expert Comment

by:carchitect
ID: 8104586
which line sir
0
 

Assisted Solution

by:bcouldrey
bcouldrey earned 244 total points
ID: 8108100
Change your last 4 lines

FROM:
print ("</td></td></tr></table>");
print ("</td><?php include 'rightmenu.php'; ?>");
print ("<?php include 'bottompage.php'; ?>");
print ("</body></html>");


TO:
print ("</td></td></tr></table>");
print ("</td>");
include 'rightmenu.php';
include 'bottompage.php';
print ("</body></html>");



\Ben.



0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Assisted Solution

by:Jonza
Jonza earned 244 total points
ID: 8108953
yup, that should solve your problem.
you cant use PHP inside PHP =)

also change this:
print ("<html><head><title></title><link rel=stylesheet href='css1.css' type='text/css'></head><body><center><?php include 'topbanner.php'; ?><?php include 'leftmenu.php'; ?><td valign='top'><table width='500' border='0'><?php include 'iconsnav.php'; ?><tr><td class='regulartitle'>");


to this:
print ("<html><head><title></title><link rel=stylesheet href='css1.css' type='text/css'></head><body><center>");
include 'topbanner.php';
include 'leftmenu.php';
print("<td valign='top'><table width='500' border='0'>");
include 'iconsnav.php';
print("<tr><td class='regulartitle'>");
0
 
LVL 1

Expert Comment

by:Jonza
ID: 8108962
oh.. and the include statements..
use them like this:
include("topbanner.php");
instead of this:
include "topbanner.php";  //may be the problem on some servers

make these corrections that i gave to your script and the one that bcouldrey gave to make your script work :)
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 8111355
Another interpretation of all of the above.

Note the use of the heredoc code (<<<), this can assist in making your ' and " usage a LOT easier!!!

<html>
<head>
<title></title>
<link rel="stylesheet" href="css1.css" type="text/css">
</head>
<body>
<center>
<?php
$iconnumbertwo = $iconnumber - 1;

include ('topbanner.php');
include ('leftmenu.php');

echo<<<END_HTML
<td valign="top">
<table width="500" border="0">

END_HTML;

include ('iconsnav.php');

echo<<<END_HTML
<tr><td class="regulartitle">Icons: {$bandname} [{$iconnumber}]</td><tr><td class="newstbl">
END_HTML;

while ($iconnumber > 0)
     {
     $iconnumbertwo = $iconnumbertwo - 1;
     echo<<<END_HTML
<a href="aim:BuddyIcon?src=http://www.punkaim.com/theicons/{$abrev}{$iconnumertwo}.gif"><img src="http://www.punkaim.com/theicons/{$abrev}{$iconnumertwo}.gif" border="0"></a>
END_HTML;
     }

echo<<<END_HTML
</td></td></tr></table></td>
END_HTML;

include ('rightmenu.php');
include ('bottompage.php');

?>
</body>
</html>

Regards,

Richard.
0
 
LVL 40

Assisted Solution

by:Richard Quadling
Richard Quadling earned 244 total points
ID: 8111375
And watch out for the spelling mistake of $iconnumertwo in the <a> tag. Sorry.

Oh. Just noticed you mispelled them too! Ha!

Richard.

<html>
<head>
<title></title>
<link rel="stylesheet" href="css1.css" type="text/css">
</head>
<body>
<center>
<?php
$iconnumbertwo = $iconnumber - 1;

include ('topbanner.php');
include ('leftmenu.php');

echo<<<END_HTML
<td valign="top">
<table width="500" border="0">

END_HTML;

include ('iconsnav.php');

echo<<<END_HTML
<tr><td class="regulartitle">Icons: {$bandname} [{$iconnumber}]</td><tr><td class="newstbl">
END_HTML;

while ($iconnumber > 0)
     {
     $iconnumbertwo = $iconnumbertwo - 1;
     echo<<<END_HTML
<a href="aim:BuddyIcon?src=http://www.punkaim.com/theicons/{$abrev}{$iconnumbertwo}.gif"><img src="http://www.punkaim.com/theicons/{$abrev}{$iconnumbertwo}.gif" border="0"></a>
END_HTML;
     }

echo<<<END_HTML
</td></td></tr></table></td>
END_HTML;

include ('rightmenu.php');
include ('bottompage.php');

?>
</body>
</html>
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 11387200
Abandoned! Abandoned!!! After all this excellent work!!!! Jees! You'd think we would get an award of SOMETHING!!!! <grin> "I'd just like to thank my mum and my dad and my cats and the nextdoor neighbour's goldfish salesmen's car washer for all their help and inspiration! <blub> I never <blub> expected <blub> <blub> ..." (Led away in tears! Ed.)
0

Featured Post

WordPress Tutorial 2: Terminology

An important part of learning any new piece of software is understanding the terminology it uses. Thankfully WordPress uses fairly simple names for everything that make it easy to start using the software.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question