CodeIgniter Forums

Full Version: [split] Best way to load unique header and footer for each page?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
hello everyone. I want to create SEO plugin in codeigniter same as Yoast plugin for wordpress. But problem is how to create different header for every page for website more than 300+ pages. Is it possible that I would assign a unique id and than create custom header for every pages.
As you've probably considered, it's easy to provide dynamically determined values to the header.


PHP Code:
$data['page_title'] = $title;
$data["description_meta"] = $meta_desc;
$data["keywords_meta"] = $meta_keys;


The view file header.php

PHP Code:
<!doctype html>
       <title><?= $page_title?></title>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <meta name="keywords" content="<?= $keywords_meta?>">
        <meta name="description" content="<?= $description_meta?>">
        <!--all the other head stuff needed or desired-->

The hard part is determining what values to assign to $title, $meta_desc and $meta_keys.
I assume that's the question you're really asking.
The answer depends on several factors:
  1. How exactly the website produces pages?
    • How dynamic is page content?
    • How dynamic are page URLs?
  2. How explicit do you want to be with metadata?

Care to tell us about all that?
Oh thanks mate !!!!!
You saved my lot of time.