Пример #1
0
function getCategoryOptions($categories_array, $selected_id = 0)
{
    if (!$categories_array) {
        return $categories_array;
    }
    $options = '';
    foreach ($categories_array as $category) {
        $options .= '<option ' . ($category['id'] == $selected_id ? 'selected' : '') . ' value="' . $category['id'] . '">' . $category['text'] . '</option>';
        if ($category['children']) {
            $options .= getCategoryOptions($category['children']);
        }
    }
    return $options;
}
Пример #2
0
function getCategoryOptions($pid = 0, $level = 0)
{
    global $DB;
    $str = '';
    $arr = $DB->fetchAll("SELECT * FROM `t_sort` where pid=? order by weight desc, id desc", array($pid));
    foreach ($arr as $key => $row) {
        $str .= '<option value="' . $row['id'] . '">' . getDeepTag($level) . $row['title'] . '</option>';
        $str .= getCategoryOptions($row['id'], $level + 1);
    }
    return $str;
}
Пример #3
0
?>
" /></td>
	</tr>
	
	
	<tr><td class="align_right">主图片地址:<br><a href="javascript:addProductImage();">添加子图</a></td>
	<td><input type="text" style="width:90%;" name="products_image"  id="products_image" value="<?php 
echo $products_image;
?>
" /></td>
	</tr>
	
	<tr><td class="align_right">要抓取的产品分类ID:</td>
	<td>
	<?php 
echo '<select name="products_cat"><option>Please select...</option>' . getCategoryOptions($all_categories, $products_cat) . '</select>';
?>
	
	</td>
	</tr>
	<tr><td class="align_right">产品价格:</td>
	<td><input type="text" style="width:100%;" name="products_price" value="<?php 
echo $products_price;
?>
" /></td>
	</tr>
	
	<?php 
if (0) {
    ?>
	<tr><td class="align_right">产品简述:</td>