Freetag plugin code changes: help
Posted: Tue Oct 20, 2009 2:43 pm
Revamping my blog template I (once again) looked at the (X)HTML code emitted by the popular freetag plugin. And, boy, didn't I like what I saw! The code emitted by this plugin is nowhere near standards compliant, it's a disgrace, and it's utterly gross, period. 
Unfortunately, the PHP code of said plugin is way too much for me and my baby PHP, so I'm gonna need some help here. Let me walk you through my proposed changes.
1. "Defined tags for this entry: [tags]"
This is wrapped in a <div class="serendipity_freeTag">. I think it should be <p class="serendipity_freeTag">, since <div> should be used to group elements, not for marking up a single line of text. <span> would be an alternative, but <p> is clearly the better element in terms of semantics.
Yes, I could change that myself. But the content of this is a constant with a variable (%s) included, if that's the right term for that. I think this should be seperated into a constant and a variable. Plus, the value of the constant should be a plugin config option so that people can shorten it to i.e. "Tags:" or something like that.
2. "Related entries by tags: [entries]"
Same here. This is a div, the related entries are links, and all of it is "formatted" using <br />s. EOW! This is how the code should look like:
Again, the constant used should in my humble option be a plugin config option, people might want to change it to "Related articles" - and why shouldn't they? The ul could also be an ol, and it probably should have the new class plainList assigned to it to keep the design consistent.
3. freetag cloud (the tag cloud displayed in plugin view)
Man, this is a tough one. Both "Entries tagged as %s" and "Related tags" are marked up as <div>s. They should probably be headings, but it is next to impossible to determine the heading level here since it should be related to the rest of the page, which depends on the headings the template already uses.
This is one of the many reasons why I'd actually prefer this plugin to be smartified, but unfortunately, I can't do that either.
So the most likely suggestion for these two would be the same as above: Mark them up as <p> with the same class they use now. Again, I think these should be configurable.
Now, for the actual tag cloud ... well, it is kind of okay-ish the way it is now (<span>), but I guess it would be better as an <ul>. Of course, this needs quite sophisticated CSS for the cloud to look the same as now, so I'm gonna drop that suggestion (for the time being)
But how about the rest? Anyone got the time and the nerve to help me implement this?
YL
Unfortunately, the PHP code of said plugin is way too much for me and my baby PHP, so I'm gonna need some help here. Let me walk you through my proposed changes.
1. "Defined tags for this entry: [tags]"
This is wrapped in a <div class="serendipity_freeTag">. I think it should be <p class="serendipity_freeTag">, since <div> should be used to group elements, not for marking up a single line of text. <span> would be an alternative, but <p> is clearly the better element in terms of semantics.
Yes, I could change that myself. But the content of this is a constant with a variable (%s) included, if that's the right term for that. I think this should be seperated into a constant and a variable. Plus, the value of the constant should be a plugin config option so that people can shorten it to i.e. "Tags:" or something like that.
2. "Related entries by tags: [entries]"
Same here. This is a div, the related entries are links, and all of it is "formatted" using <br />s. EOW! This is how the code should look like:
Code: Select all
<div class="serendipity_freeTag_related">
<p>PLUGIN_EVENT_FREETAG_RELATED_ENTRIES</p>
<ul>
<li><a href="...">...</a></li>
[...]
</ul>
</div>3. freetag cloud (the tag cloud displayed in plugin view)
Man, this is a tough one. Both "Entries tagged as %s" and "Related tags" are marked up as <div>s. They should probably be headings, but it is next to impossible to determine the heading level here since it should be related to the rest of the page, which depends on the headings the template already uses.
This is one of the many reasons why I'd actually prefer this plugin to be smartified, but unfortunately, I can't do that either.
So the most likely suggestion for these two would be the same as above: Mark them up as <p> with the same class they use now. Again, I think these should be configurable.
Now, for the actual tag cloud ... well, it is kind of okay-ish the way it is now (<span>), but I guess it would be better as an <ul>. Of course, this needs quite sophisticated CSS for the cloud to look the same as now, so I'm gonna drop that suggestion (for the time being)
But how about the rest? Anyone got the time and the nerve to help me implement this?
YL