implements Phalcon\Mvc\UrlInterface, Phalcon\Di\InjectionAwareInterface
This components helps in the generation of: URIs, URLs and Paths
1 2 3 4 5 | //Generate a URL appending the URI to the base URI echo $url ->get( 'products/edit/1' ); //Generate a URL for a predefined route echo $url ->get( array ( 'for' => 'blog-post' , 'title' => 'some-cool-stuff' , 'year' => '2012' )); |
Methods
public setDI (Phalcon\DiInterface $dependencyInjector)
Sets the DependencyInjector container
public getDI ()
Returns the DependencyInjector container
public setBaseUri (mixed $baseUri)
Sets a prefix for all the URIs to be generated
1 2 | $url ->setBaseUri( '/invo/' ); $url ->setBaseUri( '/invo/index.php/' ); |
public setStaticBaseUri (mixed $staticBaseUri)
Sets a prefix for all static URLs generated
1 | $url ->setStaticBaseUri( '/invo/' ); |
public getBaseUri ()
Returns the prefix for all the generated urls. By default /
public getStaticBaseUri ()
Returns the prefix for all the generated static urls. By default /
public setBasePath (mixed $basePath)
Sets a base path for all the generated paths
1 | $url ->setBasePath( '/var/www/htdocs/' ); |
public getBasePath ()
Returns the base path
public get ([mixed $uri], [mixed $args], [mixed $local], [mixed $baseUri])
Generates a URL
1 2 3 4 5 6 7 8 9 10 11 | //Generate a URL appending the URI to the base URI echo $url ->get( 'products/edit/1' ); //Generate a URL for a predefined route echo $url ->get( array ( 'for' => 'blog-post' , 'title' => 'some-cool-stuff' , 'year' => '2015' )); // Generate a URL with GET arguments (/show/products?id=1&name=Carrots) echo $url ->get( 'show/products' , array ( 'id' => 1, 'name' => 'Carrots' )); // Generate an absolute URL by setting the third parameter as false. |
public getStatic ([mixed $uri])
Generates a URL for a static resource
1 2 3 4 5 | // Generate a URL for a static resource echo $url ->getStatic( "img/logo.png" ); // Generate a URL for a static predefined route echo $url ->getStatic( array ( 'for' => 'logo-cdn' )); |
public path ([mixed $path])
Generates a local path
Please login to continue.