473,770 Members | 2,137 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 9081
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.co m
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
4666
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
1367
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 spacing element in the table html tag below. Thanks in advance for any help you can provide. I really appreciate it. This is currently not working as I can't have an xsl:value-of select inside of the table tag itself... does anyone have any ideas...
3
5453
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 TableCell, a HyperLink control, and an Image, but I'm not getting the results I want. Here's the source of what I'm after (retrieved by viewing the source of a page I'm trying to emulate): <td><a...
2
2179
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 event of fileupload object.This opens the select files dialog box of file upload and user will be able to select the file that he wants to upload.But it seems that internet explorer does not allow uploading files selected by using this method.Because...
5
1288
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
1965
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> http://www.something.com/someotherstuff </link> However, when I use item.getElementsByTagName("link"), I get an empty HTMLLinkObject back and if I print the innerHTML property of item, the <link> tag shows up but not the </link> tag. Does anyone...
6
1542
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 only what can i do for ...
2
2085
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 problem. I need help or a push in the right direction. I have a contact form and a validate form. I'll keep this short and sweet, if it can work for one field, I can figure it out for the rest. I have session_start() at the top of both form and...
14
1566
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: is <?php going to become required? And if it is will we not be allowed to echo by the shorthand <?php=$foo? as we
0
9619
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10260
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10038
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9910
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8933
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6712
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2850
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.