feha
asked on
Recursive Tree PHP and Breadcrumbs
Hello EE
I know somewhere is given answer to these questions, but I have no premium subscription.
Need a solution as function or class.
please NO GPL and do not post links from search engines, I need concrete solution (will not accept these answers)
I do have a DB table pid, s_pid, menu_name, tooltip, content ... (table name cms_pages)
s_pid is "parent" default value 0 and pid is "main"
I need to render Recursive Tree menu (unlimited sub levels) from DB and want to generate clean UL (unordered list xhtml valid)
As is on my CMS:
http://www.vision.to/CMS_BE/Home/
I need this functionality without using sessions or cookies and by inputting just one parameter example pid (the main index, node)
when parameter pid is requested even if it is sub or sub-sub item it should expand main, sub, sub (making css class or id "current" for that sub and main node.
the result should be printed by function
example
echo my_menu($pid);
plus a solution if one main item does not exist or is deleted the sub items (if deleted main item) should become as main
also I need the same way a breadcrumb
show current pid just getting one parameter ...
Start » Page 1 [Articles] » Sub-Page 1.3 [Articles] » test
That means the system should be able to find if current parameter is main item or if is sub or sub-sub-sub find it self the main item ...
waiting for you
I know somewhere is given answer to these questions, but I have no premium subscription.
Need a solution as function or class.
please NO GPL and do not post links from search engines, I need concrete solution (will not accept these answers)
I do have a DB table pid, s_pid, menu_name, tooltip, content ... (table name cms_pages)
s_pid is "parent" default value 0 and pid is "main"
I need to render Recursive Tree menu (unlimited sub levels) from DB and want to generate clean UL (unordered list xhtml valid)
As is on my CMS:
http://www.vision.to/CMS_BE/Home/
I need this functionality without using sessions or cookies and by inputting just one parameter example pid (the main index, node)
when parameter pid is requested even if it is sub or sub-sub item it should expand main, sub, sub (making css class or id "current" for that sub and main node.
the result should be printed by function
example
echo my_menu($pid);
plus a solution if one main item does not exist or is deleted the sub items (if deleted main item) should become as main
also I need the same way a breadcrumb
show current pid just getting one parameter ...
Start » Page 1 [Articles] » Sub-Page 1.3 [Articles] » test
That means the system should be able to find if current parameter is main item or if is sub or sub-sub-sub find it self the main item ...
waiting for you
Hi,
based on your question I found this solution. I hope I have understood it correctly. I have not read your comment, but I will do it later at home. w3.org said it is valid xhtml1.1 (the menu-tree). You can use it in a single sample page. It also contains code for some demo db-entries I used.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml1i1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<title>Testpage</title>
</head>
<body>
<div>
<?php
include("../include/adodb/ adodb.inc. php");
$db=NewADOConnection("mysq l");
$db->Connect("dbhost","dbu ser","dbpa ss","dbnam e");
$id=7; // current selected
function my_menu ($aid=0, $pid=0, $level=0)
{
// need a local copy for using foreach
$menu_local = $GLOBALS['menu'];
$found_node = false;
$html = "";
foreach($menu_local as $node)
{
if($node['s_pid'] == $pid)
{
if(!$found_node)
{
$html.="<ul>\n";
$found_node = true;
}
if($node['pid'] == $aid)
{
$active=' id="active"';
}
else
{
$active='';
}
//$html.=sprintf("%s<li%s> %s</li>\n" ,
// str_repeat(' ', $level),$active,$node['men u_name']);
$html.=sprintf("<li%s>%s</ li>\n",
$active,$node['menu_name'] );
$submenu=my_menu($aid, $node['pid'], $level+1);
if(!empty($submenu))
{
$html.="<li>".$submenu."</ li>\n";
}
}
}
if($found_node)
{
$html.="</ul>\n";
}
return $html;
}
function load_menu ($db)
{
$GLOBALS['menu'] = Array();
$query = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages";
$db->SetFetchMode(ADODB_FE TCH_ASSOC) ;
$rs = $db->Execute($query);
while(!$rs->EOF)
{
$GLOBALS['menu'][$rs->fiel ds['pid']] = $rs->fields;
$rs->MoveNext();
}
}
function backlink ($pid)
{
if($pid != 0)
{
$html=backlink($GLOBALS['m enu'][$pid ]['s_pid'] );
$html.=" --> ".$GLOBALS['menu'][$pid][' menu_name' ];
}
else
{
$html="Home";
}
return $html;
}
function find_orphan($db,$correct=f alse)
{
foreach($GLOBALS['menu'] as $node)
{
if(!isset($GLOBALS['menu'] [$node['s_ pid']]) && $node['s_pid'] != 0)
{
if($correct)
{
$query = "UPDATE cms_pages SET s_pid=0 WHERE pid=".$node['pid'];
$db->Execute($query);
}
else
{
echo "<div>Orphan: ".$node['pid']."</div>";
}
}
}
}
function create_table($db)
{
$query = "CREATE TABLE cms_pages (
pid INT PRIMARY KEY,
s_pid INT NOT NULL DEFAULT 0,
menu_name VARCHAR(30),
tooltip VARCHAR(255))";
$db->Execute($query);
}
function fill_data($db)
{
$query = "INSERT INTO cms_pages VALUES (1,0,'Main 1', 'Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (2,0,'Main 2', 'Main 2')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (3,0,'Main 3', 'Main 3')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (4,1,'Sub 1 Main 1', 'Sub 1 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (5,1,'Sub 2 Main 1', 'Sub 2 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (6,5,'Sub 1 Sub 2 Main 1', 'Sub1 Sub 2 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (7,5,'Sub 2 Sub 2 Main 1', 'Sub 2 Sub 2 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (8,1,'Sub 3 Main 1', 'Sub 3 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (9,2,'Sub 1 Main 2', 'Sub 1 Main 2')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (10,2,'Sub 2 Main 2', 'Sub 2 Main 2')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (11,0,'Main 4', 'Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (12,11,'Sub 1 Main 4', 'Sub 1 Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (13,12,'Sub 1 Sub 1 Main 4', 'Sub 1 Sub 1 Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (14,13,'Sub 1 Sub 1 Sub 1 Main 4', 'Sub 1 Sub 1 Sub 1 Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (16,15,'Sub 1 Main 5', 'help me I am orphan')";
$db->Execute($query);
}
// create_table($db);
// fill_data($db);
load_menu($db);
// show orphan
find_orphan($db);
// Correct orphan
find_orphan($db,true);
// HERE is your $id used
echo backlink($id);
echo my_menu($id);
?>
</div>
</body>
</html>
based on your question I found this solution. I hope I have understood it correctly. I have not read your comment, but I will do it later at home. w3.org said it is valid xhtml1.1 (the menu-tree). You can use it in a single sample page. It also contains code for some demo db-entries I used.
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml1i1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de">
<head>
<title>Testpage</title>
</head>
<body>
<div>
<?php
include("../include/adodb/
$db=NewADOConnection("mysq
$db->Connect("dbhost","dbu
$id=7; // current selected
function my_menu ($aid=0, $pid=0, $level=0)
{
// need a local copy for using foreach
$menu_local = $GLOBALS['menu'];
$found_node = false;
$html = "";
foreach($menu_local as $node)
{
if($node['s_pid'] == $pid)
{
if(!$found_node)
{
$html.="<ul>\n";
$found_node = true;
}
if($node['pid'] == $aid)
{
$active=' id="active"';
}
else
{
$active='';
}
//$html.=sprintf("%s<li%s>
// str_repeat(' ', $level),$active,$node['men
$html.=sprintf("<li%s>%s</
$active,$node['menu_name']
$submenu=my_menu($aid, $node['pid'], $level+1);
if(!empty($submenu))
{
$html.="<li>".$submenu."</
}
}
}
if($found_node)
{
$html.="</ul>\n";
}
return $html;
}
function load_menu ($db)
{
$GLOBALS['menu'] = Array();
$query = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages";
$db->SetFetchMode(ADODB_FE
$rs = $db->Execute($query);
while(!$rs->EOF)
{
$GLOBALS['menu'][$rs->fiel
$rs->MoveNext();
}
}
function backlink ($pid)
{
if($pid != 0)
{
$html=backlink($GLOBALS['m
$html.=" --> ".$GLOBALS['menu'][$pid]['
}
else
{
$html="Home";
}
return $html;
}
function find_orphan($db,$correct=f
{
foreach($GLOBALS['menu'] as $node)
{
if(!isset($GLOBALS['menu']
{
if($correct)
{
$query = "UPDATE cms_pages SET s_pid=0 WHERE pid=".$node['pid'];
$db->Execute($query);
}
else
{
echo "<div>Orphan: ".$node['pid']."</div>";
}
}
}
}
function create_table($db)
{
$query = "CREATE TABLE cms_pages (
pid INT PRIMARY KEY,
s_pid INT NOT NULL DEFAULT 0,
menu_name VARCHAR(30),
tooltip VARCHAR(255))";
$db->Execute($query);
}
function fill_data($db)
{
$query = "INSERT INTO cms_pages VALUES (1,0,'Main 1', 'Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (2,0,'Main 2', 'Main 2')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (3,0,'Main 3', 'Main 3')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (4,1,'Sub 1 Main 1', 'Sub 1 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (5,1,'Sub 2 Main 1', 'Sub 2 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (6,5,'Sub 1 Sub 2 Main 1', 'Sub1 Sub 2 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (7,5,'Sub 2 Sub 2 Main 1', 'Sub 2 Sub 2 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (8,1,'Sub 3 Main 1', 'Sub 3 Main 1')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (9,2,'Sub 1 Main 2', 'Sub 1 Main 2')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (10,2,'Sub 2 Main 2', 'Sub 2 Main 2')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (11,0,'Main 4', 'Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (12,11,'Sub 1 Main 4', 'Sub 1 Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (13,12,'Sub 1 Sub 1 Main 4', 'Sub 1 Sub 1 Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (14,13,'Sub 1 Sub 1 Sub 1 Main 4', 'Sub 1 Sub 1 Sub 1 Main 4')";
$db->Execute($query);
$query = "INSERT INTO cms_pages VALUES (16,15,'Sub 1 Main 5', 'help me I am orphan')";
$db->Execute($query);
}
// create_table($db);
// fill_data($db);
load_menu($db);
// show orphan
find_orphan($db);
// Correct orphan
find_orphan($db,true);
// HERE is your $id used
echo backlink($id);
echo my_menu($id);
?>
</div>
</body>
</html>
ASKER
im testing your script
breadcrumbs are ok and working great ...
the tree should expand only the "section" of $id example 7
if id 7
than
Main 1
Sub 1 Main 1
Sub 2 Main 1
Sub 1 Sub 2 Main 1
Sub 2 Sub 2 Main 1
Sub 3 Main 1
should stay expanded
and otherr should be as main (not expanded) if possible as option
this is 90 % OK
breadcrumbs are ok and working great ...
the tree should expand only the "section" of $id example 7
if id 7
than
Main 1
Sub 1 Main 1
Sub 2 Main 1
Sub 1 Sub 2 Main 1
Sub 2 Sub 2 Main 1
Sub 3 Main 1
should stay expanded
and otherr should be as main (not expanded) if possible as option
this is 90 % OK
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you very much , well done.
ASKER
i just have problems with this function
function load_menu ($db)
{
$GLOBALS['menu'] = Array();
$query = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages";
$db->SetFetchMode(ADODB_FE TCH_ASSOC) ;
$rs = $db->Execute($query);
while(!$rs->EOF)
{
$GLOBALS['menu'][$rs->fiel ds['pid']] = $rs->fields;
$rs->MoveNext();
}
}
I'm not using ADODB connection or warapper ....
The model im using is :
function load_menu ($db)
{
$GLOBALS['menu'] = Array();
$SQL = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages";
$db->query($SQL);
while($db->next_record())
{
// $GLOBALS['menu'][$rs->fiel ds['pid']] = $rs->fields;
/* ========================== ========== ========== =======
$db->f("pid") , $db->f("s_pid") , $db->f("menu_name") etc ...
How to put these in coorrect array in order to get menu working
========================== ========== ========== ========= */
}
}
function load_menu ($db)
{
$GLOBALS['menu'] = Array();
$query = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages";
$db->SetFetchMode(ADODB_FE
$rs = $db->Execute($query);
while(!$rs->EOF)
{
$GLOBALS['menu'][$rs->fiel
$rs->MoveNext();
}
}
I'm not using ADODB connection or warapper ....
The model im using is :
function load_menu ($db)
{
$GLOBALS['menu'] = Array();
$SQL = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages";
$db->query($SQL);
while($db->next_record())
{
// $GLOBALS['menu'][$rs->fiel
/* ==========================
$db->f("pid") , $db->f("s_pid") , $db->f("menu_name") etc ...
How to put these in coorrect array in order to get menu working
==========================
}
}
$GLOBALS['menu'][$db->f("p id")]=Arra y("pid" => $db->f("pid"), "s_pid" => $db->f("s_pid"), "menu_name" => $db->f("menu_name"));
should work
should work
ASKER
Thank You very much :-)
ASKER
i get Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM S_UNIVERSE \Functions \website_m enu_func.p hp on line 40
if i set $pid='7'; i get same error with corresponding pid ...
the function i changed to work with my DB is:
function load_menu ()
{
$db = new clsDBcms();
$GLOBALS['menu'] = Array();
$SQL = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages WHERE active=1";
$db->query($SQL);
while($db->next_record())
{
$GLOBALS['menu'][$db->f("p id")]=Arra y("pid" => $db->f("pid"), "s_pid" => $db->f("s_pid"), "menu_name" => $db->f("menu_name"));
}
$db->close();
}
i think there is problem pasing array
Note:I'm not using here any longer ADODB ...
if i set $pid='7'; i get same error with corresponding pid ...
the function i changed to work with my DB is:
function load_menu ()
{
$db = new clsDBcms();
$GLOBALS['menu'] = Array();
$SQL = "SELECT pid, s_pid, menu_name, tooltip FROM cms_pages WHERE active=1";
$db->query($SQL);
while($db->next_record())
{
$GLOBALS['menu'][$db->f("p
}
$db->close();
}
i think there is problem pasing array
Note:I'm not using here any longer ADODB ...
Which line is the line 40? in the website_menu_func.php?
When you will use your tooltips you should add "tooltip" => $db->f("tooltip") to the array.
When you will use your tooltips you should add "tooltip" => $db->f("tooltip") to the array.
ASKER
line 40
$html=backlink($GLOBALS['m enu'][$pid ]['s_pid'] );
line41
$html.=" --> ".$GLOBALS['menu'][$pid][' menu_name' ];
line118
$active=array_merge($activ e,get_acti ve_path($G LOBALS['me nu'][$pid] ['s_pid']) );
error's
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM S_UNIVERSE \Functions \website_m enu_func.p hp on line 40
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM S_UNIVERSE \Functions \website_m enu_func.p hp on line 41
Home -->
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM S_UNIVERSE \Functions \website_m enu_func.p hp on line 118
$html=backlink($GLOBALS['m
line41
$html.=" --> ".$GLOBALS['menu'][$pid]['
line118
$active=array_merge($activ
error's
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM
Home -->
Notice: Undefined offset: 1 in c:\inetpub\wwwroot\php4\CM
ASKER
Ok
got it to work
the problem was my old cms_pages table structure ...
is ther any problem if s_pid is empty (NULL) ?
this will work ok
thannk you
got it to work
the problem was my old cms_pages table structure ...
is ther any problem if s_pid is empty (NULL) ?
this will work ok
thannk you
ASKER
my last question
im in process adding links
$html.=sprintf("<li%s>%s</ li>\n",
?
I do have probem to add links this way ....
link should be index.php?pid= ... and title will have tooltip text
im in process adding links
$html.=sprintf("<li%s>%s</
?
I do have probem to add links this way ....
link should be index.php?pid= ... and title will have tooltip text
I think there will be no problem with s_pid being NULL only that find orphan will probably set the NULL to 0 (main element)
an link will be easy, look a bit in the sprintf php documentation
$html.=sprintf("<li%s><a href=\"%s\" title=\"%s\">%s</a></li>\n ",
$active,$url,$node['toolti p'],$node[ 'menu_name ']);
should work.
an link will be easy, look a bit in the sprintf php documentation
$html.=sprintf("<li%s><a href=\"%s\" title=\"%s\">%s</a></li>\n
$active,$url,$node['toolti
should work.
ASKER
Thank You
I don't use much sprintf (except for time things) :-), but will read about it.
Thank you very much for your great help.
I don't use much sprintf (except for time things) :-), but will read about it.
Thank you very much for your great help.
ASKER
fixed
works great
$url="index.php?pid=".$nod e['pid'];
$html.=sprintf("<li%s><a href=\"%s\" title=\"%s\">%s</a></li>\n ", $active,$url,$node['toolti p'],$node[ 'menu_name ']);
:-)
works great
$url="index.php?pid=".$nod
$html.=sprintf("<li%s><a href=\"%s\" title=\"%s\">%s</a></li>\n
:-)
ASKER
sorry to bother you ...
i still have problems when trying to use sections and languages ...
if system does not find any records it shows undefined index errors ...
Source code is here
http://www.vision.to/test/website_menu_func.phps
commented querries does not work if no record found ...
when trying to select by lang_id or front_id ...
here is working example of my old menu solution:
http://trinityhome.org/~visionto/Home/index.php?front_id=1
I just want similar put with single pid ...
else works ok ...
if you want i can open another question and give 250 points ...
i still have problems when trying to use sections and languages ...
if system does not find any records it shows undefined index errors ...
Source code is here
http://www.vision.to/test/website_menu_func.phps
commented querries does not work if no record found ...
when trying to select by lang_id or front_id ...
here is working example of my old menu solution:
http://trinityhome.org/~visionto/Home/index.php?front_id=1
I just want similar put with single pid ...
else works ok ...
if you want i can open another question and give 250 points ...
I dont really get the problem at the moment, an new question would be the best because of more people will read it and maybe someone will catch the problem and present you an answer.
ASKER
ok thank you :-)
ASKER
// ==========================
function VISION_TO_PAGE_NAV($menu_o
{
if(!CCGetGroupID()){CCSetS
if(CCGetFromGet("wpid"))
{
CCSetSession("wpid".SUFFIX
}
if(CCGetFromGet("p_node"))
{
CCSetSession("p_node".SUFF
}
global $cms_page_menu;
$cms_page_menu = "";
$_PAGE_INDEX =FILE_NAME;
$Expand_Collapse="";
//$Expand_Collapse="<a href=\"$_PAGE_INDEX?p_expa
switch($menu_option)
{
case 1: return VISION_TO_TRANSLATE("<div id=\"$id\">$Expand_Collaps
case 2: return VISION_TO_TRANSLATE("<div id=\"$id\">$Expand_Collaps
case 3: return VISION_TO_TRANSLATE("<div id=\"$id\">$Expand_Collaps
default: return VISION_TO_TRANSLATE("<div id=\"$id\">$Expand_Collaps
}
}
//========================
//========================
// MENU 2
//========================
function VISION_TO_PAGE_NAV_2($_PAG
{
//Expand On pid
global $cms_page_menu;
global $CMS_CONFIG;
if(!CCGetSession("front_id
{
CCSetSession("front_id".SU
}
$db = new clsDBcms();
if(isset($_SERVER['HTTP_US
{
$SQL = "SELECT pid, s_pid, front_id, page_title, menu_name FROM cms_pages WHERE active=1 AND s_pid = ".$db->ToSQL($parent,ccsIn
}
elseif(CCGetSession("front
{
$SQL = "SELECT pid, s_pid, front_id, page_title, menu_name FROM cms_pages WHERE active=1 AND s_pid = ".$db->ToSQL($parent,ccsIn
}
else
{
$SQL = "SELECT pid, s_pid, front_id, page_title, menu_name FROM cms_pages WHERE active=1 AND s_pid = ".$db->ToSQL($parent,ccsIn
}
$res = $db->query($SQL);
if($res > 0)
{
$cms_page_menu .="<ul>";
while($db->next_record())
{
$current_link = "";
$current_li = "";
//if(eregi(basename($_page
if(CCGetSession("p_node".S
{
$current_link=" class=\"current_page\" ";
$current_li=" class=\"active_page\" ";
}
/*
if($db->f("s_pid") == 0)
{
$cms_page_menu .="<li$current_li><a href=\"".$_PAGE_INDEX."?wp
}
else
{
$cms_page_menu .="<li$current_li><a href=\"".$_PAGE_INDEX."?pi
}
*/
if($db->f("s_pid") == 0)
{
$cms_page_menu .="<li$current_li><a href=\"".$_PAGE_INDEX."?wp
}
else
{
$cms_page_menu .="<li$current_li><a href=\"".$_PAGE_INDEX."?pi
}
if(isset($_SERVER['HTTP_US
{
VISION_TO_PAGE_NAV_2($_PAG
}
elseif(CCGetSession("p_nod
{
VISION_TO_PAGE_NAV_2($_PAG
}
/*
else
{
VISION_TO_PAGE_NAV_2($_PAG
}
*/
$cms_page_menu .="</li>\n";
}
$cms_page_menu .="</ul>";
}
$db->close();
return $cms_page_menu;
}
//========================
the first function is "Switcher" ...
here is used input param (wpid) and sesions ...