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


PHP has_children函数代码示例

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


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

示例1: buildNestedList

function buildNestedList($arrMenu, $parent = 0)
{
    print "<ol class='dd-list'>";
    foreach ($arrMenu as $x => $val) {
        if ($val["menu_parent_id"] == $parent) {
            print " <li class='dd-item' data-id='" . $val["menu_id"] . "'>";
            print "<div class='dd-handle'>" . $val["menu_text"] . "</div>";
            if (has_children($arrMenu, $val["menu_id"]) == TRUE) {
                buildNestedList($arrMenu, $val["menu_parent_id"]);
            }
            print "</li>";
        }
    }
    print "</ul>";
}
开发者ID:TrinataBhayanaka,项目名称:damkar,代码行数:15,代码来源:index_1.php

示例2: build_menu

function build_menu($rows, $parent = 0)
{
    $result = "<ul>";
    foreach ($rows as $row) {
        if ($row['parent_id'] == $parent) {
            $result .= "<li>{$row['title']}";
            if (has_children($rows, $row['id'])) {
                $result .= build_menu($rows, $row['id']);
            }
            $result .= "</li>";
        }
    }
    $result .= "</ul>";
    return $result;
}
开发者ID:rodurma,项目名称:PHP-Functions,代码行数:15,代码来源:build_menu.php

示例3: get_header

<?php

get_header();
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
        <article class="post page">
            <?php 
        if (has_children() || $post->post_parent > 0) {
            ?>
            <nav class="site-nav children-links clearfix">
                <span class="parent-link">
                    <a href="<?php 
            get_the_permalink(get_top_ancestor_id());
            ?>
"><?php 
            echo get_the_title(get_top_ancestor_id());
            ?>
</a>
                </span>
                <ul>
                    <?php 
            $args = array('child_of' => get_top_ancestor_id(), 'title_li' => '');
            ?>
                    <?php 
            wp_list_pages($args);
            ?>
                </ul>
            </nav>
            <?php 
开发者ID:quyetdc,项目名称:ceramic,代码行数:31,代码来源:page.php

示例4: basename

// easy CSS style linking
$url = $baseurl . basename(__FILE__);
$this_url = new moodle_url($url);
$index_url = new moodle_url($baseurl . "index.php");
$submit_url = new moodle_url($baseurl . basename(__FILE__));
$page_title = get_string("pluginname", $plugin);
$page_heading = get_string("pluginadministration", $plugin);
$view_button = get_string("viewbutton", $plugin);
// get group info
$group = $DB->get_record('ketlicense', array('id' => $groupid));
$group_heading = $group->cohortname;
// get children of group and subchildren
$children = get_children($groupid);
$where_items = "( ";
$query_arr = array();
if (has_children($group->id)) {
    // build where statements
    foreach ($children as $child => $value) {
        $where_items .= 'member.license = ? OR ';
        // put values into array
        $query_arr[] = $value;
    }
    $where_items = substr($where_items, 0, strlen($where_items) - 3);
    $where_items .= ") ";
} else {
    $where_items = 'member.license = ? ';
    $query_arr[] = $groupid;
}
// make additional where parameters
// build start date
if ($start_date) {
开发者ID:bcvincent,项目名称:ae_reports,代码行数:31,代码来源:teacher.php

示例5: wp_reset_postdata

                }
                ?>
							<?php 
            }
            wp_reset_postdata();
            ?>
							<?php 
            if ($show_sub_chapters) {
                ?>
								<ul class="sub-chapter">
								<?php 
                while ($sub_chapters->have_posts()) {
                    $sub_chapters->the_post();
                    ?>
									<?php 
                    if (has_children($post)) {
                        ?>
									<?php 
                        $is_active = $active_post->ID == $sub_chapters->post->ID || $active_post->post_parent == $sub_chapters->post->ID;
                        ?>
									<li <?php 
                        if ($is_active) {
                            echo "class='active'";
                        }
                        ?>
>
										<a href="<?php 
                        the_permalink();
                        ?>
">
											<?php 
开发者ID:roblarsen,项目名称:jquery-wp-content,代码行数:31,代码来源:sidebar.php

示例6: get_children

/**
 * Grabs all children of id
 *
 * returns array contains children id #s
**/
function get_children($id)
{
    global $DB;
    $sql = "SELECT * FROM {ketlicense} WHERE parent = ?";
    $childs = $DB->get_records_sql($sql, array($id));
    $output_array = array();
    if (sizeof($childs) > 0) {
        foreach ($childs as $row) {
            if (has_children($row->id)) {
                $subchildren = get_children($row->id);
                foreach ($subchildren as $subrow => $subval) {
                    $output_array[] = $subval;
                }
            } else {
                $output_array[] = $row->id;
            }
        }
        return $output_array;
    } else {
        return false;
    }
}
开发者ID:ket-ed,项目名称:ae_reports,代码行数:27,代码来源:lib.php

示例7: get_post

</h1>
					</div>
		    	</div>
			</div>
		</div>
		
	<?php 
    }
    // if is page and is a sub-page, show the parent and siblings in a menu
    if (is_page()) {
        // WP variables
        $current = $post->ID;
        $parent = $post->post_parent;
        $grandparent_get = get_post($parent);
        $grandchild = $grandparent_get->post_parent;
        $has_children = has_children($post->ID);
        // ACF variables
        $sub_menu = get_field('show_top_sub_menu', $post->ID);
        if ($sub_menu == 'true_sub_menu') {
            if ($parent) {
                if (!$grandchild && $parent) {
                    $child_of_value = $post->post_parent ? $post->post_parent : $post->ID;
                    // Depth of 2 if parent page, else depth of 1
                    $depth_value = $post->post_parent ? 2 : 1;
                    $walker = new Short_Name_Walker();
                    $wp_list_pages = wp_list_pages(array('child_of' => $post->post_parent, 'depth' => 1, 'title_li' => '', 'walker' => $walker, 'echo' => 0));
                    // Remove last |
                    //$wp_list_pages = preg_replace('/\|[^|]*$/', '', $wp_list_pages);
                    //echo '2';
                } elseif ($grandchild) {
                    $child_of_value = $post->post_parent ? $post->post_parent : $post->ID;
开发者ID:Ashkas,项目名称:CAT,代码行数:31,代码来源:page-header.php

示例8: switch

<?php

global $post;
switch (true) {
    case is_page('work'):
        // Redirect to first child page.
        $pagekids = get_pages("child_of=" . $post->ID . "&sort_column=menu_order");
        $firstchild = $pagekids[0];
        if ($firstchild) {
            wp_redirect(get_permalink($firstchild->ID), 301);
            exit;
        } else {
            get_template_part('index');
        }
        break;
    case has_children($post->ID):
        // If has child pages
        get_template_part('template-work-grid');
        break;
    case is_tree(5):
        // Is in the "About" tree.
        get_template_part('template-work-grid');
        break;
    case !empty($post->_custom_video_url):
        // Page has a video URL metabox value saved, so use the work detail template.
        get_template_part('template-work-detail');
        break;
    default:
        get_template_part('index');
        break;
}
开发者ID:jrobson153,项目名称:style-guide,代码行数:31,代码来源:page.php

示例9: build_comment

function build_comment($arrData, $parent = 0, $depth = 1)
{
    ?>
    	 <?php 
    if ($depth > 1) {
        ?>
            	<ul class="children">
            <?php 
    }
    ?>
	
           
		<?php 
    foreach ($arrData as $x => $val) {
        ?>
        	<?php 
        if ($val['parent_id'] == $parent) {
            ?>
            <?php 
            $even = $x % 2 == 0 ? "even" : "odd";
            ?>
            	<li class="comment even thread-<?php 
            echo $even;
            ?>
 depth-<?php 
            echo $depth;
            ?>
">
				<div class="comment-header">
                	<div class="comment-author vcard">
                    	<i class="icon-user"></i>&nbsp; <cite class="fn" style="text-transform:uppercase"><?php 
            echo $val["name"];
            ?>
 </cite> <span class="says">says:</span>
                    	<div class="help-block">
                    	<?php 
            echo date("d M Y (H:i)", strtotime($val["created"]));
            ?>
                    </div>
                    </div>
                    
                </div>
                <div class="comment-content" style="padding:0 10px">
				<p><?php 
            echo $val["body"];
            ?>
</p>
                </div>
                <div class="reply" style="padding:0 10px">
                	<?php 
            echo "<a href='#' class='comments_reply' data-idx='" . $val["idx"] . "' data-parent='" . $parent . "' rel='wg/comments/comments_reply/" . $val["idx"] . "'>Reply</a>";
            ?>
	
                </div>
                <?php 
            if (has_children($arrData, $val["idx"])) {
                ?>
               		<?php 
                build_comment($arrData, $val["idx"], $depth + 1);
                ?>
                <?php 
            }
            ?>
              
            </li>
            <?php 
        }
        ?>
		<?php 
    }
    ?>
          <?php 
    if ($depth > 1) {
        ?>
            		</ul>
            	<?php 
    }
    ?>
	
	<?php 
}
开发者ID:TrinataBhayanaka,项目名称:damkar,代码行数:81,代码来源:list2.php

示例10: buildNestedList

function buildNestedList($arrMenu, $parent = 0)
{
    print "<ol class='dd-list'>";
    foreach ($arrMenu as $x => $val) {
        if ($val["menu_parent_id"] == $parent) {
            //rendering data
            $data_tmp = array();
            foreach ($val as $key => $value) {
                $data_tmp[] = "data-" . $key . "='" . $value . "'";
            }
            if (cek_array($data_tmp)) {
                $data_str = join(" ", $data_tmp);
            }
            $div_str = $val["menu_text"];
            $div_str = '<table class="dd_table">
                    	<tr><td>' . $val["menu_text"] . '</td><td class="dd-menu-url">' . $val["menu_url"] . '</td><td class="dd-menu-class"><i class=' . $val["menu_icon"] . '></i></td>
				';
            $div_str .= "<td class='dd-menu-action tc'>\n\t\t\t\t\t<a href='#' class='menu_edit blue'>\n\t\t\t\t\t<i class='icon-pencil bigger-130'></i>\n\t\t\t\t\t</a>\n\t\t\t\t\t<a href='#' class='menu_delete red'>\n\t\t\t\t\t\t<i class='icon-trash bigger-130'></i>\n\t\t\t\t\t</a>\n\t\t\t\t\t</td>";
            $div_str .= '</tr></table>';
            /*
            $div_str="<div class='menu-text pull-left'>".
            				$val["menu_text"]
            		  ."</div";
            $div_str.="<div class='menu-url pull-right'>".
            				$val["menu_url"]
            		  ."</div";
            */
            print " <li class='dd-item' data-id='" . $val["menu_id"] . "' {$data_str}>";
            print "<div class='dd-handle'>\n\t\t\t\t\t{$div_str}\n\t\t\t\t\t</div>";
            if (has_children($arrMenu, $val["menu_id"]) == TRUE) {
                buildNestedList($arrMenu, $val["menu_id"]);
            }
            print "</li>";
        }
    }
    print "</ol>";
}
开发者ID:TrinataBhayanaka,项目名称:damkar,代码行数:37,代码来源:index.php

示例11: while

 // Check to see if coloured content blocks are set. If they are, then we want an extra space above the page children blocks
 if (have_rows('content_blocks')) {
     while (have_rows('content_blocks')) {
         the_row();
         // Find out if the coloured rows have been set. If they have then set a
         if (get_row_layout() == 'step_block' || get_row_layout() == 'video_block') {
             $big_margin_top = 'big_margin_top';
         }
     }
 }
 //Work out what level page this is
 $parent = $post->post_parent;
 if ($parent) {
     $grandparent_get = get_post($parent);
     $has_grandparent = $grandparent_get->post_parent;
     if (has_children()) {
         $middle = true;
     }
 }
 if ($has_grandparent) {
     $post_id = $parent;
 } elseif (!($has_grandparent || $middle) && $parent) {
     $post_id = $parent;
 } elseif ($middle == true) {
     $post_id = $post->ID;
 } else {
     $post_id = $post->ID;
 }
 $args = array('child_of' => $post_id, 'sort_column' => 'menu_order', 'post_type' => 'page', 'post_status' => 'publish');
 $query = null;
 $key = 'child-pages-' . $post_id;
开发者ID:Ashkas,项目名称:CAT,代码行数:31,代码来源:base-page.php

示例12: displayCategories

/**
 * Actually print the categories
 *
 * @param The $categories array $categories
 */
function displayCategories($categories)
{
    $attributed = array();
    $string = '';
    ?>
    <div class="menudiv">
<?php 
    foreach ($categories as $id => $detail) {
        $level = 0;
        if (!in_array($id, $attributed)) {
            $string = $detail['name'];
            ULLI($detail['path'], $string, $level, $parent = $id);
            $attributed = has_children($id, $categories, $attributed);
        }
        if (!in_array($id, $attributed)) {
            CloseULLI($level);
        }
    }
    ?>
    </div>
<?php 
}
开发者ID:digideskio,项目名称:oscmax2,代码行数:27,代码来源:fwr_cat_functions.php

示例13: get_json_data

function get_json_data($service, $object = NULL, $params = '', $repo = NULL)
{
    $service_url = $GLOBALS[$service . '_api_url'];
    $service_id = $GLOBALS[$service . '_id'];
    $cache_file = $GLOBALS[$service . '_cache_file'];
    global $cache_dir;
    // Attempt to make the cache directory if it doesn't already exist
    if (!file_exists($cache_dir)) {
        mkdir($cache_dir);
    }
    // Local 'tmp' cache file on the webserver, preferably out of public reach, i.e.
    // htdocs/tmp/.json_github_lmms_releases.
    $tmp_suffix = ($repo ? $repo : $service_id) . ($object ? '_' . $object : '');
    $tmp_suffix = str_replace('/', '', str_replace('.', '', str_replace('__', '_', $tmp_suffix)));
    // For "resolve" requests, hash the track URL for cache filename
    if ($service == 'soundcloud' && $params && strpos($params, '://') !== false) {
        $tmp_suffix = md5($params) . $tmp_suffix;
    }
    $tmp_cache = $cache_dir . $cache_file . $tmp_suffix;
    // If the repository isn't specified, assume it's the same as the project name and build accordingly
    // i.e. "https://api.github.com/repos/lmms/lmms/releases?param=value"
    // i.e. "https://www.googleapis.com/plus/v1/people/113001340835122723950/activities/public?maxResults=25
    switch ($service) {
        case 'youtube':
            $full_api = $service_url . ($object ? $object : 'playlists') . '?channelId=' . ($repo ? $repo : $service_id) . $params;
            break;
        case 'soundcloud':
            $full_api = $service_url . ($repo ? $repo : $service_id) . '/' . ($object ? $object : 'tracks') . '.json' . $params;
            break;
        case 'facebook':
            $full_api = $service_url . '?id=' . ($repo ? $repo : $service_id) . '&format=json' . $params;
            break;
        case 'google':
            $full_api = $service_url . ($repo ? $repo : $service_id) . '/' . $object . '/public/' . $params;
            break;
        case 'github':
        default:
            $full_api = $service_url . ($repo ? $repo : $service_id) . '/' . $service_id . '/' . $object . $params;
    }
    $using_url = false;
    if (cache_expired($tmp_cache)) {
        $json = file_get_contents_curl(realurl($full_api), $service);
        $using_url = true;
    } else {
        $json = file_get_contents($tmp_cache);
    }
    $obj = json_decode($json);
    /*
     * If there's valid JSON data, AND it came from the web cache it
     * If not, fall back to the previous cache
     */
    if (has_children($obj, $service)) {
        if ($using_url) {
            @file_put_contents($tmp_cache, $json, LOCK_EX);
        }
        return $obj;
    } else {
        $json = @file_get_contents($tmp_cache);
        return json_decode($json);
    }
}
开发者ID:kmklr72,项目名称:lmms.io,代码行数:61,代码来源:json_common.php

示例14: get_header

<?php

get_header();
if (have_posts()) {
    while (have_posts()) {
        the_post();
        ?>
	
		<article class="post page">
		<?php 
        has_children() or $post->post_parent > 0;
        ?>
		<nav class="site-nav children-links clearfix">
		<span class="parent_link"><a href="<?php 
        get_the_permalink(get_top_id());
        ?>
"><?php 
        echo get_the_title(get_top_id());
        ?>
</a></span>
		<ul>
			<?php 
        $args = array('child_of' => get_top_id(), 'title_li' => '');
        ?>
			<?php 
        wp_list_pages($args);
        ?>
			</ul>
		</nav>
			<h2><?php 
        the_title();
开发者ID:hitkariniwebdev,项目名称:Newtheme,代码行数:31,代码来源:page.php


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