Jul
As I’m a total fan of alternating row colors that improve usability immensely, I wanted to have these in the TextPattern backend (article listing). The article listing page of TextPattern is built up using table rows (<tr>) which are predestined to be colored with alternating colors. The final HTML-output of a backend page is generated using lots of functions and libraries. But the sourcecode of TextPattern is cleaned up and well structured so it’s just a small change in one PHP-file and the general CSS-file of TextPattern.
In order to do the change, open your TextPattern-folder (you can do it live on your FTP of course but you should backup the file before you edit it) and navigate to the path ‘textpattern/include’. There, you’ll find the file ‘txp_list.php’ which you need to edit. After opening the file in your favorite editor, go to line 195 and add the following two lines (lines 197 and 202).
195
196
197
198
199
200
201
202
203
204
205
...
include_once txpath.'/publish/taghandlers.php';
$tr_even_odd = "odd";
while ($a = nextRow($rs))
{
if ($tr_even_odd == "odd") { $tr_even_odd = "even"; } else { $tr_even_odd = "odd"; }
extract($a);
...287
288
289
290
291
...
? fInput('checkbox', 'selected[]', $ID)
: ' '
)), ' class="'.$tr_even_odd.'"'
);
...325
326
327
328
329
330
331
332
...
table#list li {
margin: 0 0 2px 0;
}
table#list tr.even {
background-color: #f8f8f8;
}
...That’s it. Of course you can adjust the grey color ‘f8f8f8’ and add more CSS-properties.


