Any suggestions about (quotes or )

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

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) { ?>
 <input value= <? echo $var ?> ..... >
<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.

Re: Any suggestions about (quotes or )

Quoted text here. Click to load it

Look at PEAR HTML Templates- -
they allow you to completely separate your HTML and PHP code.

Re: Any suggestions about (quotes or )


Quoted text here. Click to load it

 There's heredoc syntax, such as:

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

 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.

< Space: disk usage analysis tool

Re: Any suggestions about (quotes or )

Angelos wrote:
Quoted text here. Click to load it

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:


Re: Any suggestions about (quotes or )

On 23/05/2005 12:52, Marcin Dobrucki wrote:


Quoted text here. Click to load it

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.



Michael Winter
Replace ".invalid" with ".uk" to reply by e-mail.

Site Timeline