示例#1
0
function cmsmenu($parent, $level)
{
    $result = mysql_query("SELECT a.id, a.label, a.link, Deriv1.Count FROM `categories` a  LEFT OUTER JOIN \n        (SELECT parent, COUNT(*) AS Count FROM `categories` GROUP BY parent) Deriv1 ON a.id = Deriv1.parent WHERE a.parent='{$parent}' AND a.relevent!=2");
    echo "<ul>";
    while ($row = mysql_fetch_assoc($result)) {
        if ($row['Count'] > 0) {
            echo "<li><img src='../lib/style/images/deleteicon.png' alt='Delete Category' width='15' id='" . $row['id'] . "'> <a href='" . $row['link'] . "'>" . $row['label'] . "</a>";
            cmsmenu($row['id'], $level + 1);
            echo "</li>";
        } elseif ($row['Count'] == 0) {
            echo "<li><img src='../lib/style/images/deleteicon.png' alt='Delete Category' width='15' id='" . $row['id'] . "'> <a href='" . $row['link'] . "'>" . $row['label'] . "</a></li>";
        } else {
        }
    }
    echo "</ul>";
}
示例#2
0
  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
  <link rel="shortcut icon" href="lib/style/images/favicon.ico" >
  <link href="../lib/style/style.css" rel="stylesheet" type="text/css" />  
  <link href="http://fonts.googleapis.com/css?family=Ubuntu:500|Open+Sans|Open+Sans+Condensed:300" rel="stylesheet" type="text/css">
  <script src='../lib/cms.js' type='text/javascript'></script>
</head>
<body>
  <div id="header">
    <div id="logo">
      <h1><a href="./"> Content Management System </a></h1>
    </div>
  </div>
    <div id="cmsmenu">
    <h4>Select / Delete a Category</h4>
      <?php 
cmsmenu(0, 1);
?>
    </div>
  <div id="productlist">
  </div>
  <div id="newtoggles">
    <div id="newproduct"><a>+ Add New Product</a></div>
    <div id="newcategory"><a>+ Add Categories</a></div>
  </div>
  <div id="addproducts">
   <h2>Add New Products</h2>
   <form id="addproductform">
     <p><label for="product_name">Name:</label><input type="text" id="product_name" name="product_name" placeholder="Product Name"/></p>
     <p><label for="price">Price (&#163;):</label><input type="text" id="price" name="price" placeholder="Price (&#163;)"/></p>
     <p><label for="description">Description:</label><textarea id="description" name="description"></textarea></p>
     <p><label for="category">Category:</label><input type="text" id="category" name="category" placeholder="Category"/></p>