El Forum
09-05-2009, 08:02 AM
[eluser]doubleplusgood[/eluser]
Hi there,
I'm attempting to use the HTML Helper to add meta tags to my view. However, the page is reporting the following error;
My welcome.php controller looks like this;
And at the head of my welcome_message.php view looks like this;
I would be grateful if someone could point out the (probably obvious) error that I'm making.
Thanky.
Hi there,
I'm attempting to use the HTML Helper to add meta tags to my view. However, the page is reporting the following error;
Quote:A PHP Error was encountered
Severity: Notice
Message: Undefined variable: meta
Filename: views/welcome_message.php
Line Number: 2
My welcome.php controller looks like this;
Code:
<?php
class Welcome extends Controller {
function Welcome()
{
parent::Controller();
}
function index()
{
$this->load->view('welcome_message');
$meta = array(
array('name' => 'robots', 'content' => 'no-cache'),
array('name' => 'description', 'content' => 'My Great Site'),
array('name' => 'keywords', 'content' => 'love, passion, intrigue, deception'),
array('name' => 'robots', 'content' => 'no-cache'),
array('name' => 'Content-type', 'content' => 'text/html; charset=utf-8', 'type' => 'equiv')
);
$link = array(
'href' => 'css/printer.css',
'rel' => 'stylesheet',
'type' => 'text/css',
'media' => 'print'
);
}
}
/* End of file welcome.php */
/* Location: ./base/yourappname/controllers/welcome.php */
And at the head of my welcome_message.php view looks like this;
Code:
<?php echo doctype('html5'); ?>
<?php echo meta($meta); ?>
<head>
<title>Welcome to CodeIgniter</title>
<?php echo link_tag($link); ?>
I would be grateful if someone could point out the (probably obvious) error that I'm making.

Thanky.