Пример #1
0
 public function testPrependUrlNotRegistered()
 {
     try {
         ezcUrlCreator::prependUrl('not registered url', 'images');
         $this->fail('Expected exception was not thrown');
     } catch (ezcUrlNotRegisteredException $e) {
         $expected = "The url 'not registered url' is not registered.";
         $this->assertEquals($expected, $e->getMessage());
     }
 }
Пример #2
0
 public static function geturl($name, $params = null, $params2 = null)
 {
     try {
         if ($params) {
             return ezcUrlCreator::getUrl($name, $params, $params2);
         } else {
             return ezcUrlCreator::getUrl($name);
         }
     } catch (Exception $e) {
         return '#';
     }
 }
Пример #3
0
<?php

require_once 'tutorial_autoload.php';
// register an url under the alias 'map'
ezcUrlCreator::registerUrl('map', '/images/geo?xsize=450&ysize=450&zoom=4');
// display the the url prepended to map_norway.gif
var_dump(ezcUrlCreator::prependUrl('map', 'map_norway.gif'));
// display the the url prepended to map_sweden.gif
var_dump(ezcUrlCreator::prependUrl('map', 'map_sweden.gif'));
// display the stored url under the alias 'map'
var_dump(ezcUrlCreator::getUrl('map'));
Пример #4
0
<?php

require_once 'tutorial_autoload.php';
// register an url under the alias 'map'
ezcUrlCreator::registerUrl('map', '/images/geo/%s?xsize=%d&ysize=%d&zoom=%d');
// display the stored url under the alias 'map' formatted with parameters
var_dump(ezcUrlCreator::getUrl('map', 'map_norway.gif', 450, 450, 4));
// display the stored url under the alias 'map' formatted with other parameters
var_dump(ezcUrlCreator::getUrl('map', 'map_sweden.gif', 450, 450, 4));