[eluser]adityajoshi[/eluser]
i am having similar problem
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<h1>Welcome to my blog</h1>
<ol>
<div = "posts">
<?php foreach($query->result() as $row): ?>
<?php echo $row->title ?>
<?php echo $row->text ?>
</div>
<?php
$comment_display = $this->comment_display($row->id);
?>
<form method = "post" action = "http://localhost/feeders/index.php/blog/comment_insert">
<?php echo form_hidden('entry_id',$this->uri->segment(3)); ?>
<p><textarea name="text" rows="3"></textarea></p>
<p><input type="text" name="author" /></textarea></p>
<p><input type="submit" value="Submit" /></textarea></p>
</form>
<hr />
<?php endforeach; ?>
</ol>
</body>
</html>
My controller is
<?php
var_dump($_POST);
class Blog extends Controller {
function Blog()
{
parent::Controller();
$this->load->scaffolding('comments');
$this->load->helper('form');
$this->load->helper('url');
$this->load->model('blog_model');
}
function index()
{
$data['title'] = "Blog";
$data['list'] = array('first', 'second', 'third');
$data['query'] = $this->blog_model->get_blog_entries();
$this->load->view('blog_view',$data);
}
function comment_display($blog_id)
{
return $this->blog_model->show_comments($blog_id);
}
function comment_insert()
{
$this->db->insert('comments', $_POST);
redirect('blog');
}
}
?>
my model is
<?php
Class Blog_model extends Model
{
function get_blog_entries()
{
return $this->db->get('entries');
}
function show_comments($row_id)
{
$this->db->where('row_id',$row_id)->get('comments');
}
function insert_comment($data)
{
$this->db->insert('comments',$data);
}
}
?>
i am getting the error
( ! ) Fatal error: Call to undefined method CI_Loader::comment_display() in C:\wamp\www\feeders\system\application\views\blog_view.php on line 21
can any one guide me