[prev in list] [next in list] [prev in thread] [next in thread] 

List:       quanta
Subject:    Re: [Quanta] Re: Html parsing inside php
From:       "Aaron D. Campbell" <quanta () autotransteam ! com>
Date:       2005-02-21 19:54:49
Message-ID: 421A3C89.8090401 () autotransteam ! com
[Download RAW message or body]

xterminator wrote:
> On Monday 21 February 2005 19:59, Ciprian Zaharie wrote:
> [snip]
> 
>>>>>who writes something like
>>>>>echo "<td ";
>>>>>echo " style=\"";
>>>>>echo $variable;
>>>>>echo "\">\n";
>>>>>
>>>>>
>>>>>>>or the same in one line
>>>>>
> 
> I don't recommend coding php that way for numberous reasons.  Writing code 
> that way is like how windows is build -- a pile of garbage ...
> 
> You can make use of the DOCHERE structure which is also recognised in Quanta
> 
> try this:
> <?php
> echo <<<MYECHO
> <td style="$variable">
> You can put basically anything in here and the variables will get
> parsed as well.
> 
> See http://www.php.net/docs/ for more info.  Look for the DOCHERE syntax
> 
> MYECHO;
> ?>
> The column afterwards is the only supported character besides the DOCHERE 
> terminator on that line.
> 
> With kind regards
> 
> 
> Andy

Just as a quick FYI, you can't put ANY variable in a dochere.  The same 
limitations apply to it as to double quoted strings (" not ').  Arrays 
will give you problems.  Like:

echo <<<MYECHO
<span style="$_SESSION['style']">test</span>
This does not work.
MYECHO;


However, all you have to do is wrap your variables in {} and they work fine:

echo <<<MYECHO
<span style="{$_SESSION['style']}">test</span>
This does work.
MYECHO;


I'd also like to take this time to add that I think it'd be REALLY nice 
to have quanta do auto-completion, etc inside a heredoc.  Basically 
treating it like regular HTML/XHTML.

It's not a huge problem though, because I just make everything OUTSIDE 
of my php (often in another doc called temp.html or something), and then 
copy/paste it into the heredoc.
-- 
Aaron D. Campbell
IT Manager
Auto Transport Team
_______________________________________________
Quanta mailing list
Quanta@mail.kde.org
https://mail.kde.org/mailman/listinfo/quanta
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic