?> 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); }
<?php } else { if ($mode == 'layout') { //replace 0 with number of cells your plugin has ?> 0 <?php } else { if ($mode == 'view') { //the real content of your plugin goes here $sections = new Section(); $sections->order_by('sort', 'asc'); $sections->get_by_parent_section($info->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=\"{$info->style}\" >{$item->name}</a>"); } echo implode($info->separator, $hyperLinks); } } }
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; }
$p_sec->get_by_parent_section($info->secondary); foreach ($p_sec->all as $item) { ?> <li class="secondary"> <a href="<?php echo site_url($item->id); ?> " ><?php echo $item->name; ?> </a> <?php $sub_section = new Section(); $sub_section->get_by_parent_section($item->id); if (count($sub_section->all) > 0) { ?> <ul> <?php foreach ($sub_section->all as $sub_item) { ?> <li> <a href="<?php echo site_url($sub_item->id); ?> "><?php echo $item->name; ?> </a> </li>