当前位置: 首页>>代码示例>>PHP>>正文


PHP list_cats函数代码示例

本文整理汇总了PHP中list_cats函数的典型用法代码示例。如果您正苦于以下问题:PHP list_cats函数的具体用法?PHP list_cats怎么用?PHP list_cats使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了list_cats函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: b_wp_categories_show

function b_wp_categories_show($options)
{
    $block_style = $options[0] ? $options[0] : 0;
    $with_count = $options[1] ? $options[1] : 0;
    $sorting_key = $options[2] ? $options[2] : 'name';
    $sorting_order = $options[3] ? $options[3] : 'asc';
    $id = 1;
    global $dateformat, $time_difference, $siteurl, $blogfilename;
    global $tablelinks, $tablelinkcategories;
    global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
    global $tableposts, $tablepost2cat, $tablecomments, $tablecategories;
    global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace;
    global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    if ($block_style == 0) {
        // Simple Listing
        ob_start();
        list_cats(0, 'All', $sorting_key, $sorting_order, '', true, 0, $with_count);
        $block['content'] = ob_get_contents();
        ob_end_clean();
    } else {
        // Dropdown Listing
        $file = "{$siteurl}/{$blogfilename}";
        $link = $file . $querystring_start . 'cat' . $querystring_equal;
        ob_start();
        echo '<form name="listcatform" action="">';
        $select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform.cat[document.forms.listcatform.cat.selectedIndex].value);"> ';
        dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count);
        echo '</form>';
        $block_str = ob_get_contents();
        ob_end_clean();
        $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str);
    }
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:35,代码来源:wp_categories.php

示例2: b_wp_categories_show

function b_wp_categories_show($option)
{
    $id = 1;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    global $wpdb, $tablecomments, $tableposts;
    ob_flush();
    ob_start();
    list_cats(0, 'All', 'name');
    $block['content'] = ob_get_contents();
    ob_end_clean();
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:12,代码来源:wp_categories.php

示例3: b_wp_categories_show

function b_wp_categories_show($option)
{
    global $tableposts, $tablepost2cat, $tablecomments, $tablecategories;
    global $tableposts, $dateformat, $time_difference, $siteurl, $blogfilename;
    global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
    $id = 1;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    ob_flush();
    ob_start();
    list_cats(0, 'All', 'name');
    $block['content'] = ob_get_contents();
    ob_end_clean();
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:14,代码来源:wp_categories.php

示例4: b_wp_categories_show

 function b_wp_categories_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] ? $options[1] : 0;
     $sorting_key = $options[2] ? $options[2] : 'name';
     $sorting_order = $options[3] ? $options[3] : 'asc';
     global $wpdb, $siteurl, $wp_id, $wp_inblock, $user_cache, $cache_categories, $category_name, $cat;
     $id = 1;
     $use_cache = 1;
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     $cur_PATH = $_SERVER['SCRIPT_FILENAME'];
     if (preg_match("/^" . preg_quote(XOOPS_ROOT_PATH . "/modules/wordpress" . $wp_num . "/", "/") . "/i", $cur_PATH)) {
         $cat = array_key_exists('cat', $_GET) ? intval($_GET['cat']) : null;
         $category_name = array_key_exists('category_name', $_GET) ? $_GET['category_name'] : '';
         if ($category_name and $cat == 0) {
             $category_name = preg_replace('|/+$|', '', $category_name);
             $cat = $wpdb->get_var("SELECT cat_ID  FROM {$wpdb->categories[$wp_id]} WHERE category_nicename='{$category_name}'");
         }
     } else {
         $cat = 0;
         $category_name = "";
     }
     if ($block_style == 0) {
         // Simple Listing
         ob_start();
         list_cats(0, 'All', $sorting_key, $sorting_order, '', true, 0, $with_count);
         $block['content'] = ob_get_contents();
         ob_end_clean();
     } else {
         // Dropdown Listing
         $file = "{$siteurl}/index.php";
         $link = $file . '?cat=';
         ob_start();
         echo '<form name="listcatform' . $wp_num . '" action="">';
         $select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> ';
         dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count);
         echo '</form>';
         $block_str = ob_get_contents();
         ob_end_clean();
         $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str);
     }
     return $block;
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:48,代码来源:wp_categories.php

示例5: b_wp_categories_show

function b_wp_categories_show($option)
{
    $id = 1;
    global $dateformat, $time_difference, $siteurl, $blogfilename;
    global $tablelinks, $tablelinkcategories;
    global $querystring_start, $querystring_equal, $querystring_separator, $month, $wpdb, $start_of_week;
    global $tableposts, $tablepost2cat, $tablecomments, $tablecategories;
    global $smilies_directory, $use_smilies, $wp_smiliessearch, $wp_smiliesreplace;
    global $wp_bbcode, $use_bbcode, $wp_gmcode, $use_gmcode, $use_htmltrans, $wp_htmltrans, $wp_htmltranswinuni;
    require_once dirname(__FILE__) . '/../wp-blog-header.php';
    ob_start();
    list_cats(0, 'All', 'name');
    $block['content'] = ob_get_contents();
    ob_end_clean();
    return $block;
}
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:16,代码来源:wp_categories.php

示例6: categories_sidebar_module

function categories_sidebar_module($args)
{
    extract($args);
    echo $before_module . $before_title . $title . $after_title;
    ?>
	<ul>
		<?php 
    if (function_exists('wp_list_categories')) {
        wp_list_categories('title_li=&show_count=1&hierarchical=0');
    } else {
        list_cats(0, '', 'name', 'asc', '', 1, 0, 1, 1, 1, 1, 0, '', '', '', '', '');
    }
    ?>
	</ul>
	<?php 
    echo $after_module;
}
开发者ID:64kbytes,项目名称:stayinba,代码行数:17,代码来源:categories.php

示例7: b_wp_categories_show

 function b_wp_categories_show($options, $wp_num = "")
 {
     $block_style = $options[0] ? $options[0] : 0;
     $with_count = $options[1] ? $options[1] : 0;
     $sorting_key = $options[2] ? $options[2] : 'name';
     $sorting_order = $options[3] ? $options[3] : 'asc';
     global $wpdb, $siteurl, $wp_id, $wp_inblock, $user_cache, $category_name, $cat;
     $id = 1;
     $use_cache = 1;
     $cat = intval($_GET['cat']);
     $category_name = $_GET['category_name'];
     if ($wp_num == "") {
         $wp_id = $wp_num;
         $wp_inblock = 1;
         require dirname(__FILE__) . '/../wp-config.php';
         $wp_inblock = 0;
     }
     if ($block_style == 0) {
         // Simple Listing
         ob_start();
         list_cats(0, 'All', $sorting_key, $sorting_order, '', true, 0, $with_count);
         $block['content'] = ob_get_contents();
         ob_end_clean();
     } else {
         // Dropdown Listing
         $file = "{$siteurl}/index.php";
         $link = $file . '?cat=';
         ob_start();
         echo '<form name="listcatform' . $wp_num . '" action="">';
         $select_str = '<select name="cat" onchange="window.location = (\'' . $link . '\'+document.forms.listcatform' . $wp_num . '.cat[document.forms.listcatform' . $wp_num . '.cat.selectedIndex].value);"> ';
         dropdown_cats(1, _WP_LIST_CAT_ALL, $sorting_key, $sorting_order, 0, $with_count);
         echo '</form>';
         $block_str = ob_get_contents();
         ob_end_clean();
         $block['content'] = ereg_replace('\\<select name\\=[^\\>]*\\>', $select_str, $block_str);
     }
     return $block;
 }
开发者ID:BackupTheBerlios,项目名称:nobunobuxoops-svn,代码行数:38,代码来源:wp_categories.php

示例8: list_cats

function list_cats($parent, $lev, $color, $message)
{
    global $mysql_table_prefix;
    if ($lev == 0) {
        ?>
			<div id="submenu">
				<ul>
				<li><a href="admin.php?f=add_cat">Add category</a> </li>
				</ul>
			</div>
			<?php 
        print $message;
        print "<br/>";
        print "<br/><div align=\"center\"><center><table cellspacing =\"0\" cellpadding=\"0\" class=\"darkgrey\" width =\"600\"><tr><td><table table cellpadding=\"3\" cellspacing=\"1\" width=\"100%\">\n";
    }
    $space = "";
    for ($x = 0; $x < $lev; $x++) {
        $space .= "&nbsp;&nbsp;&nbsp;&nbsp;";
    }
    $query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent} ORDER BY category";
    $result = mysql_query($query);
    echo mysql_error();
    if (mysql_num_rows($result) != '') {
        while ($row = mysql_fetch_array($result)) {
            if ($color == "white") {
                $color = "grey";
            } else {
                $color = "white";
            }
            $id = $row['category_id'];
            $cat = $row['category'];
            print "<tr class=\"{$color}\"><td width=90% align=left>{$space}<a href=\"admin.php?f=edit_cat&cat_id={$id}\">" . stripslashes($cat) . "</a></td><td><a href=\"admin.php?f=edit_cat&cat_id={$id}\" id=\"small_button\">Edit</a></td><td> <a href=\"admin.php?f=11&cat_id={$id}\" onclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" id=\"small_button\">Delete</a></td></tr>\n";
            $color = list_cats($id, $lev + 1, $color, "");
        }
    }
    if ($lev == 0) {
        print "</table></td></tr></table></center></div>\n";
    }
    return $color;
}
开发者ID:vijaydamale,项目名称:Test,代码行数:40,代码来源:admin.php

示例9: list_cats

    function list_cats($cat, $indent = 0)
    {
        foreach ($cat as $v) {
            ?>
        
            <tr>
                <td><?php 
            echo str_repeat("&nbsp;&nbsp;", $indent * 4);
            echo $v['category_title'];
            ?>
</td>
                <td><?php 
            echo $v['category_slug'];
            ?>
</td>
                <td>
                    6565
                </td>
            </tr>
            
            <?php 
            if (!empty($v['category_subcats'])) {
                list_cats($v['category_subcats'], $indent + 1);
            }
        }
    }
开发者ID:double-web,项目名称:drawline,代码行数:26,代码来源:categories_list.php

示例10: list_cats



<div id="menu">

<h4>quick links:</h4>

<a href="http://www.cafelog.com" title="b2's homepage">cafelog.com</a><br />
<a href="http://some other site" title="another link">another link</a><br />
<a href="http://some other site" title="another link">another link</a><br />
<a href="http://some other site" title="another link">another link</a><br />


<h4>categories:</h4>

<?php 
list_cats(0, 'All', 'name');
?>

<h4>search:</h4>

<form name="searchform" method="get" action="<?php 
echo $PHP_SELF;
/*$siteurl."/".$blogfilename*/
?>
">
<p>
<input type="text" name="s" size="15" /><br />
<input type="submit" name="submit" value="search" />
</p>
</form>
开发者ID:ericandrewlewis,项目名称:b2,代码行数:28,代码来源:index.php

示例11: list_cats

function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
	global $wpdb, $wp_query;
	// Optiondates now works
	if ( '' == $file )
		$file = get_settings('home') . '/';

	$exclusions = '';
	if ( !empty($exclude) ) {
		$excats = preg_split('/[\s,]+/',$exclude);
		if ( count($excats) ) {
			foreach ( $excats as $excat ) {
				$exclusions .= ' AND cat_ID <> ' . intval($excat) . ' ';
			}
		}
	}

	$exclusions = apply_filters('list_cats_exclusions', $exclusions );

	if ( intval($categories) == 0 ) {
		$sort_column = 'cat_'.$sort_column;

		$query = "
			SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, category_count
			FROM $wpdb->categories
			WHERE cat_ID > 0 $exclusions
			ORDER BY $sort_column $sort_order";

		$categories = $wpdb->get_results($query);
	}

	if ( $optiondates ) {
		$cat_dates = $wpdb->get_results("	SELECT category_id,
		UNIX_TIMESTAMP( MAX(post_date) ) AS ts
		FROM $wpdb->posts, $wpdb->post2cat, $wpdb->categories
		WHERE post_status = 'publish' AND post_id = ID $exclusions
		GROUP BY category_id");
		foreach ( $cat_dates as $cat_date ) {
			$category_timestamp["$cat_date->category_id"] = $cat_date->ts;
		}
	}

	$num_found=0;
	$thelist = "";

	foreach ( (array) $categories as $category ) {
		if ( ( intval($hide_empty) == 0 || $category->category_count) && (!$hierarchical || $category->category_parent == $child_of) ) {
			$num_found++;
			$link = '<a href="'.get_category_link($category->cat_ID).'" ';
			if ( $use_desc_for_title == 0 || empty($category->category_description) )
				$link .= 'title="'. sprintf(__("View all posts filed under %s"), attribute_escape($category->cat_name)) . '"';
			else
				$link .= 'title="' . attribute_escape(apply_filters('category_description',$category->category_description,$category)) . '"';
			$link .= '>';
			$link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';

			if ( (! empty($feed_image)) || (! empty($feed)) ) {

				$link .= ' ';

				if ( empty($feed_image) )
					$link .= '(';

				$link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';

				if ( !empty($feed) ) {
					$title = ' title="' . $feed . '"';
					$alt = ' alt="' . $feed . '"';
					$name = $feed;
					$link .= $title;
				}

				$link .= '>';

				if ( !empty($feed_image) )
					$link .= "<img src='$feed_image' $alt$title" . ' />';
				else
					$link .= $name;

				$link .= '</a>';

				if (empty($feed_image))
					$link .= ')';
			}

			if ( intval($optioncount) == 1 )
				$link .= ' ('.intval($category->category_count).')';

			if ( $optiondates ) {
				if ( $optiondates == 1 )
					$optiondates = 'Y-m-d';
				$link .= ' ' . gmdate($optiondates, $category_timestamp["$category->cat_ID"]);
			}

			if ( $list ) {
				$thelist .= "\t<li";
				if (($category->cat_ID == $wp_query->get_queried_object_id()) && is_category()) {
					$thelist .=  ' class="current-cat"';
				}
				$thelist .= ">$link\n";
			} else {
//.........这里部分代码省略.........
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:101,代码来源:template-functions-category.php

示例12: list_cats

function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children = FALSE, $child_of = 0, $categories = 0, $recurse = 0, $feed = '', $feed_image = '', $exclude = '', $hierarchical = FALSE)
{
    global $wpdb, $category_posts;
    // Optiondates now works
    if ('' == $file) {
        $file = get_settings('home') . '/';
    }
    $exclusions = '';
    if (!empty($exclude)) {
        $excats = preg_split('/[\\s,]+/', $exclude);
        if (count($excats)) {
            foreach ($excats as $excat) {
                $exclusions .= ' AND cat_ID <> ' . intval($excat) . ' ';
            }
        }
    }
    $exclusions = apply_filters('list_cats_exclusions', $exclusions);
    if (intval($categories) == 0) {
        $sort_column = 'cat_' . $sort_column;
        $query = "\n\t\t\tSELECT cat_ID, cat_name, category_nicename, category_description, category_parent\n\t\t\tFROM {$wpdb->categories}\n\t\t\tWHERE cat_ID > 0 {$exclusions}\n\t\t\tORDER BY {$sort_column} {$sort_order}";
        $categories = $wpdb->get_results($query);
    }
    if (!count($category_posts)) {
        $now = current_time('mysql', 1);
        $cat_counts = $wpdb->get_results("\tSELECT cat_ID,\n\t\tCOUNT({$wpdb->post2cat}.post_id) AS cat_count\n\t\tFROM {$wpdb->categories}\n\t\tINNER JOIN {$wpdb->post2cat} ON (cat_ID = category_id)\n\t\tINNER JOIN {$wpdb->posts} ON (ID = post_id)\n\t\tWHERE post_status = 'publish'\n\t\tAND post_date_gmt < '{$now}' {$exclusions}\n\t\tGROUP BY category_id");
        if (!empty($cat_counts)) {
            foreach ($cat_counts as $cat_count) {
                if (1 != intval($hide_empty) || $cat_count > 0) {
                    $category_posts["{$cat_count->cat_ID}"] = $cat_count->cat_count;
                }
            }
        }
    }
    if ($optiondates) {
        $cat_dates = $wpdb->get_results("\tSELECT category_id,\n\t\tUNIX_TIMESTAMP( MAX(post_date) ) AS ts\n\t\tFROM {$wpdb->posts}, {$wpdb->post2cat}\n\t\tWHERE post_status = 'publish' AND post_id = ID {$exclusions}\n\t\tGROUP BY category_id");
        foreach ($cat_dates as $cat_date) {
            $category_timestamp["{$cat_date->category_id}"] = $cat_date->ts;
        }
    }
    $num_found = 0;
    $thelist = "";
    foreach ($categories as $category) {
        if ((intval($hide_empty) == 0 || isset($category_posts["{$category->cat_ID}"])) && (!$hierarchical || $category->category_parent == $child_of)) {
            $num_found++;
            $link = '<a href="' . get_category_link($category->cat_ID) . '" ';
            if ($use_desc_for_title == 0 || empty($category->category_description)) {
                $link .= 'title="' . sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name)) . '"';
            } else {
                $link .= 'title="' . wp_specialchars(apply_filters('category_description', $category->category_description, $category)) . '"';
            }
            $link .= '>';
            $link .= apply_filters('list_cats', $category->cat_name, $category) . '</a>';
            if (!empty($feed_image) || !empty($feed)) {
                $link .= ' ';
                if (empty($feed_image)) {
                    $link .= '(';
                }
                $link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
                if (!empty($feed)) {
                    $title = ' title="' . $feed . '"';
                    $alt = ' alt="' . $feed . '"';
                    $name = $feed;
                    $link .= $title;
                }
                $link .= '>';
                if (!empty($feed_image)) {
                    $link .= "<img src='{$feed_image}' {$alt}{$title}" . ' />';
                } else {
                    $link .= $name;
                }
                $link .= '</a>';
                if (empty($feed_image)) {
                    $link .= ')';
                }
            }
            if (intval($optioncount) == 1) {
                $link .= ' (' . intval($category_posts["{$category->cat_ID}"]) . ')';
            }
            if ($optiondates) {
                if ($optiondates == 1) {
                    $optiondates = 'Y-m-d';
                }
                $link .= ' ' . gmdate($optiondates, $category_timestamp["{$category->cat_ID}"]);
            }
            if ($list) {
                $thelist .= "\t<li>{$link}\n";
            } else {
                $thelist .= "\t{$link}<br />\n";
            }
            if ($hierarchical && $children) {
                $thelist .= list_cats($optionall, $all, $sort_column, $sort_order, $file, $list, $optiondates, $optioncount, $hide_empty, $use_desc_for_title, $hierarchical, $category->cat_ID, $categories, 1, $feed, $feed_image, $exclude, $hierarchical);
            }
            if ($list) {
                $thelist .= "</li>\n";
            }
        }
    }
    if (!$num_found && !$child_of) {
        if ($list) {
            $before = '<li>';
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:steampress-svn,代码行数:101,代码来源:template-functions-category.php

示例13: king_cat_output

/**
*@desc the output of the categoriy menu
* @param array $data - holding the switches
* @param int $number - the curretn widget number
*/
function king_cat_output($data, $number)
{
    echo '<!-- Start King Cat ' . $number . ' -->' . "\n";
    echo $data['before_widget'] . "\n";
    echo $data['before_widget_title'] . "\n";
    echo $data['title'] . "\n";
    echo $data['after_widget_title'] . "\n";
    if (function_exists('wswwpx_list_cats') && !empty($options[$number]['foldlist'])) {
        wswwpx_list_cats($data['optionall'] = 0, $data['all'] = 'All', $data['sort_column'], $data['sort_order'], $data['file'], $data['list'], $data['optiondates'], $data['optioncount'], $data['hide_empty'], $data['use_desc_for_title'], $data['children'], $data['child_of'], $data['categories'] = 0, $data['recurse'] = 0, $data['feed'], $data['feed_image'], $data['exclude'], $data['hierarchical']);
    } else {
        list_cats($data['optionall'] = 0, $data['all'] = 'All', $data['sort_column'], $data['sort_order'], $data['file'], $data['list'], $data['optiondates'], $data['optioncount'], $data['hide_empty'], $data['use_desc_for_title'], $data['children'], $data['child_of'], $data['categories'] = 0, $data['recurse'] = 0, $data['feed'], $data['feed_image'], $data['exclude'], $data['hierarchical']);
    }
    echo $data['after_widget'] . "\n";
    echo '<!-- End Cat ' . $number . ' -->' . "\n";
    return;
}
开发者ID:jbogota,项目名称:blog-king,代码行数:21,代码来源:king-categories.php

示例14: list_cats

function list_cats($parent, $lev, $color, $message)
{
    global $db_con, $mysql_table_prefix, $debug, $dba_act;
    if ($lev == 0) {
        echo "<div class='submenu cntr y3'>|&nbsp;&nbsp;&nbsp;Database {$dba_act}&nbsp;&nbsp;&nbsp;Table prefix '{$mysql_table_prefix}'&nbsp;&nbsp;&nbsp;|<br />\n        <ul>\n            <li><a href='admin.php?f=add_cat'>Add category</a></li>\n        </ul>\n        </div>\n";
        echo $message;
        echo "<div class='panel'>\n    <table width='100%'>\n    <tr>\n        <td class='tblhead' colspan='3'>Categories</td>\n    </tr>\n    ";
    }
    $space = "";
    for ($x = 0; $x < $lev; $x++) {
        $space .= "<span class='tree'>&raquo;</span>&nbsp;";
    }
    $sql_query = "SELECT * FROM " . $mysql_table_prefix . "categories WHERE parent_num={$parent} ORDER BY category";
    $result = $db_con->query($sql_query);
    if ($debug && $db_con->errno) {
        $err_row = __LINE__ - 2;
        printf("<p><span class='red'>&nbsp;MySQL failure: %s&nbsp;\n<br /></span></p>", $db_con->error);
        if (__FUNCTION__) {
            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;&nbsp;in function():&nbsp;" . __FUNCTION__ . "&nbsp;<br /></span></p>");
        } else {
            printf("<p><span class='red'>&nbsp;Found in script: " . __FILE__ . "&nbsp;&nbsp;row: {$err_row}&nbsp;<br /></span></p>");
        }
        printf("<p><span class='red'>&nbsp;Script execution aborted.&nbsp;<br /></span>");
        printf("<p><strong>Invalid query string, which caused the SQL error:</strong></p>");
        echo "<p> {$sql_query} </p>";
        exit;
    }
    if ($result->num_rows) {
        while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
            if ($color == "odrow") {
                $color = "evrow";
            } else {
                $color = "odrow";
            }
            $id = $row['category_id'];
            $cat = $row['category'];
            echo "<tr class='{$color}'>\n        ";
            if (!$space == "") {
                echo "<td width='90%'>\n        <div>{$space}<a class='options' href='admin.php?f=edit_cat&amp;cat_id={$id}'\n            title='Edit this Sub-Category'>" . stripslashes($cat) . "</a></div></td>\n        <td class='options'><a href='admin.php?f=edit_cat&amp;cat_id={$id}' class='options' title='Edit this Sub-Category'>Edit</a></td>\n        <td class='options'><a href='admin.php?f=11&amp;cat_id={$id}' title='Delete this Sub-Category'\n            onclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" class='options'>Delete</a></td>\n    </tr>\n    ";
            } else {
                echo "<td width='90%'><a class='options' href='admin.php?f=edit_cat&amp;cat_id={$id}'\n            title='Edit this Category'>" . stripslashes($cat) . "</a></td>\n        <td class='options'><a href='admin.php?f=edit_cat&amp;cat_id={$id}' class='options' title='Edit this Category'>Edit</a></td>\n        <td class='options'><a href='admin.php?f=11&amp;cat_id={$id}' title='Delete this Category'\n            onclick=\"return confirm('Are you sure you want to delete? Subcategories will be lost.')\" class='options'>Delete</a></td>\n    </tr>\n";
            }
            $color = list_cats($id, $lev + 1, $color, "");
        }
    }
    if ($lev == 0) {
        echo "</table>\n</div>\n";
    }
    return $color;
}
开发者ID:hackersforcharity,项目名称:rachelpiOS,代码行数:50,代码来源:commonfuncs.php

示例15: the_terms2posts

<div id="ContextualContent">
		
			<?php 
if (is_single() && function_exists('the_terms2posts')) {
    ?>
			<h4>Related Entries</h4>
			<ul class="ContextualList">
				<?php 
    the_terms2posts();
    ?>
			</ul>
			<?php 
}
?>
			
			<h4>Categories</h4>
		    <ul class="ContextualList">
		      <?php 
list_cats(0, '', 'name', 'asc', '', 1, 0, 0, 1, 1, 1, 0, '', '', '', '', '');
?>
		   	</ul>
			<h4>Archives</h4>
			<ul class="ContextualList">
				<?php 
wp_get_archives('type=monthly');
?>
			</ul>
		</div>
开发者ID:jennyHsiao,项目名称:projects.chrislkeller.com,代码行数:28,代码来源:context.php


注:本文中的list_cats函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。