public function find_slider() { $this->use->use_model('data_base'); $this->use->use_lib('table/tpl_slider'); $tpl = new tpl_slider(); $db = new data_base($tpl->table(), array($tpl->id(), $tpl->text(), $tpl->image()), array($tpl->status() => 1)); return $db->get_where(); }
public function update_slider() { $this->use->use_model('data_base'); $this->use->use_lib('table/tpl_slider'); $tpl = new tpl_slider(); $db = new data_base($tpl->table(), array($tpl->text() => $_POST['text_update']), array($tpl->id() => $_POST['id_update'])); echo json_encode(array('valid' => $db->change(), 'massage' => '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true"></button><h4>Alert!</h4> <strong>Update success </strong></div>')); }
<div class="table-responsive"> <table id="table" data-toggle="table" data-url="<?php echo site_url('admin/find_all_slider_table_ajax'); ?> " data-cache="false" data-height="400" data-show-refresh="true" data-show-toggle="true" data-show-columns="true" data-pagination="true" data-page-list="[5, 10, 20, 50, 100, 200]" data-search="true" data-flat="true" data-toolbar="#toolbar"> <thead> <tr> <th data-field="<?php echo $tpl_slider->id(); ?> " data-halign="center" data-sortable="true"> ID</th> <th data-field="<?php echo $tpl_slider->text(); ?> " data-halign="center" data-sortable="true"> Text</th> <th data-field="<?php echo $tpl_slider->status(); ?> " data-width="10" data-halign="center" data-sortable="true" data-formatter="operate<?php echo $tpl_slider->status(); ?> "> Status </th> <th data-field="<?php echo $tpl_slider->image(); ?> "
<!-- Wrapper for slides --> <div class="carousel-inner" role="listbox"> <?php foreach ($data as $slider) { if ($first == 1) { $first = 2; ?> <div class="item active"> <img src="<?php echo site_url($slider[$tpl->image()]); ?> " class="img-responsive"> <div class="carousel-caption"> <?php echo $slider[$tpl->text()]; ?> </div> </div> <?php } else { ?> <div class="item"> <img src="<?php echo site_url($slider[$tpl->image()]); ?> " class="img-responsive"> <div class="carousel-caption"> <?php echo $slider[$tpl->text()];