|
Posted by Benjamin on 12/20/06 03:33
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 can't do this with any string syntax.
>
> 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.
I'm afraid this is the only way. Maybe fill an array with the return of
functions?
>
> bill
Navigation:
[Reply to this message]
|