473,326 Members | 2,192 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,326 software developers and data experts.

Dilema, Blocks of HTML within PHP

Well...

I need to be able to have a large block of HTML code inside a PHP
document, assign it a variable, and use other variables, functions, and
objects within the HTML code still.

Clarification:

I have the following code (as an example):

$variable = <<<HTML
<table>
<tr><td>$text</td></tr>
<tr><td>echo $config->getBlah()</td></tr>
</table>
HTML;

I need to be able to do that ^, that actual code wouldn't work, but it
is an example of what I need to do. I have tried searching for the <<<
operator, or whatever it is, the problem is most search utilities won't
recognize <<<, so it is really really hard to search and find answers
about it, I can't find anything about it on the php manual, I'm falling
onto a last resort by posting on some forums to see if anyong is able
to help me.

So question being really:
Is there a way I can split that so it recognizes those lines as PHP and
not part of the block of HTML code
OR
Is there another method that I can use to achieve this same effect ?

I have to be able to keep the block of code together, not seperating
each line into a variable declaration. such as:
$var = "<tr><td>" . $text . "</td></tr>";
$var .= "<tr><td>" . echo $config->getBlah(); . "</td></tr>";
Do NOT want to do that.

So if anyone has any ideas/solutions, please, please let me know :)

Thanks.

Jul 17 '05 #1
2 1448
For anyone else that may be interested, I was able to get an answer to
my question.
Here would be the syntax of what I need to do:

$variable =<<<HTML
<table>
<tr><td>{$text}</td></tr>
<tr><td>{$config->getBlah()}</td></tr>
</table>
HTML;

Jul 17 '05 #2
The ability to insert code into HTML is the raison d'etre of PHP.

<table>
<tr><td><?=$text?></td></tr>
<tr><td><?=$config->getBlah()?></td></tr>
</table>

Jul 17 '05 #3

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

Similar topics

10
by: Andrew | last post by:
I am making a web site and I am using ASP because of its templating capabilities. My footer is an include file, for obvious reasons. I can't use an include file for the header, because, while the...
2
by: steven | last post by:
Hi, sorry for the crosspost, but I'm not sure if my problem is with the HTML or the CSS :-( URL: http://www.nenya.be/temp/list.htm I have a list with in each list item a text + link which are...
7
by: Noor | last post by:
please tell the technique of centralize exception handling without try catch blocks in c#.
0
by: ma740988 | last post by:
Puzzled about an implementation here. In a vendor file, I'm faced: // vendors_file.h #ifdef __cplusplus typedef void (*VOIDFUNCPTR) (...); /* pfunction returning void */ #else...
6
by: Chris Ochs | last post by:
I want to do a series of inserts within a single transaction block, but with postgresql if one insert fails, the whole block is aborted. Is there any way to get around this behavior so that...
2
by: Axel Dahmen | last post by:
HI, I want to dynamically add controls to a web page from within a common base class. Unfortunately, ASP.NET fails with "System.Web.HttpException: The Controls collection cannot be modified...
29
by: John Rivers | last post by:
Hello, What good reason there is for not allowing methods in ASPX pages I can't imagine, but here is how to get around that limitation: (START) <body MS_POSITIONING="FlowLayout"> <form...
26
by: brenocon | last post by:
Hi all -- Compared to the Python I know and love, Ruby isn't quite the same. However, it has at least one terrific feature: "blocks". Whereas in Python a "block" is just several lines of...
3
by: GaryDean | last post by:
I have just been through the docs on the Data Access Application blocks and it seems that they complicate things more than make things simple. To me it seems that there is nothing more simple and...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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: 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.