本文整理汇总了PHP中renderNav函数的典型用法代码示例。如果您正苦于以下问题:PHP renderNav函数的具体用法?PHP renderNav怎么用?PHP renderNav使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了renderNav函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderNav
function renderNav($items)
{
foreach ($items as $item) {
if (val('type', $item) == 'group') {
$heading = val('text', $item);
if (!$heading) {
$item['cssClass'] .= ' nav-group-noheading';
}
?>
<div type="group" class="nav-group <?php
echo val('cssClass', $item);
?>
">
<?php
if ($heading) {
echo '<h3>' . val('text', $item) . '</h3>';
}
if (val('items', $item)) {
renderNav(val('items', $item));
}
echo '</div>';
}
if (val('type', $item) == 'link') {
?>
<a role="menuitem" class="nav-link <?php
echo val('cssClass', $item);
?>
" tabindex="-1"
href="<?php
echo url(val('url', $item));
?>
">
<?php
if (val('badge', $item)) {
echo '<span class="Aside"><span class="Count">' . val('badge', $item) . '</span></span>';
}
?>
<?php
if (val('icon', $item)) {
echo icon(val('icon', $item));
}
?>
<?php
echo '<span class="text">' . val('text', $item) . '</span>';
?>
</a>
<?php
}
if (val('type', $item) == 'dropdown') {
echo val('dropdownmenu', $item);
}
if (val('type', $item) == 'divider') {
echo '<hr/>';
}
}
}
示例2: renderNav
function renderNav($links)
{
global $file;
$html = '';
foreach ($links as $link) {
$title = $link['title'];
if ($link['file'] == $file) {
$title = '<strong>' . $title . '</strong>';
}
$html .= '<li><a href="' . basename(__FILE__) . '?file=' . $link['file'] . '">' . $title . '</a>';
if (isset($link['children']) === true && count($link['children']) > 0) {
$html .= '<ul>' . renderNav($link['children']) . '</ul>';
}
$html .= '</li>';
}
return $html;
}
示例3: renderNav
/**
* Given a group of pages, render a <ul> navigation
*
* This is here to demonstrate an example of a shared function and usage is completely optional.
*
* @param array|PageArray $items
* @param int $maxDepth How many levels of navigation below current should it go?
* @param string $fieldNames Any extra field names to display (separate multiple fields with a space)
* @param string $class CSS class name for containing <ul>
* @return string
*
*/
function renderNav($items, $maxDepth = 0, $fieldNames = '', $class = 'nav')
{
// if we were given a single Page rather than a group of them, we'll pretend they
// gave us a group of them (a group/array of 1)
if ($items instanceof Page) {
$items = array($items);
}
// $out is where we store the markup we are creating in this function
$out = '';
// cycle through all the items
foreach ($items as $item) {
// markup for the list item...
// if current item is the same as the page being viewed, add a "current" class to it
$out .= $item->id == wire('page')->id ? "<li class='current'><i class='fa fa-angle-double-right'></i> " : "<li><i class='fa fa-angle-right'></i> ";
// markup for the link
$out .= "<a href='{$item->url}'>{$item->title}</a>";
// if there are extra field names specified, render markup for each one in a <div>
// having a class name the same as the field name
if ($fieldNames) {
foreach (explode(' ', $fieldNames) as $fieldName) {
$value = $item->get($fieldName);
if ($value) {
$out .= " <div class='{$fieldName}'>{$value}</div>";
}
}
}
// if the item has children and we're allowed to output tree navigation (maxDepth)
// then call this same function again for the item's children
if ($item->hasChildren() && $maxDepth) {
if ($class == 'nav') {
$class = 'nav nav-tree';
}
$out .= renderNav($item->children, $maxDepth - 1, $fieldNames, $class);
}
// close the list item
$out .= "</li>";
}
// if output was generated above, wrap it in a <ul>
if ($out) {
$out = "<ul class='{$class}'>{$out}</ul>";
}
// return the markup we generated above
return $out;
}
示例4: renderPosts
<?php
/**
* Home template
*
*/
include_once "./blog.inc";
$categories = $pages->get('/categories/');
$content = $page->body . renderPosts("limit={$page->quantity}");
$subnav = renderNav($categories->title, $categories->children);
include "./main.inc";
示例5: Wire404Exception
<?php
/**
* Category template
*
*/
include_once "./blog.inc";
$posts = $pages->find("template=post, categories={$page}, limit=10");
if ($input->urlSegment1) {
// rss feed
if ($input->urlSegment1 != 'rss') {
throw new Wire404Exception();
}
renderRSS($posts);
return;
}
$n = $posts->getTotal();
$headline = $page->title;
$content = $page->body . renderPosts($posts, true);
$subnav = renderNav($page->parent->title, $page->siblings, $page);
include "./main.inc";
示例6: renderNav
/**
* Given a group of pages, render a <ul> navigation
*
* @param array|PageArray $items
* @param int $depth How many levels of navigation below current should it go?
* @param string $fieldNames Any extra field names to display (separate multiple fields with a space)
* @return string
*
*/
function renderNav($items, $maxDepth = 0, $fieldNames = '')
{
// if we were given a single Page rather than a group of them, we'll pretend they
// gave us a group of them (a group/array of 1)
if ($items instanceof Page) {
$items = array($items);
}
$out = '';
foreach ($items as $item) {
// if current item is the same as the page being viewed, add a "current" class to it
$out .= $item->id == wire('page')->id ? "<li class='current'>" : "<li>";
$out .= "<a href='{$item->url}'>{$item->title}</a>";
// if there are extra field names specified, render markup for each one in a <div>
// having a class name the same as the field name
if ($fieldNames) {
foreach (explode(' ', $fieldNames) as $fieldName) {
$value = $item->get($fieldName);
if ($value) {
$out .= " <div class='{$fieldName}'>{$value}</div>";
}
}
}
// if the item has children and we're allowed to output tree navigation (maxDepth)
// then call this same function again for the item's children
if ($item->hasChildren() && $maxDepth) {
$out .= renderNav($item->children, $maxDepth - 1, $fieldNames);
}
$out .= "</li>";
}
if ($out) {
$out = "<ul>{$out}</ul>";
}
return $out;
}
示例7: redirect
include INFUSIONS . "fusionboard4/includes/func.php";
if (file_exists(INFUSIONS . "fusionboard4/locale/" . $settings['locale'] . ".php")) {
include INFUSIONS . "fusionboard4/locale/" . $settings['locale'] . ".php";
} else {
include INFUSIONS . "fusionboard4/locale/English.php";
}
if (!iMEMBER) {
redirect(FORUM);
}
define("USER_CP", TRUE);
/* User CP Navigation Styling */
echo "<style type='text/css'>\n.navtitle { font-size:13px;font-weight:bold; padding:5px; }\n.navsection { font-weight:bold; }\n.bold { font-weight:bold; }\n.fields { text-align:left; width:440px; border: 1px; border-style:solid; border-color:#ccc; padding:8px; margin:5px; }\n.users { padding:6px; border:1px solid #ccc; width:230px; height:70px; }\n</style>\n";
$_GET['section'] = isset($_GET['section']) ? stripinput($_GET['section']) : "intro";
$section = isset($_GET['section']) ? stripinput($_GET['section']) : "intro";
opentable($locale['fb922']);
renderNav(false, false, array(INFUSIONS . "fusionboard4/usercp.php", $locale['fb922']));
add_to_title(" :: " . $locale['fb922']);
if (isset($_COOKIE["fusion_box_usercp"])) {
if ($_COOKIE["fusion_box_usercp"] == "none") {
$state = "off";
} else {
$state = "on";
}
} else {
$state = "on";
}
echo "<img src='" . get_image("panel_" . ($state == "on" ? "off" : "on")) . "' id='b_usercp' class='panelbutton' alt='' onclick=\"javascript:flipBox('usercp')\" />";
echo "<table width='100%' cellspacing='0' cellpadding='5' border='0'>\n";
echo "<tr>\n<td style='width:200px;vertical-align:top;" . ($state == "off" ? "display:none" : "") . "'id='box_usercp'>\n";
/* User CP Navigation Start */
echo "<table width='100%' cellspacing='1' cellpadding='0' class='tbl-border'>\n";
示例8: str_replace
$sidebar = str_replace("[no-sidebar]", "", $sidebar);
} else {
$sidebar = "<p>[account]</p><p>[controls]</p><p>[nav]</p>" . $page->sidebar;
}
$precontent = null;
// We refer to our homepage a few times in our site, so we preload a copy
// here in a $homepage variable for convenience.
$homepage = $pages->get('/');
// Include shared functions (if any)
include_once "./_func.php";
if (strpos($sidebar, "[controls]") !== false) {
$sidebar = str_replace("[controls]", renderModulesControls(), $sidebar);
}
if (strpos($sidebar, "[account]") !== false) {
$sidebar = str_replace("[account]", renderAccount(), $sidebar);
}
if (strpos($sidebar, "[nav]") !== false) {
// if the rootParent (section) page has more than 1 child, then render
// section navigation in the sidebar
if ($page->rootParent->hasChildren > 0 && $page->parent->id) {
$sidebar = str_replace("[nav]", renderNav($page->rootParent, 3), $sidebar);
} else {
$sidebar = str_replace("[nav]", "", $sidebar);
}
}
// What happens after this?
// ------------------------
// 1. ProcessWire loads your page's template file (i.e. basic-page.php).
// 2. ProcessWire loads the _main.php file
//
// See the README.txt file for more information.
示例9: sprintf
// values that you plan to bundle in a selector string like we are doing here.
$q = $sanitizer->selectorValue($q);
// Search the title and body fields for our query text.
// Limit the results to 50 pages.
$selector = "title|body~={$q}, limit=50";
// If user has access to admin pages, lets exclude them from the search results.
// Note that 2 is the ID of the admin page, so this excludes all results that have
// that page as one of the parents/ancestors. This isn't necessary if the user
// doesn't have access to view admin pages. So it's not technically necessary to
// have this here, but we thought it might be a good way to introduce has_parent.
if ($user->isLoggedin()) {
$selector .= ", has_parent!=2";
}
// Find pages that match the selector
$matches = $pages->find($selector);
$cnt = $matches->count;
// did we find any matches?
if ($cnt) {
// yes we did: output a headline indicating how many were found.
// note how we handle singular vs. plural for multi-language, with the _n() function
$content = "<h2>" . sprintf(_n('Found %d page', 'Found %d pages', $cnt), $cnt) . "</h2>";
// we'll use our renderNav function (in _func.php) to render the navigation
$content .= renderNav($matches, 0, 'summary');
} else {
// we didn't find any
$content = "<h2>" . __('Sorry, no results were found.') . "</h2>";
}
} else {
// no search terms provided
$content = "<h2>" . __('Please enter a search term in the search box (upper right corner)') . "</h2>";
}
示例10: renderNav
<?php
// basic-page.php template file
// Primary content is the page's body copy
$content = $page->body;
// If the page has children, then render navigation to them under the body.
// See the _func.php for the renderNav example function.
if ($page->hasChildren) {
$content .= renderNav($page->children, 0, 'summary');
}
// if the rootParent (section) page has more than 1 child, then render
// section navigation in the sidebar
if ($page->rootParent->hasChildren > 1) {
$sidebar = renderNav($page->rootParent, 3) . $page->sidebar;
}
示例11: redirect
*/
if (!defined("USER_CP")) {
require_once "../../maincore.php";
require_once THEMES . "templates/header.php";
include LOCALE . LOCALESET . "forum/main.php";
include INFUSIONS . "fusionboard4/includes/func.php";
if (file_exists(INFUSIONS . "fusionboard4/locale/" . $settings['locale'] . ".php")) {
include INFUSIONS . "fusionboard4/locale/" . $settings['locale'] . ".php";
} else {
include INFUSIONS . "fusionboard4/locale/English.php";
}
if (!$fb4['group_enable']) {
redirect(FORUM . "index.php");
}
opentable($locale['uc250']);
renderNav(false, false, array(INFUSIONS . "fusionboard4/groups.php", $locale['uc250']));
add_to_title(" :: " . $locale['uc250']);
echo "<table width='100%' cellspacing='1' cellpadding='0' border='0' class='tbl-border'>\n";
}
echo "<style type='text/css'>\n.grouptext { font-size:14px;font-family:Tahoma;width:300px;margin-top:3px;margin-left:7px; }\n</style>\n";
if (isset($_GET['action']) && $_GET['action'] == "create" && checkgroup($fb4['group_create'])) {
if (isset($_POST['addGroup'])) {
$group_name = isset($_POST['group_name']) ? addslash(stripinput($_POST['group_name'])) : "";
$group_desc = isset($_POST['group_desc']) ? addslash(stripinput($_POST['group_desc'])) : "";
$group_type = isset($_POST['group_type']) && isNum($_POST['group_type']) ? $_POST['group_type'] : 1;
$group_wall = isset($_POST['group_wall']) && isNum($_POST['group_wall']) ? $_POST['group_wall'] : 0;
$group_visibility = isset($_POST['group_visibility']) && isNum($_POST['group_visibility']) ? $_POST['group_visibility'] : 0;
$group_moderate = isset($_POST['group_moderate']) && isNum($_POST['group_moderate']) ? $_POST['group_moderate'] : 0;
$result = dbquery("insert into " . DB_USER_GROUPS . " (group_name, group_description) VALUES('{$group_name}', '{$group_desc}')");
$group_id = mysql_insert_id();
$result = dbquery("insert into " . DB_PREFIX . "fb_groups (group_id, group_leader, group_officers, group_access, group_visibility, group_wall, group_description, group_recentnews, group_created, group_image, group_moderate) VALUES('{$group_id}', '" . $userdata['user_id'] . "', '', '{$group_type}', '{$group_visibility}', '{$group_wall}', '{$group_desc}', '', '" . time() . "', '', '{$group_moderate}')");
示例12: renderCategories
<?php
/**
* Categories (list) template
*
*/
/**
* Render a list of categories, optionally showing a few posts from each
*
* @param PageArray $categories
* @param int Number of posts to show from each category (default=0)
* @return string
*
*/
function renderCategories(PageArray $categories, $showNumPosts = 0)
{
foreach ($categories as $category) {
$category->posts = wire('pages')->find("template=post, categories={$category}, limit={$showNumPosts}, sort=-date");
}
$t = new TemplateFile(wire('config')->paths->templates . 'markup/categories.php');
$t->set('categories', $categories);
return $t->render();
}
/*********************************************/
include_once "./blog.inc";
$limit = 3;
// number of posts to show per category
$headline = $page->title;
$content = $page->body . renderCategories($page->children, $limit);
$subnav = renderNav($page->title, $page->children, $page);
include "./main.inc";
示例13: renderNav
<?php
// home.php (homepage) template file.
// See README.txt for more information
// Primary content is the page body copy and navigation to children.
// See the _func.php file for the renderNav() function example
$content = $page->body . renderNav($page->children);
// if there are images, lets choose one to output in the sidebar
if (count($page->images)) {
// if the page has images on it, grab one of them randomly...
$image = $page->images->getRandom();
// resize it to 400 pixels wide
$image = $image->width(400);
// output the image at the top of the sidebar...
$sidebar = "<img src='{$image->url}' alt='{$image->description}' />";
// ...and append sidebar text under the image
$sidebar .= $page->sidebar;
} else {
// no images...
// append sidebar text if the page has it
$sidebar = $page->sidebar;
}
示例14: time
include INFUSIONS . "fusionboard4/locale/English.php";
}
if (!isset($lastvisited) || !isnum($lastvisited)) {
$lastvisited = time();
}
$data = dbarray(dbquery("SELECT tt.thread_lastpost\n\tFROM " . DB_FORUMS . " tf\n\tINNER JOIN " . DB_THREADS . " tt ON tf.forum_id = tt.forum_id\n\tWHERE " . groupaccess('tf.forum_access') . "\n\tORDER BY tt.thread_lastpost DESC LIMIT " . ($settings['numofthreads'] - 1) . ", " . $settings['numofthreads']));
if (!isset($_GET['rowstart']) || !isnum($_GET['rowstart'])) {
$_GET['rowstart'] = 0;
}
$today = getdate(time() + $settings['timeoffset'] * 3600);
$dayBeginning = time() - ($today['hours'] * 3600 + $today['minutes'] * 60 + $today['seconds']);
$result = dbquery("SELECT tu2.user_id as original_id, tu2.user_name as original_name, tt.thread_id, tt.thread_subject, tt.thread_views, tt.thread_lastuser, tt.thread_lastpost,\n\ttt.thread_poll, tf.forum_id, tf.forum_name, tf.forum_access, tt.thread_lastpostid, tt.thread_postcount, tu.user_id, tu.user_name\n\tFROM " . DB_THREADS . " tt\n\tINNER JOIN " . DB_FORUMS . " tf ON tt.forum_id=tf.forum_id\n\tINNER JOIN " . DB_USERS . " tu ON tt.thread_lastuser=tu.user_id\n\tINNER JOIN " . DB_USERS . " tu2 ON tt.thread_author=tu2.user_id\n\tWHERE " . groupaccess('tf.forum_access') . " and tt.thread_lastpost > {$dayBeginning} \n\tORDER BY tt.thread_lastpost DESC LIMIT " . $_GET['rowstart'] . ",15");
$rows = dbrows($result);
opentable($locale['fb920']);
add_to_title(" :: " . $locale['fb920']);
renderNav(false, false, array(INFUSIONS . "fusionboard4/today.php", $locale['fb920']));
if ($rows) {
$i = 0;
echo "<table cellpadding='0' cellspacing='1' width='100%' class='tbl-border'>\n<tr>\n";
echo "<td class='tbl2' width='1%'> </td>\n";
echo "<td width='40%' class='tbl2'><strong>" . $locale['global_044'] . "</strong></td>\n";
echo "<td width='20%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>" . $locale['global_047'] . "</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>" . $locale['global_045'] . "</strong></td>\n";
echo "<td width='1%' class='tbl2' style='text-align:center;white-space:nowrap'><strong>" . $locale['global_046'] . "</strong></td>\n";
echo "</tr>\n";
while ($data = dbarray($result)) {
$row_color = $i % 2 == 0 ? "tbl1" : "tbl2";
echo "<tr>\n<td class='" . $row_color . "' style='white-space:nowrap'>";
if ($fb4['forum_icons']) {
$iconQuery = dbquery("select * from " . $db_prefix . "fb_forums where forum_id='" . $data['forum_id'] . "'");
if (dbrows($iconQuery)) {
示例15: redirect
if (!checkrights("FB4") || !defined("iAUTH") || $_GET['aid'] != iAUTH) {
redirect("../index.php");
}
$current_version = "4.0.1";
// Check if locale file is available matching the current site locale setting.
if (file_exists(INFUSIONS . "fusionboard4/locale/" . $settings['locale'] . ".php")) {
// Load the locale file matching the current site locale setting.
include INFUSIONS . "fusionboard4/locale/" . $settings['locale'] . ".php";
} else {
// Load the infusion's default locale file.
include INFUSIONS . "fusionboard4/locale/English.php";
}
include INFUSIONS . "fusionboard4/includes/func.php";
$_GET['section'] = isset($_GET['section']) ? $_GET['section'] : "titles";
opentable($locale['fb202']);
renderNav(false, false, array(INFUSIONS . "fusionboard4/admin.php" . $aidlink . "&section=" . $_GET['section'], $locale['fb202']));
echo "<script src='" . INFUSIONS . "fusionboard4/includes/js/fb4.js' type='text/javascript'></script>\n\t<br /><table cellpadding='0' cellspacing='1' class='tbl-border center'>\n<tr>\n";
echo "<td class='" . (eregi("titles", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=titles'>" . $locale['fb200'] . "</a></span></td>\n";
echo "<td class='" . (eregi("labels", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=labels'>" . $locale['fb821'] . "</a></span></td>\n";
echo "<td class='" . (eregi("ratings", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=ratings'>" . $locale['fb850'] . "</a></span></td>\n";
echo "<td class='" . (eregi("awards", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=awards'>" . $locale['fb201'] . "</a></span></td>\n";
echo "<td class='" . (eregi("images", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=images'>" . $locale['fb204'] . "</a></span></td>\n";
echo "<td class='" . (eregi("forums", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=forums'>" . $locale['fb206'] . "</a></span></td>\n";
echo "<td class='" . (eregi("warnings", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=warnings'>" . $locale['fbw103'] . "</a></span></td>\n";
echo "<td class='" . (eregi("settings", $_GET['section']) ? "tbl1" : "tbl2") . "' style='padding-left:10px;padding-right:10px;'><span class='small'><a href='" . FUSION_SELF . $aidlink . "&section=settings'>" . $locale['fb203'] . "</a></span></td>\n";
echo "</tr>\n</table>\n<br />\n";
closetable();
if ($_GET['section'] == "titles") {
if (isset($_POST['goTitle'])) {
$title_title = addslash(stripinput($_POST['title_title']));
$title_access = isNum($_POST['title_access']) ? $_POST['title_access'] : "101";