News:

Wondering if this will always be free?  See why free is better.

Main Menu

Last post adjustment vb-like Redux

Started by Black Tiger, April 30, 2016, 08:42:45 AM

Previous topic - Next topic

Black Tiger

http://www.simplemachines.org/community/index.php?topic=519496.0

I'm sorry to bump this ancient thread, but my question is about the exact same change.
Nowadays I try to have things more W3C compliant and when I change this code in BoardIndex.template.php:
                                                <p><strong>', $txt['last_post'], '</strong>  ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
                                                ', $txt['in'], ' ', $board['last_post']['link'], '<br />
                                                ', $txt['on'], ' ', $board['last_post']['time'],'
                                                </p>';

to this code:
                                                <p><strong>', $board['last_post']['link'], '</strong><br />
                                                ', $txt['by'], ' ', $board['last_post']['member']['link'] , '<br />
                                                <div style="text-align:right;">', $board['last_post']['time'],'
                                                </p>';

then W3C throws around 65 errors.
Now I see that if I set a </div> at the last line just before the </p> then it's only 33 errors.
And all those errors are like:
Quotedocument type does not allow element "div" here; missing one of "object", "applet", "map", "iframe", "button", "ins", "del" start-tag
And that points to the  <div style="text-align:right;"> addition.

Can anyone give me the correct code so it will not generate W3C errors anymore?
The complete thing is within a "td class" so maybe that may also has to do with it.
Greetings, Black Tiger

Irisado

Topic split, as it was too old to bump.  I've inserted a link into your opening post to the previous thread, so that the relevant discussion is easy to view.  Please avoid reviving old topics like that one in the future.
Soñando con una playa donde brilla el sol, un arco iris ilumina el cielo, y el mar espejea iridescentemente

Black Tiger

I normally never do that, but it was not without thinking about it.
My thought was to do it because it was my own question and about exactly the same issue.
So I thought it would be good to keep this together, because now your left with the wrong solution in the old thread. ;)

Anyway, I don't mind, I hope somebody knows the solution.
If I remove the div to align right, my W3C errors are gone. So I seem to only need a different way to correctly alignt this 1 line to the right side.
Greetings, Black Tiger

Arantor

Try using a span instead of a div? It's not a block element so doesn't fall foul of the structure rules of flow vs phrasing content. You will need the closing tags, they are not optional on XHTML1.1 documents like SMF uses in 2.0.

Black Tiger

QuoteIt's not a block element
I wouldn't now, my html knowledge is from the 90's. So I thought it would be some kind of block element because it's in a td class="lastpost" statement.

Anyway, as always, you're the best, thank you!
I did a google search on how to use span to align something to the right and came to this solution:
<span style="float:right;">', $board['last_post']['time'],'</span>

Works perfectly and no W3C issues, great, thanks!
Greetings, Black Tiger

Advertisement: