Woohoo!
![Big Grin](https://community.sellerdeck.com/core/images/smilies/biggrin.gif)
if($respect==true) { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 AND [bIncludeToSiteMap]=1 ORDER BY [Catalogue Section Sequence] ASC"; } else { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 ORDER BY [Catalogue Section Sequence] ASC"; }
if($respect==true) { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 AND [bIncludeToSiteMap]=1 AND [Status]='N' ORDER BY [Catalogue Section Sequence] ASC"; } else { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 AND [Status]='N' ORDER BY [Catalogue Section Sequence] ASC"; }
if($respect==true) { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 AND [bIncludeToSiteMap]=1 AND [Status]='N' ORDER BY [Section text] ASC"; } else { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 AND [Status]='N' ORDER BY [Section text] ASC"; }
if (!function_exists('SectionList')) { function SectionList($connect,$sectid,$recursedepth,$rendermode,$thispatharr,$stylecounter,$respect) { $recursedepth=$recursedepth-1; $stylecounter=$stylecounter+1; if($respect==true) { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 AND [bIncludeToSiteMap]=1 ORDER BY [Catalogue Section Sequence] ASC"; } else { $query = "SELECT [sPageName], [Section text], [nSectionID] FROM [Catalog Section] WHERE [nParentSectionID]=".$sectid." AND [bHideOnWebSite]=0 ORDER BY [Catalogue Section Sequence] ASC"; } $result = odbc_exec($connect, $query); $numrows = useful_odbc_num_rows($result); if ($numrows!=0) {echo "\n\n<ul class=\"ul".$stylecounter."\">\n";} while(odbc_fetch_row($result)){ $sPageName = odbc_result($result, 1); $Sectiontext = odbc_result($result, 2); $nSectionID = odbc_result($result, 3); // add this line here to stop generating code for non existent pages if ($sPageName!="") { $thisstyle=""; $expandthis=false; foreach ($thispatharr as $value) { if ($value==$nSectionID) { $thisstyle="_selected"; $expandthis=true; } } $linkitem="<a href=\"#link#\" class=\"link".$stylecounter.$thisstyle."\">"; echo "\t<li class=\"li".$stylecounter.$thisstyle."\">"; echo str_replace("#link#",$sPageName,$linkitem); echo trim($Sectiontext); echo "</a>"; //recurse if ($rendermode == 1) { $expandthis=true; } if ($recursedepth>=1 and $expandthis==true){ SectionList($connect,$nSectionID,$recursedepth,$rendermode,$thispatharr,$stylecounter,$respect); } echo "</li>\n"; // and this one to close the condition. } } if ($numrows!=0) { echo "</ul>\n\n"; } odbc_free_result($result); } }
Comment