Re: heredoc usage [WAS: <OPTION]

From: Date: Thu, 26 Oct 2006 17:23:16 +0000
Subject: Re: heredoc usage [WAS: <OPTION]
References: 1 2 3 4 5 6 7 8  Groups: php.general 
Request: Send a blank email to php-general+get-243685@lists.php.net to get a copy of this message
At 10/26/2006 08:24 AM, tedd wrote:
At 1:04 AM -0700 10/26/06, Paul Novitski wrote:
My comparable example (but in an HTML context) would look like:
        Hello <span class="firstName">FIRSTNAME</span>,
where the engine replaces the content of the span with the value from the database based on a match of 'span.firstName' or perhaps just '.firstName'. (In this example the 'FIRSTNAME' content in the template is merely a place-holder to make it easier to preview the markup and isn't necessary to the merge process.)
I think a <div> would work just as well -- <span> seems so old-world to me. :-)
By default, div is a block element and span is inline, so span seemed like the natural fit for a sentence fragment. I don't think there's anything old-world (!) about spans, Tedd, they're just tags. I use both in my markup with a clear conscience.
However, if you used preg_match_all, I think you could do away with the spans all together by matching FIRSTNAME to your first name variable. That way your document would simply read:
       Hello FIRSTNAME
That's true, and in tighly-defined micro-contexts that might work just fine. For a robust general CMS, though, I want a completely unambiguous demarcation of replacable content. All-caps tags will work in some circumstances but certainly won't in others. Regards, Paul

« previous php.general (#243685) next »