At 5:01 PM +0000 1/11/09, Nathan Rixham wrote:
i love these discussions on pedantics and semantics!
[and]
keep the layers as seperate as possible
That's the main topic of this thread. But you missed the point of the
debate. I was claiming that one should not have any html within an
echo, whereas Ash was showing difficulties in doing so.
For example your:
$imgHTML = '<img src="' . $url . '" alt="' . $alt . '" title="' .
$alt . '" class="' . $imgclass . '" />';
If given the choice I would not practice. Instead, I would echo each
variable out such as:
<img src="<?php echo($url);?>" ...
however; I only really do this when developing or in a quick bit of
script; whenever possible I'll always use a templating engine, or
xml/xsl which is the perfect abstraction between data and
presentation IMHO.
I've never used a template engine. Attempts at doing so resulted in
frustration as to how the designers mixed php, css, and html.
another little note is that I'd never echo out a class or
presentation data; infact I'd never use a class on a tag such as img
either, preference going to a bit of css using selectors
div#article_content p img {
/* whatever */
}
I see absolutely nothing wrong with using:
<?php
$paragraph_class = 'paragraph_class';
...
?>
<p class="<?php echo($paragraph_class)">
with the following in an attached css file.
.paragraph_class
{
font-size: 1.1em;
color: #ff0000;
margin: .5em;
}
now I've limitted all presentation to css only, css contained in a
stylesheet -
Same here.
However, I have changed the application of css style rules via php
and javascript (DOM scripting). DOM scripting is an exciting and
wonderful way to change html unobtrusively, but that's beyond this
discussion.
I try to use minimal css classes, and stick to using an id wherever
I can't simply redefine the html tag.
Id's are fine provided that you are not going to use more than one
per page -- otherwise, class is a better choice.
the above means that moving back to the original <h1> example(s) I'd simply
<h1>whatever</h1>
css:
h1 {
color: rgb(255,0,0);
font-size: 1.2em;
}
seeing as you can only have one h1 tag on a single document.
No, that's not true. You can have as many <h1> tags as you want in a
single document -- they will all just look the same. However, if you
use classes, then you can have as many <h1> tags as you want looking
the way you want them to look -- much more freedom.
Additionally, there's more to consider here than just the way the
document looks. To be holistic, one should consider not only how the
document looks to people, but to bots. If <h1> tags are considered
important to SE bots, and you don't want <h1> tags in your document,
then you are sunk -- unless you style the <h1> the way you want them
to look. As an example, I have used <bold> tags for SEO concerns
while showing the user no bold text.
As I said, there's more here than just how a documents looks to a
human visitor, but that is also beyond this discussion.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php