/** * 生成img标签 * * @example imageTag('imageFile','size=64x48 class=red') * @example imageTag('imageFile') * * @param string $src * @param string $attribs * @return string */ public function imageTag($src, $attribs = null) { $url = $this->view->skinUrl . '/images/' . $src; if (null === $attribs) { $options = ''; } else { $arr = RFLib_Utility_Parse::attribToArray($attribs); if (isset($arr['size'])) { list($arr['width'], $arr['height']) = explode('x', $arr['size'], 2); unset($arr['size']); } $options = $this->_htmlAttribs($arr); } return '<img src="' . $url . '"' . $options . ' />'; }
public function linkTo($text, $path, $attribs = null) { if ('#' == $path) { $url = 'javascript:void(0);'; } else { if ('homepage' == $path) { $url = $this->view->baseUrl(); $url = empty($url) ? '/' : $url; } else { $url = $this->view->urlFor($path); } } if (null === $attribs) { $options = ''; } else { $options = $this->_htmlAttribs(RFLib_Utility_Parse::attribToArray($attribs)); } return '<a href="' . $url . '" ' . $options . '>' . $text . '</a>'; }