• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Message: Undefined variable: meta

#1
[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;

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. Big Grin

Thanky.


Messages In This Thread
Message: Undefined variable: meta - by El Forum - 09-05-2009, 08:02 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 08:36 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 08:38 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 08:42 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 08:46 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:00 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:14 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:14 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:16 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:23 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:26 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 09:31 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 11:02 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 11:12 AM
Message: Undefined variable: meta - by El Forum - 09-05-2009, 02:02 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.