Created
July 17, 2011 17:04
-
-
Save arvindravi/1087798 to your computer and use it in GitHub Desktop.
My Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Post extends CI_Controller { | |
function __construct() | |
{ | |
parent::__construct(); | |
$this->load->helper('form'); | |
$this->load->helper('url'); | |
$this->load->helper('html'); | |
$this->load->model('retindpost','dis'); | |
$this->load->library('session'); | |
} | |
private $id; | |
public function index() | |
{ | |
$this->load->view('postit'); | |
//$s=$this->session->userdata('ip_address'); | |
//echo "your ip is:".$s; | |
} | |
public function ret_post() | |
{ | |
$this->$id = $this->uri->segment(3); | |
$dpost['dp']=$this->dis->ret_ind_post($id); | |
$comments['return']=$this->dis->get_comments(); | |
$data1=$dpost + $comments; | |
$this->load->view('indpostview',$data1); | |
} | |
public function post_comment() | |
{ | |
$cmt=$this->input->post('cmt'); | |
$this->load->model('commentprocess'); | |
$now['show']=$this->commentprocess->insert_comment($cmt,$this->$id); | |
$this->load->view('commentland'); | |
} | |
public function boo() | |
{ | |
$this->load->database(); | |
$ret="SELECT * FROM posts ORDER BY 1 DESC LIMIT 1"; | |
$query=$this->db->query($ret); | |
$doo['fed']=$query->result(); | |
$this->load->view('landing1',$doo); | |
} | |
public function foo() | |
{ | |
$this->load->database(); | |
$mpost=$_POST['post']; | |
$sql="INSERT INTO posts VALUES ('',".$this->db->escape($mpost).")"; | |
$this->db->query($sql); | |
$this->load->view('landing'); | |
} | |
public function view() | |
{ | |
$this->load->model('returnposts','post'); | |
$data['posts']=$this->post->get_all_posts(); | |
$this->load->view('viewit',$data); | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment