File: docs/extensions/Router.md

Recommend this page to a friend!
  Classes of Slawomir Kaleta  >  Dframe Framework  >  docs/extensions/Router.md  >  Download  
File: docs/extensions/Router.md
Role: Auxiliary data
Content type: text/markdown
Description: Auxiliary data
Class: Dframe Framework
Modular MVC based PHP Web framework
Author: By
Last change:
Date: 1 year ago
Size: 884 bytes
 

Contents

Class file image Download

Dframe\Router

Methods

Router is alredy defined in core dframe so you just use $this->router in controller or view files. If you want use only router component use $router = new Dframe\Router();


$isActive = $this->router->isActive('page/index') // For check if you are on page
var_dump($isActive); // true/false

$publicWeb = $this->router->publicWeb('img/example.jpg') // For load web/* files
var_dump($publicWeb);  // http://example.com/img/example.jpg

$assets = $this->router->assets('ventor/js/exampleJs.js') // For load app/view/files and cache web/assets/
var_dump($assets);  // http://example.com/assets/exampleJs.js

$makeUrl = $this->router->makeUrl('page/index') // To create link
var_dump($makeUrl); // yourPage.com/page/index

$this->router->setHttps(true) // reinit from Config

$router->redirect('page/index'); // To redirect yourPage.com/page/index

For more information send a message to info at phpclasses dot org.