Posted by Rik on 12/20/06 03:40
bill wrote:
> Thanks to those that taught me to use heredoc to embed html in
> php. I don't want to start the html in php vs php in html
> discussion again.,
>
> heredoc works a treat for that which I am doing except:
> In the generated html I have a number of checkboxes. I fill
> in the checkboxes from a boolean value in a mySQL table. To make
> this easier I use a function that takes the boolean and return
> either 'checked' or ''. This worked well when I was
> concatenating the html into a variable rather than using heredoc,
> but it was really messy.
>
> Short, simple question: is there anyway to get php to evaluate a
> function while in a heredoc block ?
You'd be right back where you started from, php-snippets in HTML-blocks...
> I know I could assign the results of using the function to
> variables outside of the heredoc block or I could break the block
> for the function, but the first is cumbersome and the second gets
> rid of the clarity of the heredoc approach.
Possible in heredoc:
- scalar variables
- scalar array-values
- scalar object-values
Not possible in heredoc:
- functions/results
- constants
The last is a great irritation.
--
Rik Wasmus
[Back to original message]
|