Welcome Guest, Not a member yet? Register   Sign In
CI HTML_Helper (META)
#1

[eluser]Energetic Pixels[/eluser]
Ok, I have a project where the proponent is using alot of html meta tags. I thought that this would be a good time to use the CI html helper. I tried to follow the example stated in the docs and the only way that I can get the meta elements to display correctly is to state the arrays in the view. Which is all well and good, but I would like to move the array out of the view and put it in a controller. But when I do this, codeigniter says that it can not find the variable name "$siteMeta". The html helper is automatically loaded through config->autoload method.
This is what works (in my view->layouts/masterTemplate.php:
Code:
<head>
<?php $siteMeta = array(
   array('name' => 'X-UA-Compatible', 'content' => 'IE=edge, chrome=1'),
   array('name' => 'description', 'content' => ''),
   array('name' => 'keywords', 'content' => "Oklahoma City, Serco North America, Instructional Design, Web Programming, Defense Ammunition Center, DAC, distance learning, eLearning"),
   array('name' => 'Content-type', 'content' => 'charset=utf-8', 'type' => 'equiv'),
   array('name' => 'cleartype', 'content' => 'on', 'equiv'),
   array('name' => 'viewport', 'content' => 'width=device-width, initial-scale=1'),
   array('name' => 'MobileOptimized', 'content' => '320'),
   array('name' => 'HandheldFriendly', 'content' => 'TRUE'),
   array('name' => 'author', 'content' => 'Anthony Jackman'),
   array('name' => 'x-dns-prefetch-control', 'content' => 'on', 'equiv'),
   array('name' => 'distribution', 'content' => 'global'),
   array('name' =>'ICBM', 'content' => '35.386539, -97.41363'),
   array('name' => 'geo.position', 'content' => '35.386539, -97.41363'),
   array('name' => 'geo.placename', 'content' => 'Oklahoma City, Oklahoma, United States'),
   array('name' => 'geo.region', 'content' => 'US-OK'),
   array('name' => 'imagetoolbar', 'content' => 'no', 'equiv'),
   array('name' => 'MSThemeCompatible', 'content' => 'No'),
   array('name' => 'msapplication-tooltip', 'content' => 'Serco Inc., Oklahoma City location past performance and distance learning site')
   );
   ?>
<?= meta($siteMeta); ?>

Shouldn't I be able to move the array out of the masterTemplate and into either a controller or a config??

tony






Theme © iAndrew 2016 - Forum software by © MyBB