menu _menu foreach arr as if id page_id menu _menu href article_ id ht

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$menu .= $_menu[0];
foreach($arr as $k=>$v)
{
if($v['id']==$page_id) $menu .= $_menu[3]."<a href='article_".$v['id'].".html''>".$v['name']."</a>".$_menu[4];
else $menu .= $_menu[1]."<a href='article_".$v['id'].".html''>".$v['name']."</a>".$_menu[2];
if($v['id']==$page_id and $arr2)
{
$menu .= $_submenu[0];
foreach($arr2 as $k2=>$v2)
if($v2['id']==$page_id)
$menu .= $_submenu[3]."<a href='article_".$v2['id'].".html''>".$v2['name']."</a>".$_submenu[4];
else
$menu .= $_submenu[1]."<a href='article_".$v2['id'].".html''>".$v2['name']."</a>".$_submenu[2];
$menu .= $_submenu[5];
}
}
$menu .= $_menu[5];
}
//global sape
$arr = get("select * from ".DP."comas_p_vars where pid='".$site_id."' and name='sape'");
$global_sape = $arr[0]['val'];
$page_tpl = file_get_contents('tpl.php');
$page_tpl = str_replace("{NAME}",$page_name,$page_tpl);
$page_tpl = str_replace("{TITLE}",$page_title,$page_tpl);
$page_tpl = str_replace("{KEYWORDS}",$page_keywords,$page_tpl);
$page_tpl = str_replace("{DESCRIPTION}",$page_description,$page_tpl);
$page_tpl = str_replace("{MENU}",$menu,$page_tpl);
$page_tpl = str_replace("{PATH}",$page_path,$page_tpl);