本文整理汇总了PHP中Navigation::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::get方法的具体用法?PHP Navigation::get怎么用?PHP Navigation::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Navigation
的用法示例。
在下文中一共展示了Navigation::get方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getURI
/**
* @param string $siteName
* @param string $ReturnType
* @param string $maxRange
* @param int $initRange
* @param bool $byVariable // envie o nome da variavel quando for para pegar valor de variavel de navegação
* @return array or string
*/
static function getURI($siteName = "", $ReturnType = Navigation::URI_RETURN_TYPE_ARRAY, $maxRange = FALSE, $initRange = 0, $byVariable = NULL)
{
$siteName = str_replace(array("http://www", "http://", "//"), "", $siteName);
//sa o ultimo caracter for /, tira
$siteName = DataHandler::removeLastBar($siteName);
$url = "";
if ($byVariable) {
//$url = Navigation::get($byVariable);
$url = explode("/", Navigation::get($byVariable));
} else {
$url = $_SERVER["REQUEST_URI"];
if ($url[0] == "/") {
$url = substr($url, 1, strlen($url));
}
$url = explode("/", $url);
}
if (strpos($siteName, "/")) {
//echo "tem barra";exit();
$siteName = explode("/", $siteName);
}
//tirando o nome do site só do início
if (is_array($siteName)) {
for ($i = 0; $i < count($siteName); $i++) {
if ($url[$i] == $siteName[$i]) {
$url[$i] = "";
}
}
} else {
$url[0] = str_replace("{$siteName}", "", $url[0]);
}
$url = implode("/", $url);
//$url = str_replace("$siteName", "", $_SERVER["REQUEST_URI"]);
$url = str_replace("//", "/", $url);
//transforma a url em array
$url = preg_replace("/(^\\/)/", '', $url);
$tempArray = explode("/", $url);
if ($initRange > 0 || $maxRange !== FALSE) {
$tempTotal = 0;
if ($maxRange !== FALSE) {
//echo Debug::li("maxRange $maxRange : initRange $initRange");
$tempTotal = $maxRange;
} else {
$tempTotal = count($tempArray);
}
$tempTotal = $tempTotal + 1;
if ($tempTotal > count($tempArray)) {
$tempTotal = count($tempArray);
}
$tempArray = array_slice($tempArray, $initRange, $tempTotal);
}
//filtra a array conforme as regras
$tempArrayFiltrada = array();
for ($i = 0; $i < count($tempArray); $i++) {
if ($tempArray[$i] != "") {
$tempArrayFiltrada[] = $tempArray[$i];
}
}
unset($tempArray);
switch ($ReturnType) {
case Navigation::URI_RETURN_TYPE_STRING:
$url = implode("/", $tempArrayFiltrada);
return $url;
break;
case Navigation::URI_RETURN_TYPE_ARRAY:
default:
return $tempArrayFiltrada;
break;
}
return $url;
}
示例2: get_current_page
/**
* Return current page.
*
* @return Navigation_Page
*/
public static function get_current_page()
{
if (Navigation::$current === null) {
Navigation::get();
}
return Navigation::$current;
}
示例3: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
$items = Navigation::get()->all();
$categorys = NavigationCategory::get()->all();
return View::make('navigation.index', compact('items', 'categorys'));
}