473,321 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

echo <<<tag ... tag;

Some of the online docs say that you can use

echo <<<END

all sorts of text and statements...

END;
but if the following produces a parse error at line 14 which is the closing
php tag.

<?php
echo <<<TT
<tr>
<td>
<p>1. some text...</p>
</td>
<td>
<p>
<input type="radio" name="gs.$i" value="1">
</p>
</td>
</tr>
TT;
?>

Any suggestions, like don't use this tag?

Thanks, Mike

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Aug 4 '05 #1
4 9062
On Thu, 4 Aug 2005 09:14:23 -0600, "Michael G" <mi****@montana.com> wrote:
Some of the online docs say that you can use

echo <<<END

all sorts of text and statements...

END;
but if the following produces a parse error at line 14 which is the closing
php tag.

<?php
echo <<<TT
<tr>
<td>
<p>1. some text...</p>
</td>
<td>
<p>
<input type="radio" name="gs.$i" value="1">
</p>
</td>
</tr>
TT;
?>

Any suggestions, like don't use this tag?


Just a guess, but it looks like you're trying to reference a PHP variable inside
the echo?
name="gs.$i"

I'd try something like this:

<?php
echo <<<TT1
<tr>
<td>
<p>1. some text...</p>
</td>
<td>
<p>
TT1;

echo "<input type=\"radio\" name=\"gs." . $i . "\" value=\"1\">";

echo <<<TT2
</p>
</td>
</tr>
TT2;
?>

Aug 4 '05 #2
Michael G wrote:
Some of the online docs say that you can use

echo <<<END

all sorts of text and statements...

END;
but if the following produces a parse error at line 14 which is the closing
php tag.

<?php
echo <<<TT
<tr>
<td>
<p>1. some text...</p>
</td>
<td>
<p>
<input type="radio" name="gs.$i" value="1">
If $i==7, the result of this will look like:

<input type="radio" name="gs.7" value="1">

Probably not what you intended.
</p>
</td>
</tr>
TT;
Make sure this is on column 1 of the line, and there isn't anything
after it (including whitespace).
?>

Any suggestions, like don't use this tag?


HEREDOC syntax is quite useful in many cases, and I tend to use in cases
like this where I have a large HTML block to output with a couple
variables in it.

--
Justin Koivisto, ZCE - ju****@koivi.com
http://koivi.com
Aug 4 '05 #3
Hi!
Any suggestions, like don't use this tag?

Your error occurs if the closing
TT;
does not start at the very beginning of the line.

$x= <<<TT
some text
TT;

fails;

$x= <<<TT
some text
TT;

works!

to prevent this error because of the autoindent of my editor I prefer a
coding style like this:

if(something) {
$var=
<<<EOT
sometext
sometext
EOT;
}
HIH

Jo
Aug 4 '05 #4
> Some of the online docs say that you can use

echo <<<END

all sorts of text and statements...

END; <SNIP> Any suggestions, like don't use this tag?


Take a look at some of the templating systems out there - I use Smarty -
http://smarty.php.net

Aug 5 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

20
by: wing | last post by:
Hi, I'm now doing web programming using PHP. I need to use <?php instead of <? for PHP scripts. How do I configure PHP so that it can recognize <? as well?? Thanks in advance Wing
2
by: bjam | last post by:
Hi, I am trying to do the following, which is to have a single place to define my table paramaters such as cellpadding / cellspacing etc. Below is the code I am trying to achieve see the cell...
3
by: Henry Johnson | last post by:
Okay - I'm spinning my wheels on this one... can someone help me figure out how to programmatically populate a table cell as follows (from C# code-behind)? I've tried using a Literal control in the...
2
by: Ersin Gençtürk | last post by:
hi , I need to customize <input type=file , tag. I find a way to do that : on the client side by javascript and css first , I am hiding the fileupload object , then I am calling the click...
5
by: Paul Lautman | last post by:
I often see the former starting delimiter rather than the latter. Is there some rule about where the former can be used?
1
by: Doug.Sheahan | last post by:
I am attempting to parse and xml file using javascript but am running into a problem when parsing a <link></link> pair. For example, the link information in most RSS feeds is given as <link> ...
6
by: damod.php | last post by:
<?php ...<? both are the php tags whats the diff b/w name of the tag??? then i write the code using <? this tag full coding , but the server can not accept my (<?)tag,, its only used <? php tag...
2
by: kaotik78 | last post by:
I've racked my head on this all day long. I've been using php for 3 days now and this is the first hang up I've had and it's driving me nuts, but I can't pull myself away from trying to fix the...
14
by: jerrygarciuh | last post by:
Hi folks, I recently ran into a PHP5 install that rejects the idiom, <? // code ? Yikes! The sysadmins could not say why this was but suggested it was a PHP5 thing. So my question to you:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.