Okay. I am a new to codigniter and I am trying to get ci 2.2 to work with the outdated “blog in 20 min tutorial”.
I am getting the following error when I am trying to use the anchor function.
PHP Fatal error: Call to undefined function anchor() in C:\\Program Files\\Apache Software Foundation\\Apache2.2\\htdocs\\ci\\application\\views\\blog_view.php on line 13
Any help is greatly appreciated!
Below are my controller and view scripts:
<?php
class Blog extends CI_Controller {
function _construct()
{
parent::_construct();
$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);
}
}
?><html>
<head>
<title><?=$title?></title>
</head>
<body>
<h1><?=$heading?></h1>
<?php foreach($query->result() as $row): ?>
<h3><?=$row->title?></h3>
<p> <?=$row->body?><br />
<br />
<?=anchor('blog/comments', 'Comments');?><br />
<br />
<hr><br />
<br />
<?php endforeach; ?><br />
<br />
<br />
</body><br />
</html>