예제 #1
0
function GetBreadcrumbsArr($act,$id)
{
    global $par;

    $resarr = Array();
    $tablename = '';
    foreach($par->params AS $key=>$value)
    {
        if($value['actname']==$act) { $tablename = $value['tablename']; break; }
    }

    $pid = $id;
    $k=0;
    while($pid!=0)
    {
        $k++;
        if($k>10) break; //защита от вечного цикла, на всякий случай ;)
        $sql = "SELECT * FROM $tablename WHERE `id`=$pid";
        $res = mysql_query($sql);
        if($line = mysql_fetch_array($res,MYSQL_ASSOC))
        {
            $line = LangProcess($line);
            $item_url = GetSeoUrl($act,$line['id'],$line);
            $item_title = $line['title'];
            $resarr[] = Array('item_title'=>$item_title , 'item_url'=>$item_url);
            $pid = $line['parentid'];
        }
        else break;
    }

    $sql = "SELECT * FROM $par->topmenutable WHERE `url`='/$act'";
    $res = mysql_query($sql);
    if($line = mysql_fetch_array($res,MYSQL_ASSOC))
    {
        $item_url = GetSeoUrl($act,$line['id'],$line);
        $item_title = $line['title'];
        $resarr[] = Array('item_title'=>$item_title , 'item_url'=>$item_url);
    }

    if($act=="tovar")
    {
        $sql = "SELECT * FROM $par->objectstable WHERE `id`=$id";
        $res = mysql_query($sql);
        if($line = mysql_fetch_array($res,MYSQL_ASSOC))
        {
            $resarr = array_merge($resarr, GetBreadcrumbsArr('cat',$line['categid']) );
        }
    }

    return $resarr;
}
예제 #2
0
파일: _logic.php 프로젝트: Apxe/Rubin_final
<?
	//подключаем полезные функции которые используем для логики
	include "modules/indexmodules_logic/_logic_functions.php";

	//В этом массиве будут храниться все данные для отображения
	$_logic = Array();

	//Хлебные крошки
	$_logic['breadcrumbsarr'] = GetBreadcrumbsArr($act,$id);


	$activemenuid = 0;

  if($act=="menu") $activemenuid = $id;
  
  if($act=="none")
  {
    $sql = "SELECT * FROM $par->topmenutable WHERE   url='/'";
    $res = mysql_query($sql);
    if($line = mysql_fetch_array($res,MYSQL_ASSOC)) $activemenuid = $line['id'];
  }
  
  if( $act=="contacts" || $act=="news"  || $act=="abonent")
  {
    $sql = "SELECT * FROM $par->topmenutable WHERE url='/$act'";
    $res = mysql_query($sql);
    if($line = mysql_fetch_array($res,MYSQL_ASSOC)) $activemenuid = $line['id'];
  }
  
   if( $act=="cat" && $id!=0)
  {