Controller file : function index here
public function index()
{
$this->load->helper('url');
$this->load->helper('form');
$this->load->model('register_model');
$this->load->library("pagination");
$config = array();
$config["base_url"] = base_url()."register";
$config["total_rows"] = $this->register_model->record_count();
$config["per_page"] = 5;
$config["uri_segment"] = 3;
$this->pagination->initialize($config);
$page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
$data["result"] = $this->register_model->fetch_logs($config["per_page"], $page);
$data["links"] = $this->pagination->create_links();
$this->load->view('register',$data);
}
here s my model functions
public function view()
{
$query = $this->db->query("select * from user_login");
return $query->result_array();
}
public function record_count()
{
return $this->db->count_all("user_login");
}
public function fetch_logs($limit, $start)
{
$this->db->limit($limit, $start);
$query = $this->db->get("user_login");
if ($query->num_rows() > 0) {
foreach ($query->result() as $row) {
$data[] = $row;
}
return $data;
}
return false;
}
here s my view codes
<form method="post" accept-charset="utf-8" action="<?php echo base_url(); ?>/register/create" class="myform" id="myform" />
<div style="text-align:left;"><h1>User Registration</h1></div>
<table width="488" border="0">
<tr>
<td colspan="3">User
<input name="user_name" type="text" size="40" /></td>
</tr>
<tr>
<td colspan="3">Pass
<input name="password" type="password" size="40" /></td>
</tr>
<tr>
<td width="278" align="right"><input name="submit" type="submit" value="ADD" class="big_btn"/></td>
<td width="148" align="center"> </td>
<td width="48" align="center"> </td>
</tr>
</table>
<p> </p>
<table width="679" border="1" cellpadding="3" cellspacing="0">
<tr><th width="202" align="center">User</th>
<th width="319" align="center">Password</th>
<th colspan="2" align="center">Action</th>
<?php
foreach ($result as $row)
{
?>
<tr>
<td height="32" align="center"><?php echo $row->user;?> </td>
<td align="center"><?php echo md5($row->pwd);?></td>
<td width="56" align="center"><a href="<?php echo base_url();?>/register/delete/<?php echo $row->id;?>">
<input name="delete" type="button" id="delete" value="x" class="del_btn">
</a></td>
<td width="68" align="center"><?php
$atts = array(
'width' => '700',
'height' => '300',
'scrollbars' => 'no',
'status' => 'no',
'resizable' => 'yes',
'screenx' => '600',
'screeny' => '150'
);
echo anchor_popup(base_url().'/register/viewmore/'.$row->id, '<input name="view" type="button" id="view" value="" class="view_btn">', $atts);
?></td>
</tr>
<?php
}
?>
</table>
</form>
</div> <p><?php echo $links; ?></p>
Here I can see the pagination links but after i clicks on links its giving 404 Page Not Found error
can any one check this and reply??
if your above controller is register controller then you can do
$config["base_url"] = site_url("register"); //this will call the index function of register contoller
Change this
$config["base_url"] = base_url()."register";
to this
$config["base_url"] = base_url('register'); // or you can use site_url('register');
public function index() {
$this->load->helper ( 'url' );
$this->load->helper ( 'form' );
$this->load->model ( 'register_model' );
$this->load->library ( "pagination" );
$config = array ();
$config ["base_url"] = base_url ( 'register/index/' );
$config ["total_rows"] = $this->register_model->record_count ();
$config ["per_page"] = 5;
$config ["uri_segment"] = 3;
$this->pagination->initialize ( $config );
$page = ($this->uri->segment ( 3 )) ? $this->uri->segment ( 3 ) : 0;
$data ["result"] = $this->register_model->fetch_logs ( $config ["per_page"], $page );
$data ["links"] = $this->pagination->create_links ();
$this->load->view ( 'register', $data );
}
I think here is the problem try this
like
$config['base_url'] = site_url('register/index/');
Related
Codeigniter Pagination doesnt work, the URL changes to 'about:blank#blocked'.
I'm fairly new at php frameworks and codeigniter. I tried to read the documentation but I don't seem to see the problem.
Controller:
class Listing extends CI_Controller {
public function __construct() {
parent::__construct();
}
public function index() {
//Get Total Records Count
$this->db->select("*");
$this->db->from("cities");
if (!empty($_GET['cityFilter'])) {
$this->db->like('city_name', $_GET['cityFilter']);
}
$cityRecordsCount = $this->db->get();
$totalRecords = $cityRecordsCount->num_rows();
$limit = 10;
if (!empty($_GET['cityFilter'])) {
$config["base_url"] = base_url('Listing/index?cityFilter=' . $_GET['cityFilter']);
} else {
$config["base_url"] = base_url('Listing/index?cityFilter=');
}
$config["total_rows"] = $totalRecords;
$config["per_page"] = $limit;
$config['use_page_numbers'] = TRUE;
$config['page_query_string'] = TRUE;
$config['enable_query_strings'] = TRUE;
$config['num_links'] = 2;
$config['cur_tag_open'] = ' <li class="active"><a>';
$config['cur_tag_close'] = '</a></li>';
$config['next_link'] = 'Next';
$config['prev_link'] = 'Previous';
$this->pagination->initialize($config);
$str_links = $this->pagination->create_links();
$links = explode(' ', $str_links);
$offset = 0;
if (!empty($_GET['per_page'])) {
$pageNo = $_GET['per_page'];
$offset = ($pageNo - 1) * $limit;
}
//Get actual result from all records with pagination
$this->db->select("*");
$this->db->from("cities");
if (!empty($_GET['cityFilter'])) {
$this->db->like('city_name', $_GET['cityFilter']);
}
$this->db->limit($limit, $offset);
$cityRecords = $this->db->get();
$this->load->view('listCities', array(
'totalResult' => $totalRecords,
'results' => $cityRecords->result(),
'links' => $links
));
}
}
HTML
<div id="container">
<div class="row">
<div class="col-md-8 col-md-offset-2 col-lg-8 col-lg-offset-2 col-sm-12">
<h1>Pagination With Search.</h1>
<p>A demo for Codeigniter 2.X framework</p>
<br>
<form action="" method="GET">
<div class="input-group pull-right">
<input type="text" class="form-control" placeholder="Search For City"
name="cityFilter" value="<?php
if (!empty($_GET['cityFilter'])) {
echo $_GET['cityFilter'];
}
?>">
<span class="input-group-btn">
<button type="submit" class="btn btn-success"><i class="fa fa-search"></i> Search</button>
</span>
</div>
</form>
<table class="table table-bordered table-hover" border="1">
<thead>
<tr>
<th>#</th>
<th>City Name</th>
<th>City State</th>
</tr>
</thead>
<tbody>
<?php
foreach ($results as $o) {
?>
<tr>
<td><?php echo $o->city_id; ?></td>
<td><?php echo $o->city_name; ?></td>
<td><?php echo $o->city_state; ?></td>
</tr>
<?php }
?>
</tbody>
<tfoot>
</tfoot>
</table>
<ul class="pagination pull-right">
<!-- Show pagination links -->
<?php
foreach ($links as $link) {
echo "<li>" . $link . "</li>";
}
?>
</ul>
</div>
</div>
</div>
It shows a blank page and the URL changes to 'about:blank#blocked'. What am I doing wrong?
I'm making a fuction on the CodeIgniter framework so users are able to edit/update product detail information. But when I submit the form I get a blank page and the product isn't updated in my database. I couldn't find a mistake myself.
Here is my view file form (cadeaubewerken.php):
<table class="aanbieding-cadeau">
<form action="<?php echo base_url() . "KdGwController/update_product"; ?>" method="post">
<tr>
<h4>Cadeau naam</h4>
<td><?php echo form_input(array('id'=>'product_naam', 'name'=>'product_naam', 'value' => $product["product_naam"] , 'size'=>25));?></td>
<td><?php echo form_input(array('type'=>'hidden','id'=>'product_id', 'name'=>'product_id', 'value' => $product['product_id']));?>
</tr>
<tr>
<td><?php echo form_open_multipart('Product/upload'); ?> </td>
</tr>
<tr>
<td>
<h4>Kies een categorie</h4>
<select name="category_id">
<?php foreach (get_categories_h() as $category) :
if ($category->id == $product["category_id"]){
echo '<option value="'.$category->id .'" selected>' . $category->name . '</option>';
}else{
echo '<option value="'.$category->id .'">'.$category->name . '</option>';
}
endforeach; ?>
</select>
</td>
</tr>
<tr>
<td><h4>Ophaal plaats</h4><?php echo form_input(array('id'=>'ophaal_plaats', 'name'=>'ophaal_plaats', 'value' => $product["ophaal_plaats"], 'size'=>25));?></td>
<td><?php echo form_input(array('type'=>'hidden','id'=>'ophaal_plaats', 'name'=>'ophaal_plaats', 'value' => $product['ophaal_plaats']));?>
</tr>
<tr>
<td>
<div class="checkbox">
<label><input type="checkbox" value="">Gebruik adres van mijn account</label>
</div>
</td>
</tr>
<tr>
<td>
<h4>Huidig cadeau profiel foto</h4>
<img src="<?php echo base_url(); ?>upload/<?php echo $product['product_foto_thumb']; ?>" class="img-responsive">
</td>
</tr>
<tr>
<td>
<h4>Cadeau profiel foto veranderen</h4>
<input type="file" name="userfile"/>
</td>
</tr>
<tr>
<td><?php echo form_textarea(array('type'=>'textarea','id'=>'product_beschrijving', 'name'=>'product_beschrijving', 'value' =>$product['product_beschrijving'], 'size'=>25));?></td>
<td><?php echo form_input(array('type'=>'hidden','id'=>'product_beschrijving', 'name'=>'product_beschrijving', 'value' => $product['product_beschrijving']));?>
</tr>
<tr>
<td><input type="submit" class="btn btn-primary" name="submit" value="Cadeau bewerken!" /></td>
</tr>
</table>
</form>
This is my controller file (KdGwController.php):
<?php
class KdGwcontroller extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->model('Product_model');
$this->load->model('Update_product_model');
$this->load->helper(array('form', 'url'));
}
public function details_bewerken($product_id) {
//load the Product_model
$this->load->model('Product_model');
//call function getdata in de Product_model
$data['userdetail_list'] = $this->Product_model->getdata();
//get product details
$data['product'] = $this->Product_model->get_product_details($product_id);
//laad view
$data['main_content'] = 'cadeaubewerken';
$this->load->view('cadeaubewerken',$data);
}
public function update_product() {
$id= $this->input->post('product_id');
$data = array(
'product_naam' => $this->input->post('product_naam'),
'category_id' => $this->input->post('category_id'),
'ophaal_plaats' => $this->input->post('ophaal_plaats'),
);
}
}
And this is my model file : (Update_product_model.php):
<?php
class Update_product_model extends CI_Model {
function update_product($id,$data){
$this->db->where('product_id', $id);
$this->db->update('products', $data);
header ('location:https://kadokado-ferran10.c9users.io//AlleCadeausController');
}
}
?>
No need to add update in model.
Also, your controller update function should be like
public function update_product() {
$id= $this->input->post('product_id');
$data = array(
'product_naam' => $this->input->post('product_naam'),
'category_id' => $this->input->post('category_id'),
'ophaal_plaats' => $this->input->post('ophaal_plaats'),
);
// here I am assuming that `Product` is model
$this->Product->where($id);
$this->Product->update($data);
}
You have not call model function in your controller.
Change your controller update_product() function like this
public function update_product() {
$id= $this->input->post('product_id');
$data = array(
'product_naam' => $this->input->post('product_naam'),
'category_id' => $this->input->post('category_id'),
'ophaal_plaats' => $this->input->post('ophaal_plaats'),
);
$this->Update_product_model->update_product($id,$data);
}
You are not calling function update_product() of Update_product_model.php from KdGwController.php
Change this in your controller...
public function update_product() {
$id= $this->input->post('product_id');
$data = array(
'product_naam' => $this->input->post('product_naam'),
'category_id' => $this->input->post('category_id'),
'ophaal_plaats' => $this->input->post('ophaal_plaats'),
);
$this->Update_product_model->update_product($id,$data); // this line you missed
}
I'm trying to get the $data from my controller to go into my view but it does not seem to be working. I keep getting a "variable does not exist" error. Here's the Controller code (view is loaded in a different part).
$affiliate_id = $this->input->get_post('affiliate_id');
$product_id = $this->input->get_post('product_id');
$data = array();
if (empty($affiliate_id)
&& empty($product_id))
{
$this->session->set_flashdata('error', 'Please enter an affiliate ID, a product ID, or both.');
redirect('admin/affiliate_relationship');
}
if (empty($affiliate_id))
{
$data['affiliate_relationship'] = $this->AffiliateRelationship->search_for_affiliate_by_product_id($product_id);
}
elseif (empty($product_id))
{
$data['affiliate_relationship'] = $this->AffiliateRelationship->search_for_affiliate_by_affiliate_id($affiliate_id);
$affiliate = $affiliate_id;
}
elseif (!empty($affiliate_id)
&& !empty($product_id))
{
$data['affiliate_relationship'] = $this->AffiliateRelationship->search_for_affiliate($affiliate_id, $product_id);
$affiliate = $affiliate_id . '/';
}
$data['affiliate_id'] = $affiliate_id;
$data['product_id'] = $product_id;
redirect_and_continue_processing('admin/affiliate_relationship/' . $affiliate . $product_id, $data);
When I pr($data) I get the array correctly, so I know the data is all there. It's just when it is used in the view it does not even exist.
Am I doing something wrong? I've done other controller and views more-or-less the same way and never got problem this before.
EDIT: View code.
<?php
$affiliateRelationshipRows = NULL;
if (!empty($affiliate_relationship))
{
$class = NULL;
$i = 0;
foreach ($affiliate_relationship->result_array() as $affiliate)
{
if (++$i%2 == 0)
{
$class= ' class="odd"';
}
else
{
$class = NULL;
}
$affiliateRelationshipRows .= <<<END
<tr $class>
<td class="text-left">{$affiliate['id']}</td>
<td class="text-left">{$affiliate['product_id']}</td>
<td class="text-left">{$affiliate['user_id']}</td>
<td class="text-left">{$affiliate['affiliate_status_id']}</td>
<td class="text-left">{$affiliate['created']}</tD>
<td class="text-left">{$affiliate['custom_payout']}</td>
<td class="text-left">{$affiliate['delayed']}</td>
<td class="text-left">{$affiliate['sales_page_url']}</td>
<td class="text-left">{$affiliate['comments']}</td>
</tr>
END;
}
}
?>
<?php echo form_open($this->uri->uri_string()); ?>
<div class="box-search">
<div class="grid-2" style="width:200px; margin-left:25px;">
<span class="label" style="float:none;">
Affiliate ID:
</span>
<span class="field" style="float:none;">
<input type="text" name="affiliate_id" value="<?php if (!empty($affiliate_id)) { echo $affiliate_id; } ?>" style="width: 75px;"/>
</span>
<?php echo form_error('affiliate_id'); ?>
</div>
<div class="grid-2" style="width:200px; margin-left:0px;">
<span class="label" style="float:none; ">
Product ID:
</span>
<span class="field" style="float:none;">
<input type="text" name="product_id" value="<?php if (!empty($product_id)) { echo $product_id; } ?>" style="width:75px;"/>
</span>
<?php echo form_error('product_id'); ?>
</div>
RESET
<input type="submit" name="search" class="btn btn-green btn-mini-submit btn-search" value="SEARCH"/>
<div class="clear"></div>
</div>
<?php echo form_close(); ?>
<div class="box">
<div class="top">
Affiliate Relationship
</div>
<div class="main-table">
<table class="style1" cellpadding="2" cellspacing="0" width="100%" border="0">
<thead>
<tr>
<th>ID</th>
<th>Product ID</th>
<th>User ID</th>
<th>Affiliate Status ID</th>
<th>Created</th>
<th>Custom Payout</th>
<th>Delayed</th>
<th>Sales Page URL</th>
<th>Comments</th>
</tr>
</thead>
<tbody>
<?php echo $affiliateRelationshipRows; ?>
</tbody>
</table>
</div>
The array:
Array
(
[affiliate_relationship] => Array
(
[0] => stdClass Object
(
[id] => 11615304
[created] => 2015-09-17 00:00:00
[product_id] => 175538
[user_id] => 393598
[comments] =>
[affiliate_status_id] => 2
[custom_payout] =>
[delayed] => 0
[sales_page_url] =>
)
)
[affiliate_id] => 11615304
[product_id] => 175538
)
I don't think you can send data like that in redirect_and_continue_processing() or redirect() in codeigniter. The only way to do that is by sending the data as an argument to the function that you are trying to redirect to. Then in that function, use the data to generate the view.
LIke :
redirect_and_continue_processing('admin/affiliate_relationship/' . $affiliate . $product_id/$data);
And in the method "affiliate_relationship" , accept the argument
Redirect method does not take an argument as the variable to send to view.
instead of using
redirect_and_continue_processing('admin/affiliate_relationship/' . $affiliate . $product_id, $data);
you can use simple way to do this
$this->load->view('your_view_name','your data in array');
I just created code that deletes an image from database and also from folder which is an image store, but only one image is successfully deleted from thedatabase and folder when I click "check all". What did I do wrong? Here is my view using check box javascript:
<form name="indonesia" action="<?php echo site_url('admin/wallpaper/delete'); ?>" method="post">
<button type="submit" class="btn btn-danger" name="hapus" value="hapus">Hapus</button>
<?php echo anchor('admin/wallpaper/tambah', 'Tambah Wallpaper');?>
<table id="example" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th>
<button type="button" class="btn btn-info" onClick="check_all()" >Check</button>
<button type="button" class="btn btn-success" onClick="uncheck_all()" >Un-Check</button>
</th>
<th>id</th>
<th>Keterangan</th>
<th>Gambar</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php
foreach ($ListWallpaper->result() as $row)
{
?>
<tr>
<td><input type="checkbox" name="item[]" id="item[]" value="<?=$row->id_wall ?>"></td>
<td><?=$row->id_wall ?></td>
<td><?=$row->ket ?></td>
<td><?=$row->wall ?></td>
<td>
Delete
Update
</td>
</tr>
<?php } ?>
</tbody>
</table>
</form>
and here is my controller
public function delete()
{
$ownerNames = $this->input->post('item');
foreach ($ownerNames as $ownerName => $k) {
//echo "Array : " . $k . "<br/>";
$photo = $this->wallpaper_model->del_photo($k);
if ($photo->num_rows() > 0)
{
$row = $photo->row();
$file_photo = $row->wall;
echo "$file_name</br>";
$path_file = 'image/wallpaper/';
unlink($path_file.$file_photo);
}
$this->wallpaper_model->drop_photo($k);
redirect('admin/wallpaper','refresh');
}
}
and my model
function del_photo($k)
{
$this->db->where('id_wall',$k);
$query = $getData = $this->db->get('tabel_wall');
if($getData->num_rows() > 0)
return $query;
else
return null;
}
function drop_photo($k)
{
$this->db->where('id_wall',$k);
$this->db->delete('tabel_wall');
}
Only one image is successfully deleted from the folder and database too, but when I try to echo "$file_name</br>"; it show all images. What did I do wrong? if anyone can guide me, I will appreciate that.
First off I would set a array of images from controller to view, $data['wallpapers'] = array(); for some of the site_url you may need to include in your route.php $route['controller/update/(:any)'] = "controller/update/$1"
To Delete selected images, You could do a selected post in array() and then on the value check box name=""
Disclaimer: This is just for a example only.
public function index() {
$k = $this->uri->segment(what ever); // Use uri segment is id example.com/image/1 = $this->uri->segment(2);
$results = $this->model_name->del_photo($k);
$data['wallpapers'] = array();
foreach ($results as $result) {
$data['wallpapers'][] = array(
'id_wall' => $result['id_wall'],
'update' => site_url('controllername/update' .'/'. $result['wall_id']),
'ket' => $result['ket']
);
}
$data['delete'] = site_url('controller/function');
$selected = $this->input->post('selected');
if (isset($selected)) {
$data['selected'] = (array)$selected;
} else {
$data['selected'] = array();
}
$this->load->view('your list', $data);
}
public function update() {
//update info here
}
public function delete() {
$selected = $this->input->post('selected');
if (isset($selected)) {
foreach ($selected as $image_id) {
$wall_id = $image_id
$this->db->query("DELETE FROM " . $this->db->dbprfix . "TABLENAME WHERE wall_id = '" . (int)$wall_id . "'");
}
}
}
View
Added echo delete from controller as site url.
<form action="<?php echo $delete;?>" method="post">
<table>
<thead>
<tr>
<td style="width: 1px;" class="text-center"><input type="checkbox" onclick="$('input[name*=\'selected\']').prop('checked', this.checked);" /></td>
<td>Update</td>
</tr>
</thead>
<tbody>
<?php if ($wallpapers) { ?>
<?php foreach ($wallpapers as $wallpaper) { ?>
<td class="text-center"><?php if (in_array($wallpaper['id_wall'], $selected)) { ?>
<input type="checkbox" name="selected[]" value="<?php echo $wallpaper['id_wall']; ?>" checked="checked" />
<?php } else { ?>
<input type="checkbox" name="selected[]" value="<?php echo $wallpaper['id_wall']; ?>" />
<?php } ?>
</td>
<td>Update</td>
<?php } ?>
<?php } ?>
</tbody>
</table>
</form>
Model
function del_photo($k) {
$this->db->where('id_wall',$k);
$query = $this->db->get('table_name');
if($query->num_rows() > 0) {
$return = $query->result_array();
} else {
return false;
}
}
In controller, move redirect directive outside of foreach loop.
i have view vkategorimaterial like this
<table border="1">
<tr>
<td colspan="4">Tampilkan<?php
echo form_open('c_kategorimaterial/cari');
echo nbs();$intext=array('name' => 'cari', 'class' => 'GUI');
echo form_input($intext);
echo nbs(); $inbutton=array('value' => 'Cari', 'class' => 'button');
echo form_submit($inbutton);
echo form_close();
?></td>
</tr>
<tr>
<td colspan="4"><img class ="create" src="<?php echo base_url();?>img/create.png"></td>
</tr>
<tr>
<td>Nomor</td>
<td>Kode Kategori Material / Jasa</td>
<td>Nama Material / Jasa</td>
<td>Perintah</td>
</tr>
<?php if ( !empty($rows) )
{
$no = 1;
foreach ($rows as $row) { ?>
<tr id="row">
<td><?php echo $no;?></td>
<td><?php echo $row->Kode_Kategori_Material_Jasa;?></td>
<td><?php echo $row->Nama_Material_Jasa;?></td>
<td> <img class="perintah" src="<?php echo base_url(); ?>img/update.png"><img class="perintah" src="<?php echo base_url(); ?>img/delete.png"></td>
</tr>
<?php
$no++;
}
}
else { ?>
<tr id="row">
<td colspan="6" align="center">Tabel Kosong</td>
</tr>
<?php
}
?>
</table>
<?php echo $this->pagination->create_links(); ?>
then i made the controller named c_kategorimaterial here is the index part
function index()
{
$query = $this->m_kategorimaterial->get();
$config['base_url'] = base_url().'index.php/c_kategorimaterial/index/';
$config['total_rows'] = $query->num_rows();
$config['per_page'] = 5;
$this->pagination->initialize($config);
$data['rows'] = $query->result();
$data['title'] = 'QB Kategori Material';
$this->load->view('menu',$data);
$this->load->view('v/vkategorimaterial');
}
i want to make a pagination that showing 5 rows per page. and here is the model of m_kategorimaterial->get
$this->db->order_by('Kode_Kategori_Material_Jasa','DESC');
$query = $this->db->get('ms_kategori_material',5);
return $query;
why does the pagination is not showing ? here is the result of print_r($data['rows']);
Array ( [0] => stdClass Object ( [Kode_Kategori_Material_Jasa] => KKMJ006 [Nama_Material_Jasa] => Biji ) [1] => stdClass Object ( [Kode_Kategori_Material_Jasa] => KKMJ004 [Nama_Material_Jasa] => Teneh ) [2] => stdClass Object ( [Kode_Kategori_Material_Jasa] => KKMJ001 [Nama_Material_Jasa] => Air ) )
Try this block
function index()
{
$query = $this->m_kategorimaterial->get();
$config['base_url'] = base_url().'index.php/c_kategorimaterial/index/';
$config['total_rows'] = $query->num_rows();
$config['per_page'] = 5;
$data['rows'] = $query->result();
$this->pagination->initialize($config);
$this->load->vars($data); // !!!
$data['title'] = 'QB Kategori Material';
$this->load->view('menu',$data);
$this->load->view('v/vkategorimaterial');
}
And in your view try this,
echo $this->pagination->create_links();
echo $this->pagination->create_links();
Include pagination library in controller
$this->load->library('pagination');
And alter a line in your controller to
$this->load->view('v/vkategorimaterial',$data);
Here is helpful link for you Codeigniter Pagination: