r109119 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109118‎ | r109119 | r109120 >
Date:08:30, 17 January 2012
Author:kaldari
Status:ok
Tags:
Comment:
building tables the right way
Modified paths:
  • /trunk/extensions/CongressLookup/SpecialCongressLookup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php
@@ -95,6 +95,7 @@
9696 }
9797 table.person {
9898 margin-bottom: 1em;
 99+ border: none;
99100 }
100101 table.person td.name {
101102 font-weight: bold;
@@ -168,22 +169,54 @@
169170 $congressTable = '';
170171
171172 if ( $myRepresentative ) {
172 - $congressTable .= '<table class="person" border="0" cellspacing="0" cellpadding="0" style="border:none;">';
173 - $congressTable .= '<tr><td class="name">'.$myRepresentative[0]['name'].'</td></tr>';
174 - $congressTable .= '<tr><td>'.wfMsg( 'congresslookup-phone', $myRepresentative[0]['phone'] ).'</td></tr>';
175 - $congressTable .= '<tr><td>'.wfMsg( 'congresslookup-fax', $myRepresentative[0]['fax'] ).'</td></tr>';
176 - $congressTable .= '<tr><td><a href="'.$myRepresentative[0]['contactform'].'" target="_blank">';
177 - $congressTable .= wfMsg( 'congresslookup-contact-form' ).'</a></td></tr>';
178 - $congressTable .= '</table>';
 173+ $congressTable .= Html::openElement( 'table', array (
 174+ 'class' => 'person', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0
 175+ ) );
 176+ $congressTable .= Html::openElement( 'tr' );
 177+ $congressTable .= Html::element( 'td', array ( 'class' => 'name' ), $myRepresentative[0]['name'] );
 178+ $congressTable .= Html::openElement( 'tr' );
 179+ $congressTable .= Html::closeElement( 'tr' );
 180+ $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-phone', $myRepresentative[0]['phone'] ) );
 181+ $congressTable .= Html::openElement( 'tr' );
 182+ $congressTable .= Html::closeElement( 'tr' );
 183+ $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $myRepresentative[0]['fax'] ) );
 184+ $congressTable .= Html::openElement( 'tr' );
 185+ $congressTable .= Html::closeElement( 'tr' );
 186+ $congressTable .= Html::openElement( 'td' );
 187+ $congressTable .= Html::element( 'a', array (
 188+ 'href' => $myRepresentative[0]['contactform'],
 189+ 'target' => '_blank',
 190+ ),
 191+ wfMsg( 'congresslookup-contact-form' )
 192+ );
 193+ $congressTable .= Html::closeElement( 'td' );
 194+ $congressTable .= Html::closeElement( 'tr' );
 195+ $congressTable .= Html::closeElement( 'table' );
179196 }
180197 foreach ( $mySenators as $senator ) {
181 - $congressTable .= '<table class="person" border="0" cellspacing="0" cellpadding="0" style="border:none;">';
182 - $congressTable .= '<tr><td class="name">'.$senator['name'].'</td></tr>';
183 - $congressTable .= '<tr><td>'.wfMsg( 'congresslookup-phone', $senator['phone'] ).'</td></tr>';
184 - $congressTable .= '<tr><td>'.wfMsg( 'congresslookup-fax', $senator['fax'] ).'</td></tr>';
185 - $congressTable .= '<tr><td><a href="'.$senator['contactform'].'" target="_blank">';
186 - $congressTable .= wfMsg( 'congresslookup-contact-form' ).'</a></td></tr>';
187 - $congressTable .= '</table>';
 198+ $congressTable .= Html::openElement( 'table', array (
 199+ 'class' => 'person', 'cellpadding' => 0, 'cellspacing' => 0, 'border' => 0
 200+ ) );
 201+ $congressTable .= Html::openElement( 'tr' );
 202+ $congressTable .= Html::element( 'td', array ( 'class' => 'name' ), $senator['name'] );
 203+ $congressTable .= Html::openElement( 'tr' );
 204+ $congressTable .= Html::closeElement( 'tr' );
 205+ $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-phone', $senator['phone'] ) );
 206+ $congressTable .= Html::openElement( 'tr' );
 207+ $congressTable .= Html::closeElement( 'tr' );
 208+ $congressTable .= Html::element( 'td', array(), wfMsg( 'congresslookup-fax', $senator['fax'] ) );
 209+ $congressTable .= Html::openElement( 'tr' );
 210+ $congressTable .= Html::closeElement( 'tr' );
 211+ $congressTable .= Html::openElement( 'td' );
 212+ $congressTable .= Html::element( 'a', array (
 213+ 'href' => $senator['contactform'],
 214+ 'target' => '_blank',
 215+ ),
 216+ wfMsg( 'congresslookup-contact-form' )
 217+ );
 218+ $congressTable .= Html::closeElement( 'td' );
 219+ $congressTable .= Html::closeElement( 'tr' );
 220+ $congressTable .= Html::closeElement( 'table' );
188221 }
189222
190223 return $congressTable;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109107a more usable pagekaldari05:51, 17 January 2012

Status & tagging log