Smarty implements cascade menus as functions and then
Function typeList0l ()
{
Global $ lng;
Echo " <B> click the icon to expand the category </B> <BR> ";
$ SQL = "select * from xy_product_typelist where typeclass = 'pro' and typeid = 0 and lng = '$ lng' order by pid, id ";
$ Result1 = mysql_query ($ SQL );
$ Treehowid = mysql_num_rows ($ result1 );
$ I = 1;
While ($ typeList = mysql_fetch_array ($ result1 )){
$ Treehowid2 = treehowid ($ typeList ["id"]); // you can specify data under this category.
$ Typeid2 = "|". $ typeList ["id"]. "| ";
$ Typeid3 = strpos ($ _ SESSION ["treeid2"], $ typeid2 );
If ($ I ==$ treehowid ){
If ($ treehowid2 <= 0 ){
Echo " <a title = '". $ typeList ["typename"]. "'href = 'View. php? Typeid = ". $ typeList [" id "]." 'class = 'ollink01 '> ". $ typeList [" typename "]." </a> <BR> ";
} Else {
If (strpos ($ _ SESSION ["treeid2"], $ typeid2)> 0 ){
Echo "<a href = '# 'onfocus = 'This. blur () 'onclick = "showLay ('Layer ". $ typeList ["id"]. "')"> <span id = "spLayer ". $ typeList ["id"]. ""> </span> </a> <a title = '". $ typeList ["typename"]. "'href = 'View. php? Typeid = ". $ typeList [" id "]." 'class = 'ollink01 '> ". $ typeList [" typename "]." </a> <BR> ";
} Else {
Echo "<a href = '# 'onfocus = 'This. blur () 'onclick = "showLay ('Layer ". $ typeList ["id"]. "')"> <span id = "spLayer ". $ typeList ["id"]. ""> </span> </a> <a title = '". $ typeList ["typename"]. "'href = 'View. php? Typeid = ". $ typeList [" id "]." 'class = 'ollink01 '> ". $ typeList [" typename "]." </a> <BR> ";
}
}
} Else {
If ($ treehowid2 <= 0 ){
Echo " <a title = '". $ typeList ["typename"]. "'href = 'View. php? Typeid = ". $ typeList [" id "]." 'class = 'ollink01 '> ". $ typeList [" typename "]." </a> <BR> ";
} Else {
If (strpos ($ _ SESSION ["treeid2"], $ typeid2)> 0 ){
Echo "<a href = '# 'onfocus = 'This. blur () 'onclick = "showLay ('Layer ". $ typeList ["id"]. "')"> <span id = "spLayer ". $ typeList ["id"]. ""> </span> </a> <a title = '". $ typeList ["typename"]. "'href = 'View. php? Typeid = ". $ typeList [" id "]." 'class = 'ollink01 '> ". $ typeList [" typename "]." </a> <BR> ";
} Else {
Echo "<a href = '# 'onfocus = 'This. blur () 'onclick = "showLay ('Layer ". $ typeList ["id"]. "')"> <span id = "spLayer ". $ typeList ["id"]. ""> </span> </a> <a title = '". $ typeList ["typename"]. "'href = 'View. php? Typeid = ". $ typeList [" id "]." 'class = 'ollink01 '> ". $ typeList [" typename "]." </a> <BR> ";
}
}
}
$ Imgid = " ";
TypeList02 ($ typeList ["id"], $ imgid );
$ I ++;
}
}
// Display subcategories cyclically
Function typeList02 ($ typeid, $ imgid)
{
$ Typeid2 = $ _ GET ["typeid"];
$ SQL = "select * from xy_product_typelist where typeclass = 'pro' and typeid = $ typeid order by pid, id ";
$ Result12 = mysql_query ($ SQL );
If (mysql_num_rows ($ result12)> 0 ){
$ Typeid2 = "|". $ typeid. "| ";
$ Typeid3 = strpos ($ _ SESSION ["treeid2"], $ typeid2 );
If (strpos ($ _ SESSION ["treeid2"], $ typeid2)> 0 ){
Echo "<div id =" Layer ". $ typeid." "style =" display: yes; "> ";
} Else {
Echo "<div id =" Layer ". $ typeid." "style =" display: none; "> ";
}
$ Ii = 1;
While ($ myrow = mysql_fetch_array ($ result12 )){
$ Treehowid = treehowid ($ myrow ["id"]);
If ($ treehowid <= 0 ){
Echo $ imgid. " <a title = '". $ myrow ["typename"]. "'href = 'View. php? Typeid = ". $ myrow [" id "]." 'class = 'ollink02'> ". $ myrow [" typename "]." </a> <BR> ";
} Else {
$ Imgid1 = " ";
If ($ ii = $ treehowid ){
Echo $ imgid. "<a onFocus = 'This. blur () 'href = '# 'onclick = "showLay ('Layer ". $ myrow ["id"]. "')"> <span id = "spLayer ". $ myrow ["id"]. ""> </span> </a> <a title = '". $ myrow ["typename"]. "'href = 'View. php? Typeid = ". $ myrow [" id "]." 'class = 'ollink02'> ". $ myrow [" typename "]." </a> <BR> ";
$ Imgid1 = "". $ imgid;
TypeList02 ($ myrow ["id"], $ imgid1 );
}
Else {
$ Typeidnow = $ _ GET ["typeid"];
Echo $ imgid. "<a onFocus = 'This. blur () 'href = '# 'onclick = "showLay ('Layer ". $ myrow ["id"]. "')"> <span id = "spLayer ". $ myrow ["id"]. ""> </span> </a> <a title = '". $ myrow ["typename"]. "'href = 'View. php? Typeid = ". $ myrow [" id "]." 'class = 'ollink02'> ". $ myrow [" typename "]." </a> <BR> ";
TypeList02 ($ myrow ["id"], $ imgid. $ imgid1 );
}
}
$ Ii ++;
}
Echo "</div> ";
}
}
// Display the number of sub-classes
Function treehowid ($ typeid)
{
$ SQL = "select * from xy_product_typelist where typeclass = 'pro' and typeid = $ typeid order by pid, id ";
$ Result12 = mysql_query ($ SQL );
$ Treehowid = mysql_num_rows ($ result12 );
Return $ treehowid;
}