本文整理汇总了PHP中Section::order_by方法的典型用法代码示例。如果您正苦于以下问题:PHP Section::order_by方法的具体用法?PHP Section::order_by怎么用?PHP Section::order_by使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Section
的用法示例。
在下文中一共展示了Section::order_by方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: printS
function printS($id)
{
$ci =& get_instance();
$s = new Section();
$s->get_by_id($id);
$s->e = anchor($ci->app->app_url('edit/') . $s->id, 'Edit');
$s->d = anchor($ci->app->app_url('delete/') . $s->id, 'Delete');
$output = "<li>";
$output .= $s->id . '|';
$output .= $s->name;
$output .= add($id, 0, "add first child for {$s->name}");
$output .= '|';
$output .= $s->e;
$output .= '|';
$output .= $s->d;
$c = new Section();
$c->where('parent_section', $id);
$c->order_by('sort', 'asc');
$c->get();
if (count($c->all) > 0) {
$output .= "<ul>";
foreach ($c->all as $item) {
$output .= printS($item->id);
$output .= "<li>" . add($id, $item->sort + 1) . "</li>";
}
$output .= "</ul>";
}
$output .= "</li>";
return $output;
}
示例2: array
function rec_section($id, $spacer = '--')
{
$op = array();
$sec = new Section();
$sec->order_by('sort', 'asc');
$sec->get_by_parent_section($id);
foreach ($sec->all as $item) {
$op['s' . $item->id] = $spacer . $item->name;
$op = array_merge($op, rec_section($item->id, $spacer . ' '));
}
return $op;
}
示例3: elseif
?>
parent:
type:section
separator:
type:textbox
default: "|"
style:
type:textarea
<?php
} elseif ($mode == 'layout') {
?>
0
<?php
} elseif ($mode == 'view') {
$sections = new Section();
$sections->order_by('sort', 'asc');
$sections->get_by_parent_section($parent);
function remove_denied($sec)
{
return $sec->can_view();
}
$secs = $sections->all;
$secs = array_filter($secs, 'remove_denied');
$hyperLinks = array();
foreach ($secs as $item) {
$local = site_url($item->id);
array_push($hyperLinks, "<a href=\"{$local}\" style=\"{$style}\" >{$item->name}</a>\n");
}
echo implode($separator, $hyperLinks);
}
示例4: foreach
foreach ($sections->all as $item) {
?>
<li>
<a href="<?php
echo site_url($item->id);
?>
" class="menuitem" >
<?php
echo $item->name;
?>
</a>
<?php
$sub_sections = new Section();
$sub_sections->order_by('sort');
$sub_sections->get_by_parent_section($item->id);
?>
<?php
if (count($sub_sections->all) > 0) {
?>
<ul class="submenu" >
<?php
foreach ($sub_sections->all as $sub) {
?>
<li>
<a href="<?php
echo site_url($sub->id);
?>
" >