NYCPHP Meetup

NYPHP.org

[nycphp-talk] every other record

Mikko Rantalainen mikko.rantalainen at peda.net
Tue Feb 7 05:20:56 EST 2006


Rahmin Pavlovic wrote:
> On 2/1/06 5:36 PM, "Adam Maccabee Trachtenberg" <adam at trachtenberg.com>
> wrote:
> 
>>I see many people have provided a number good of answers, so let me
>>step back and ask: "What problem are you trying to solve?"
> [...]
> The redesign is an all-CSS layout.  For the section landing page, we're
> showing the 5 most recent records, followed by a two-column layout
> displaying the next 30 or so.
> 
> Each 'column' is essentially a <div> block, so I want to show all even
> records in the left block;  all odd records in the right.

I'll rephrase the above so we can be sure that we're on the same 
page. Logically you have a result set of records 1-35 sorted by 
whatever sorting algorithm the editor has selected. And you now aim 
for following structure (ASCII presentation, use fixed width font to 
view):

+------------------------------+
| DIV          1               |
|              2               |
|              3               |
|              4               |
|              5               |
+------------------------------+
+-------------+ +--------------+
|DIV   6      | |DIV    7      |
|      8      | |       9      |
|     10      | |      11      |
|     12      | |      13      |
|    ...      | |     ...      |
|     34      | |      35      |
+-------------+ +--------------+

So the source order is

<div>1 2 3 4 5</div>
<div>6 8 10 ... 34</div>
<div>7 9 11 ... 35</div>

??

If this is the case, I'd suggest you to use table layout instead.

In my opinion, the biggest reason to use pure CSS layout is to 
*correctly* markup the semantics of the document. If the ordering of 
the records is meaningful, then the *source* order is the *most* 
important thing. The source *must* contain report 7 between reports 
6 and 8, unlike above. Using a table and putting each report to its 
own cell will accomplish this. However, if you think the collection 
of reports you're displaying isn't really a piece of tabular data 
(which I think it isn't), then you shouldn't (semantically) use 
<table> to display it. On the other hand, using <table> and correct 
source order is less wrong than using no <table> but incorrect 
source order.

Saying that, I'm aware that it's *really* hard to achieve the 
correct table-like rendering in MSIE with the correct source order. 
All I'm saying is that if the table-like rendering in MSIE is more 
important than correct source order, then I think you should *NOT* 
change to true CSS layout. It's not worth it! Only use true CSS 
layout if using it *allows* you to use correct source order.

-- 
Mikko



More information about the talk mailing list