Add route function for View objects.
This commit is contained in:
		| @@ -145,5 +145,20 @@ class View extends Neuron { | |||||||
|         header('Content-Type: text/plain; charset=utf-8'); |         header('Content-Type: text/plain; charset=utf-8'); | ||||||
|         print($txt); |         print($txt); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * Intenta devolver la url absoluta a partir de una ruta relativa. | ||||||
|  |      * | ||||||
|  |      * @param string $path | ||||||
|  |      * | ||||||
|  |      * @return string | ||||||
|  |      */ | ||||||
|  |     public function route(string $path = '/'): string | ||||||
|  |     { | ||||||
|  |         if (defined('SITE_URL') && !empty(SITE_URL)) | ||||||
|  |             return SITE_URL.substr($path,1); | ||||||
|  |  | ||||||
|  |         return $path; | ||||||
|  |     } | ||||||
| } | } | ||||||
| ?> | ?> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user