473,395 Members | 1,343 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,395 software developers and data experts.

Any suggestions about (quotes or <? ?>)

Hello again....
I am coding php in dreamweaver. And because I like to use it for the HTML
parts I want my HTML code to be unquoted and not into echo statements.

BUT I ended up in something like this
<? if ($blabla == 1) { ?>
<h1> blabla is one <h1>
<? }
elseif ($bloublou == 2) { ?>
<form>
<input value= <? echo $var ?> ..... >
</form>
<ul><? do { ?> <li><h4><? etc..... ?>

Anyway what I want to know is how can I safely enclose my whole html code
into an echo statement or anything like echo.

Jul 17 '05 #1
4 1366
On Fri, 20 May 2005 20:32:10 GMT, "Angelos" <ad**********@redcatmedia.net>
wrote:
Hello again....
I am coding php in dreamweaver. And because I like to use it for the HTML
parts I want my HTML code to be unquoted and not into echo statements.

BUT I ended up in something like this
<? if ($blabla == 1) { ?>
<h1> blabla is one <h1>
<? }
elseif ($bloublou == 2) { ?>
<form>
<input value= <? echo $var ?> ..... >
</form>
<ul><? do { ?> <li><h4><? etc..... ?>

Anyway what I want to know is how can I safely enclose my whole html code
into an echo statement or anything like echo.


There's heredoc syntax, such as:

print <<<END_HTML
<input type='text' value='$somevariable'>
END_HTML;

Or you could use the alternative control structure syntax which looks neater
for this sort of layout:

<?php if ($blabla == 1): ?>
<h1>blabla is one<h1>
<?php endif; ?>

Or just put the whole lot in a multi-line echo if you really want, but watch
out for quotes.

--
Andy Hassall / <an**@andyh.co.uk> / <http://www.andyh.co.uk>
<http://www.andyhsoftware.co.uk/space> Space: disk usage analysis tool
Jul 17 '05 #2
> Hello again....
I am coding php in dreamweaver. And because I like to use it for the HTML
parts I want my HTML code to be unquoted and not into echo statements.

BUT I ended up in something like this
<? if ($blabla == 1) { ?>
<h1> blabla is one <h1>
<? }
elseif ($bloublou == 2) { ?>
<form>
<input value= <? echo $var ?> ..... >
</form>
<ul><? do { ?> <li><h4><? etc..... ?>

Anyway what I want to know is how can I safely enclose my whole html code
into an echo statement or anything like echo.


Look at PEAR HTML Templates- http://pear.php.net/package/HTML_Template_IT -
they allow you to completely separate your HTML and PHP code.
Jul 17 '05 #3
Angelos wrote:
Hello again....
I am coding php in dreamweaver. And because I like to use it for the HTML
parts I want my HTML code to be unquoted and not into echo statements.

BUT I ended up in something like this
<? if ($blabla == 1) { ?>
<h1> blabla is one <h1>
<? }
elseif ($bloublou == 2) { ?>
<form>
<input value= <? echo $var ?> ..... >
</form>
<ul><? do { ?> <li><h4><? etc..... ?>


Also, please note that with XHTML 1.0 requires you to quote all
attributes you have in your html. So your <input ...> should actually be:

<input value="<? echo $var; ?>" ....>

See reference at:
http://www.w3.org/TR/xhtml1/#h-4.4

/Marcin
Jul 17 '05 #4
On 23/05/2005 12:52, Marcin Dobrucki wrote:

[snip]
Also, please note that with XHTML 1.0 requires you to quote all
attributes you have in your html.


That would have been better written as: XHTML requires you, as an
author, to quote all attributes in your markup. XHTML has no impact on
HTML, though it is good practice (in my opinion) to quote all attributes
and include optional tags.

However, where did the OP mention the use of XHTML? The errors in the
posted markup means it doesn't conform to any markup language, let alone
hint at the strict requirements of XHTML.

[snip]

Mike

--
Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.
Jul 17 '05 #5

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

Similar topics

1
by: Christian Schmidbauer | last post by:
Hello! I prepare my XML document like this way: ------------------------------------------------------- PrintWriter writer; Document domDocument; Element domElement; // Root tag
2
by: Donald Firesmith | last post by:
I am having trouble having Google Adsense code stored in XSL converted properly into HTML. The <> unfortunately become &lt; and &gt; and then no longer work. XSL code is: <script...
2
by: Eric Osman | last post by:
Hi, I'm looking for a javascript function that will convert input such as this: <CLUB Code=" into this: &lt;CLUB Code=&quot;
11
by: Les Paul | last post by:
I'm trying to design an HTML page that can edit itself. In essence, it's just like a Wiki page, but my own very simple version. It's a page full of plain old HTML content, and then at the bottom,...
2
by: Ja NE | last post by:
and new problem... buit this time I haven't found solution in some manual... problem: I would like to allow <a href="link"> tag, but I'm having problems in hidden field when checking message: ...
5
by: Hank Moss | last post by:
I've been able to get the <qelement and the CSS quotes property to work well together in English, but not in Russian or mixed Russian and English. I probably don't have a firm enough grasp of the...
5
by: Hels Bells | last post by:
Hi, I'm looking to do some manipulation on a string containing html code in asp which will involve me either using some regular expressions or just plain old simple replace functionality. The...
2
by: raj | last post by:
Hi all, I'm using this code to import some a .txt files onto a webpage, but I keep seeing single quotes amd double quotes as question marks. Here's the code: <textarea disabled="disabled"...
6
by: =?Utf-8?B?R2Vvcmdl?= | last post by:
Hello, I have some XML that is returned to my application from another vendor that I cannot change before it gets to me. I can only alter it after it gets to my application. That being said, I...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
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...

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.