Welcome Guest, Not a member yet? Register   Sign In
How can I hide content id on URL
#6

(This post was last modified: 12-04-2016, 09:55 AM by ciadmin. Edit Reason: Aded bbcode for readability )

maybe it will be more better if I can show the codes Smile


pages_model.php

PHP Code:
   public function getMakale($id)
   {
       $record $this->db
                           
->from('makale')
                           ->where('id'$id)
                           ->where('status'1)
                           ->get()
                           ->row();
       
       if 
(empty($record)) {
           return FALSE;
       }
       
       $record
->user $this->getUser($record->user_id1NULLFALSE);
       
       return $record
;
   }
   
   public 
function getMakaleKategori($id)
   {
       $record $this->db
                           
->from('makale_kategori')
                           ->where('id'$id)
                           ->where('status'1)
                           ->get()
                           ->row();
       
       if 
(empty($record)) {
           return FALSE;
       }
       
       $record
->makaleler $this->getMakaleKategoriToMakale($record->id);
       
       return $record
;
   

--------------------------------------------------


controller - pages.php


PHP Code:
 public function makale()
   {
       $id = (int) $this->uri->segment(2);
       $record $this->pages_model->getMakale($id);
       
       if 
(empty($record)) {
           $this->site->set_alert('error'lang('makale-not-exist'));
           redirect('makaleler');
       }
       
       $this
->pages_model->updateHit('makale'$record->id);
       $record->hit $record->hit 1;
       $this->data['record'] = $record;
           
$this
->site->breadcrumb('Makaleler''makaleler''');
$this->site->breadcrumb($record->baslik'''');
       
$this
->site->title($record->baslik);
$this->site->description($record->meta_description);
$this->site->keywords($record->meta_keywords);
       
$this
->load->view('makale'$this->data);
   }
  
 
-------------------------------------------------

and the routes code

PHP Code:
$route["makale/([0-9]+)/(.*)"] = "pages/makale"
thank you veri much.
Reply


Messages In This Thread
How can I hide content id on URL - by olmos - 10-20-2016, 06:42 AM
RE: How can I hide content id on URL - by Shawn - 10-20-2016, 03:15 PM
RE: How can I hide content id on URL - by olmos - 12-04-2016, 03:06 AM
RE: How can I hide content id on URL - by olmos - 12-04-2016, 12:00 PM
RE: How can I hide content id on URL - by olmos - 12-05-2016, 05:20 AM
RE: How can I hide content id on URL - by PaulD - 12-05-2016, 12:11 PM
RE: How can I hide content id on URL - by olmos - 12-06-2016, 01:44 AM
RE: How can I hide content id on URL - by PaulD - 12-06-2016, 11:19 AM



Theme © iAndrew 2016 - Forum software by © MyBB