El Forum
10-25-2007, 04:46 AM
[eluser]cibill[/eluser]
well
this are my files and change i`ve been made:
---
autoload.php
for recognition of my database i`ve done this change
|
*/
$autoload['core'] = array('database');
------
My blog controller blog.php looks like this:
<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$data['title'] = "My Blog Title";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');
$this->load->view('blog_view', $data);
}
}
?>
-----
And my blog_view.php file looks like this:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php foreach($query->result() as $row): ?>
<h3><?=$row->title?></h3>
<p><?=$row->body?></p>
<p><?=ancor('blog/comments', 'Comments');?></p>
<hr />
<?php endforeach; ?>
</body>
</html>
------
well and the browser is showing me this Error Mesage:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$db
Filename: controllers/blog.php
Line Number: 18
------
QUESTION: where is the problem (i know line 18 blog.php), i did exactly the same thing like in video tutorial, maybe i`ve done wrong the cofig files, or what?!
can anyone help me
I have problems also with the links when i`m using the scaffolding, but this is another story...
best regards
well
this are my files and change i`ve been made:
---
autoload.php
for recognition of my database i`ve done this change
|
*/
$autoload['core'] = array('database');
------
My blog controller blog.php looks like this:
<?php
class Blog extends Controller {
function Blog()
{
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
}
function index()
{
$data['title'] = "My Blog Title";
$data['heading'] = "My Blog Heading";
$data['query'] = $this->db->get('entries');
$this->load->view('blog_view', $data);
}
}
?>
-----
And my blog_view.php file looks like this:
<html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php foreach($query->result() as $row): ?>
<h3><?=$row->title?></h3>
<p><?=$row->body?></p>
<p><?=ancor('blog/comments', 'Comments');?></p>
<hr />
<?php endforeach; ?>
</body>
</html>
------
well and the browser is showing me this Error Mesage:
A PHP Error was encountered
Severity: Notice
Message: Undefined property: Blog::$db
Filename: controllers/blog.php
Line Number: 18
------
QUESTION: where is the problem (i know line 18 blog.php), i did exactly the same thing like in video tutorial, maybe i`ve done wrong the cofig files, or what?!
can anyone help me
I have problems also with the links when i`m using the scaffolding, but this is another story...
best regards