RE: [PHP] Auto-generating HTML
| From: | Bob McConnell | Date: | Tue, 21 Sep 2010 14:29:23 +0000 |
| Subject: | RE: [PHP] Auto-generating HTML | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308243@lists.php.net to get a copy of this message | ||
From: Andy McKenzie
> I think the main thing I'm seeing is that there isn't a single,
> accepted, simple way to do this: no matter what I do, it will be a
> workaround of some type. Either I'm adding complexity (a function to
> convert everything), or I'm adding lines (heredoc/nowdoc seem to
> require that the opening and closing tags be on lines without any of
> the string on them), or I'm adding typing (adding ' . "\n"' to the end
> of every line of HTML). Perhaps I'll put some effort into building a
> function to do it, but not this week... I think for now I'll keep
> appending those newlines, and just have more code to fix at a later
> date. It's reasonably clean, it's just mildly annoying.
It should be relatively easy to do a search and replace on the double
tag locations and insert the newlines. Using tr(1) to replace all "><"
pairs with ">\n<" might be an improvement. Would it be easier to remove
the extras, or to insert all of them in the first place?
Bob McConnell