Welcome Guest, Not a member yet? Register   Sign In
Codeigniter Headdata Library
#1

[eluser]micha8l[/eluser]
Usage:

Code:
$this->load->library('headdata'); // best autoload in config

$this->headdata->set_title('optional title');

echo $this->headdata->generate();

http://pastebin.com/w8CtMpxk

You can create a config 'headdata' and in it define meta information that way. The library also understands inheritance, so repeating of a lot code is under your discretion.

Sample config array:
Code:
'authors' => array(
'html' => array(
     'lang' => 'en',
     'dir' => 'ltr',
     'doctype' => 'xhtml11',
),
'meta' => array(
     'keywords' => array(
  'name' => 'keywords',
  'content' => 'this is a keyword',
     ),
     'description' => array(
  'name' => 'description',
  'content' => 'this is a description',
     ),
     'author' => array(
  'name' => 'author',
  'content' => '2012 Devraid',
     ),
     'content-type' => array(
  'http-equiv' => 'content-type',
  'content' => 'text/html; charset=UTF-8',
     ),
     'content-language' => array(
  'http-equiv' => 'content-language',
  'content' => 'en',
     ),
),
'link' => array(
     array(
  'rel' => 'stylesheet',
  'type' => 'text/css',
  'href' => '/css/blueprint/screen.css',
  'media' => 'screen, projection',
     ),
     array(
  'rel' => 'stylesheet',
  'type' => 'text/css',
  'href' => '/css/blueprint/custom.css',
  'media' => 'screen, projection',
     ),
     array(
  'rel' => 'stylesheet',
  'type' => 'text/css',
  'href' => '/css/blueprint/print.css',
  'media' => 'print',
     ),
     array(
  'ie' => '8',
  'rel' => 'stylesheet',
  'type' => 'text/css',
  'href' => 'css/blueprint/ie.css',
  'media' => 'print',
     ),
     array(
  'rel' => 'stylesheet',
  'type' => 'text/css',
  'href' => '/css/blueprint/wysiwyg-bbcode.css',
  'media' => 'screen',
     ),
),
'javascript' => array(
     array(
  'src' => '/js/suckerfishiefix.js',
     ),
     array(
  'src' => '/js/wysiwyg-bbcode.js',
     ),
     array(
  'src' => '/js/custom.js',
     ),
),
    ),
    'authors/register' => array(
'inherit' => TRUE,
    ),




Theme © iAndrew 2016 - Forum software by © MyBB