public function urlFor() { $arguments = func_get_args(); if (count($arguments) <= 0) { throw new Zend_View_Exception('URL define mistake!'); } list($route, $params) = RFLib_Utility_Parse::urlToParam($arguments[0]); $params['module'] = isset($arguments[1]) ? $arguments[1] : Zend_Controller_Front::getInstance()->getRequest()->getModuleName(); $reset = isset($arguments[2]) ? $arguments[2] : true; $encode = isset($arguments[3]) ? $arguments[3] : true; return $this->view->url($params, $route, $reset, $encode); }
/** * 生成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>'; }