Jump to content

Meta tags not loading dynamically... Why? (CodeIgnitor)


Craptacular

Recommended Posts

Hi guys,

 

I am trying to have unique meta tags for each page. So far, this code is only loading the DEFAULT meta tags, and I just can’t see why it isn’t working with my individual pages with their unique meta content. :(

 

I have my header.php with this code directly after the opening head tag:

 

<?php
if(!isset($meta)) {
$meta = array(
                 array('name'=>'description', 'content'=>'A short but sweet DEFAULT description of this fine site'),
                 array('name' =>'keywords', 'content'=>'some awesome DEFAULT keywords for those rascally web crawlers')
        );
}
?>
<?php
$this->load->helper('html');
?>

more php here.....
.....
.....
.....
<title>
...
</title>

<link rel="shortcut icon" type="image/x-icon" href="img/fav.ico">
<meta charset="UTF-8" />

<!--This is where I am calling the meta function-->
<?php echo meta($meta);?> 

More php and html goes here...

 

And then this is what I am putting in all of my pages (except for my header.php, of course!), before I include the header:

 

<?php
$meta = array(
                array('name'=>'description', 'content'=>'Another short but sweet description'),
                array('name' =>'keywords', 'content'=>'Mmmmm. Yummy keywords for you to savor')
       );

$this->load->view('includes/header');
?>

html stuff goes here 

 

Any thoughts, or ideas on this matter, please? :wtf:

 

Thanks so much!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.