Menu writer 1.0.4 dynamic
Menu writer 1.0.4 with dynamic main and nexted 1-level
testphp.php
Below page code: menu.pgp
-------------------------------------------------------------------------------------
<?php require_once($WA_dotDotSlash ."Connections/sdconn.php"); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
mysql_select_db($database_sdconn, $sdconn);
$query_master1categories_ctg = "SELECT * FROM categories_ctg ORDER BY order_ctg";
$master1categories_ctg = mysql_query($query_master1categories_ctg, $sdconn) or die(mysql_error());
$row_master1categories_ctg = mysql_fetch_assoc($master1categories_ctg);
$totalRows_master1categories_ctg = mysql_num_rows($master1categories_ctg);
mysql_select_db($database_sdconn, $sdconn);
$query_detail3subcategory_stg = "SELECT count(products_prd.id_prd) AS count_prods, subcategory_stg.id_stg, subcategory_stg.id_ctg, subcategory_stg.name_ctg, subcategory_stg.order_ctg, subcategory_stg.visible_ctg FROM (subcategory_stg LEFT JOIN products_prd ON products_prd.idstg_prd=subcategory_stg.id_stg) WHERE subcategory_stg.id_ctg=123456789 AND subcategory_stg.visible_ctg=1 GROUP BY subcategory_stg.id_stg, subcategory_stg.id_ctg, subcategory_stg.order_ctg ORDER BY subcategory_stg.order_ctg ASC ";
$detail3subcategory_stg = mysql_query($query_detail3subcategory_stg, $sdconn) or die(mysql_error());
$row_detail3subcategory_stg = mysql_fetch_assoc($detail3subcategory_stg);
$totalRows_detail3subcategory_stg = mysql_num_rows($detail3subcategory_stg);
$WA_localRoot = "/";
$WA_remoteRoot = "/";
$WA_curURL = strtolower((isset($_SERVER["PHP_SELF"]))?$_SERVER["PHP_SELF"]:"");
$assumedRoot = $WA_remoteRoot;
if (strpos($WA_curURL,strtolower($WA_localRoot)) == 0 && (strlen($WA_localRoot) >= strlen($WA_remoteRoot) || strpos($WA_curURL,strtolower($WA_localRoot)) === 0)) {
$assumedRoot = $WA_localRoot;
}
?>
<ul class="level-0" id="cssmw">
<?php do { ?>
<li><a href="#"><?php echo $row_master1categories_ctg['name_ctg']; ?></a>
<?php
if ($totalRows_master1categories_ctg>0) {
$nested_query_detail3subcategory_stg = str_replace("123456789", $row_master1categories_ctg['id_ctg'], $query_detail3subcategory_stg);
mysql_select_db($database_sdconn);
$detail3subcategory_stg = mysql_query($nested_query_detail3subcategory_stg, $sdconn) or die(mysql_error());
$row_detail3subcategory_stg = mysql_fetch_assoc($detail3subcategory_stg);
$totalRows_detail3subcategory_stg = mysql_num_rows($detail3subcategory_stg);
$nested_sw = false;
if (isset($row_detail3subcategory_stg) && is_array($row_detail3subcategory_stg)) {
do { //Nested repeat
?>
<ul class="level-1">
<li><a href="#"><?php echo $row_detail3subcategory_stg['name_ctg']; ?> ( <?php echo $row_detail3subcategory_stg['count_prods']; ?> )</a></li>
</ul>
<?php
} while ($row_detail3subcategory_stg = mysql_fetch_assoc($detail3subcategory_stg)); //Nested move next
}
}
?>
<?php } while ($row_master1categories_ctg = mysql_fetch_assoc($master1categories_ctg)); ?>
</ul>
<?php
mysql_free_result($master1categories_ctg);
mysql_free_result($detail3subcategory_stg);
?>
<script type="text/javascript">if(window.attachEvent) { window.attachEvent("onload", function() { cssmw.intializeMenu('cssmw'); }); } else if(window.addEventListener) { window.addEventListener("load", function() { cssmw.intializeMenu('cssmw'); }, true); }</script>
--------------------------------------------------------------------------------
What is missing here all the nexted sub categories are not showing
See page (temp) --> index_tmp.php