Skip to content

Get active path function

Andre Sieverding edited this page Jun 12, 2014 · 4 revisions

(EasyRouter >= 0.5.1)

EasyRouter\main::get_active_path([ bool $relative = false ] )

$relative = Set true, to get the relative path.

Return values

Returns the active path on success or FALSE on failure.

Little example:

<?php
	// Our script works in http://www.yourwebsite.com/website
	$active_path_absolute = EasyRouter\main::get_active_path();
	$active_path_relative = EasyRouter\main::get_active_path(true);
	echo $active_path_absolute;
	echo "<br />";
	echo $active_path_relative;
?>
http://www.yourwebsite.com/website/first-param/second-param will generate this:
$active_path_absolute = "http://www.yourwebsite.com/website/"
$active_path_relative = "../../"

Clone this wiki locally