示例#1
0
    function GetNewsItem($id,$line=null,$params=null)
    {
        global $par,$varsline;
        if($line==null)
        {
            $sql="SELECT * FROM $par->news1table WHERE `id`=$id AND `hide`=0";
            $res = mysql_query($sql);
            $line = mysql_fetch_array($res,MYSQL_ASSOC);
        }
        $line = LangProcess($line);
        
        if(isset($line['titleh1']) && $line['titleh1']!='') $line['title']=$line['titleh1']; else $line['title']=$line['title'];
        $line['item_url'] = GetSeoUrl('news',$line['id'],$line);

        //формируем информацию о фото
        $line['item_fotos'] = Array();
        if(is_file($par->document_root.'/fotos/news1_sm_'.$line['id'].'.jpg'))
        {
                $fname = 'fotos/news1_sm_'.$line['id'].'.jpg';
        }
        else $fname = '';

        if(is_file($par->document_root.'/fotos/news1_bg_'.$line['id'].'.jpg'))
        {
                $fnamebig = 'fotos/news1_bg_'.$line['id'].'.jpg';
        }
        else $fnamebig='';
        $line['item_fotos'][] = Array('fname'=>$fname, 'fnamebig'=>$fnamebig);
        
        return $line;
    
    }
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;
}
    function GetArticlesItem($id,$line=null,$params=null)
    {
        global $par,$varsline;
        if($line==null)
        {
            $sql="SELECT * FROM $par->news2table WHERE `id`=$id AND `hide`=0";
            $res = mysql_query($sql);
            $line = mysql_fetch_array($res,MYSQL_ASSOC);
        }
        $line = LangProcess($line);
        
        if(isset($line['titleh1']) && $line['titleh1']!='') $line['title']=$line['titleh1']; else $line['title']=$line['title'];
        $line['item_url'] = GetSeoUrl('articles',$line['id'],$line);

        $line['img'] = img_check("articles/article_",$line['id']);
        
        return $line;
    
    }
示例#4
0
<?
if ($act=='pages'  && $id!=0)
{
    $_logic['pageitem']=Array();
    $sql="SELECT * FROM $par->pagestable WHERE id=$id";
    $res = mysql_query($sql);
    $line = mysql_fetch_array($res,MYSQL_ASSOC);

    $line = LangProcess($line);

    if(isset($line['titleh1']) && $line['titleh1']!='') $line['title']=$line['titleh1']; else $line['title']=$line['title'];

    $line['text'] = ReplaceSeolinks($line['text']);

    $_logic['pageitem'] = $line;

}
示例#5
0
<?
    //$_SESSION = array();

	$_logic['lang_url_default'] = GetSeoUrl($act,$id,null,'ua','',true);
	$_logic['lang_url_ru'] = GetSeoUrl($act,$id,null,'ru','',true);
	$_logic['lang_url_en'] = GetSeoUrl($act,$id,null,'en','',true);

    $varsline = LangProcess($varsline);

    $all_in_basket = 0; $all_sum_in_basket = 0;
    if(isset($_SESSION['basket']))
    {
        foreach ($_SESSION['basket'] AS $key=>$item)
        {
            $sql = "SELECT * FROM $par->objectstable WHERE id=$item[id]";
            $res = mysql_query($sql);
            if($line = mysql_fetch_array($res,MYSQL_ASSOC))
            {
                $line['price'] = $line['price'] * (($item['length']/100) * ($item['breadth']/100)) + ($line['price'] * (($item['length']/100) * ($item['breadth']/100)) * 0.1);
                
                $all_in_basket += $item['count'];
                $all_sum_in_basket += $item['count'] * $line['price'];

                $url = GetSeoUrl('tovar',$item['id'],$line);

                $sql2 = "SELECT title, color FROM $par->colorstable WHERE id=$item[color]";
                $res2 = mysql_query($sql2);
                
                if ($line2 = mysql_fetch_array($res2,MYSQL_ASSOC)){
                    $sql3 = "SELECT id FROM fotorobj WHERE title=$item[color] AND reportid=$item[id]";
                    $res3 = mysql_query($sql3);