Welcome Guest, Not a member yet? Register   Sign In
Call to undefined function anchor( ) when stepping through the tutorial.

[eluser]Chris (from L.C.)[/eluser]
I'm steeping through the video tutorial, and I'm stuck on the adding the comment form helper. I've correctly added the helpers in blog.php, and the anchor call, but I'm getting this error:

Call to undefined function anchor() in /home/quickgig/public_html/system/application/views/blog_view.php on line 17

I've left it up at http://www.quickgig.com/blog, along with the
<?php phpinfo(); ?>
tag incase there is something there helpful.

Here's the blog.php code:

class Blog extends Controller {

function blog()

function index()
  $data['title'] = "Blog Title";
  $data['heading'] = "Blog Heading";
  $data['query'] = $this->db->get('entries');
  $this->load->view('blog_view', $data);

and the blog_view.php code:

<title><?=$title; ?></title>

<h1>&lt;?=$heading; ?&gt;</h1>

&lt;?php phpinfo(); ?&gt;

&lt;?php foreach($query->result() as $row): ?&gt;


<p>&lt;?=anchor('blog/comments', 'Comments');?&gt;</p>

&lt;?php endforeach; ?&gt;



[eluser][email protected][/eluser]
you might need to load the URL helper..

[eluser]Chris (from L.C.)[/eluser]
[quote author="[email protected]" date="1185252720"]you might need to load the URL helper..[/quote]

Isn't that what this line



It is planted in the blog.php

[eluser]Chris (from L.C.)[/eluser]
Ok,...I've found the problem.

lmkow, you're right. My local version was not updating the rmote version of the file, even though it showed me it was. Guess that's what I get for using Dreamweaver to do coding.

[eluser][email protected][/eluser]
hope you have solved your problem by now. Big Grin
But i found something in your code

class Blog extends Controller {

function blog()....
The name of constructor method of the Blog class is in lowercase, which is different than the one you put in class declaration. So the constructor might never run each time the class initiated, and the url helper also are not loaded in this case...

Theme © iAndrew 2016 - Forum software by © MyBB