|
1 <?php |
|
2 /** |
|
3 * Zend Framework |
|
4 * |
|
5 * LICENSE |
|
6 * |
|
7 * This source file is subject to the new BSD license that is bundled |
|
8 * with this package in the file LICENSE.txt. |
|
9 * It is also available through the world-wide-web at this URL: |
|
10 * http://framework.zend.com/license/new-bsd |
|
11 * If you did not receive a copy of the license and are unable to |
|
12 * obtain it through the world-wide-web, please send an email |
|
13 * to license@zend.com so we can send you a copy immediately. |
|
14 * |
|
15 * @category Zend |
|
16 * @package Zend_View |
|
17 * @subpackage Helper |
|
18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
19 * @version $Id: Url.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
21 */ |
|
22 |
|
23 /** Zend_View_Helper_Abstract.php */ |
|
24 require_once 'Zend/View/Helper/Abstract.php'; |
|
25 |
|
26 /** |
|
27 * Helper for making easy links and getting urls that depend on the routes and router |
|
28 * |
|
29 * @package Zend_View |
|
30 * @subpackage Helper |
|
31 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
32 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
33 */ |
|
34 class Zend_View_Helper_Url extends Zend_View_Helper_Abstract |
|
35 { |
|
36 /** |
|
37 * Generates an url given the name of a route. |
|
38 * |
|
39 * @access public |
|
40 * |
|
41 * @param array $urlOptions Options passed to the assemble method of the Route object. |
|
42 * @param mixed $name The name of a Route to use. If null it will use the current Route |
|
43 * @param bool $reset Whether or not to reset the route defaults with those provided |
|
44 * @return string Url for the link href attribute. |
|
45 */ |
|
46 public function url(array $urlOptions = array(), $name = null, $reset = false, $encode = true) |
|
47 { |
|
48 $router = Zend_Controller_Front::getInstance()->getRouter(); |
|
49 return $router->assemble($urlOptions, $name, $reset, $encode); |
|
50 } |
|
51 } |