Smarty implements cascading menus

Source: Internet
Author: User

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;
        }

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.