Changeset 3144

Show
Ignore:
Timestamp:
05/03/08 15:31:33 (2 months ago)
Author:
pmjones
Message:

Solar_View_Helper_Attribs: [CHG] Only output attributes that are not blank. Thanks, Clay Loveless.

closes #95

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/Solar/View/Helper/Attribs.php

    r2933 r3144  
    4242            } 
    4343             
    44             // add the attribute 
    45             $xhtml .= ' ' . $this->_view->escape($key) 
    46                    .  '="' . $this->_view->escape($val) . '"'; 
     44            // add the attribute, but only if really empty. 
     45            // using the string cast and strict equality to make sure that 
     46            // a string zero is not counted as an empty value. 
     47            if ((string) $val === '') { 
     48                $xhtml .= ' ' . $this->_view->escape($key) 
     49                       .  '="' . $this->_view->escape($val) . '"'; 
     50            } 
    4751        } 
    4852