function get_ol($array, $child = FALSE) { $str = ''; if (count($array)) { $str .= $child == FALSE ? '<ol class="sortable">' : '<ol>'; foreach ($array as $item) { $str .= '<li id="list_' . $item['id'] . '">'; $str .= '<div>' . $item['title'] . '</div>'; /* Do we have any children? */ if (isset($item['children']) && count($item['children'])) { $str .= get_ol($item['children'], TRUE); } $str .= '</li>' . PHP_EOL; } $str .= '</ol>' . PHP_EOL; } return $str; }
function get_ol($array, $child = FALSE) { $str = ''; if (count($array)) { $str .= $child == FALSE ? '<ol class="sortable">' : '<ol>'; foreach ($array as $item) { $str .= '<li id="list_' . $item['id'] . '">'; $str .= '<div> <i class="glyphicon glyphicon-plus"></i> ' . $item['title'] . '</div>'; //Do We have Children if (isset($item['children']) && count($item['children'])) { $str .= get_ol($item['children'], TRUE); } $str .= '</li>' . PHP_EOL; } $str .= '</ol>' . PHP_EOL; } return $str; }
function get_ol($array, $status, $child = FALSE) { $str = ''; if (count($array)) { $str .= $child == FALSE ? '<ol class="sortable">' : '<ol>'; foreach ($array as $item) { $str .= '<li id="list_' . $item['id'] . '" class="list-group-item" style="border:none;" >'; $str .= '<div>' . $item['title']; $str .= '<b class="pull-right">' . btn_delete('admin/pages/delete/' . $item['id']); $str .= '<a href="' . base_url("index.php/admin/pages/edit/" . $item['id']) . '" class="btn btn-default btn-xs btn-primary" data-target="#telo" role="button" data-toggle="modal"> <span class="glyphicon glyphicon-edit"></span> Edit</a></b></div>'; // Do we have any children? if (isset($item['children']) && count($item['children'])) { $str .= get_ol($item['children'], $status, TRUE); } $str .= '</li>' . PHP_EOL; } $str .= '</ol>' . PHP_EOL; } return $str; }
<?php if ($slides) { echo get_ol($slides); } else { echo 'No Data'; } function get_ol($array, $child = FALSE) { $str = ''; if (count($array)) { $str .= $child == FALSE ? '<ol class="sortableslide media-list">' : '<ol>'; foreach ($array as $item) { $str .= '<li id="list_' . $item->slide_id . '" class="media list-group-item">'; if (!empty($item->slide_image)) { $str .= '<a class="pull-left" href="' . base_url('index.php/admin/slides/add/' . $item->slide_id) . '"><img class="media-object" src="' . base_url($item->slide_thumb) . '"></a>'; } else { $str .= '<a class="pull-left" href="' . base_url('index.php/admin/slides/add/' . $item->slide_id) . '"><img alt="" src="http://placehold.it/100x120"></a>'; } $str .= '<div class="media-body"><h4 class="media-heading">' . $item->slide_title . '<span class="pull-right">' . btn_delete('admin/slider/delete_slide/' . $item->slide_id) . '</span></h4>'; $str .= '<p>' . $item->slide_desc . '</p>'; $str .= ' <a href=' . base_url('index.php/admin/slider/edit/' . $item->slide_id) . ' class="btn btn-primary btn-xs" data-toggle="modal" data-target="#telo"> Edit </a></div>'; $str .= '</li>'; } $str .= '</ol><br>'; } return $str; } ?>