For my header.php
file, I would like to grab the <title>
via php and having trouble doing this. I know calling the constant would work, but that would mean I would need multiple files (which is bad practice). Any further help would be appreciated.
define("HOME", dirname(__DIR__)."index.php");
define("ABOUT", dirname(__DIR__)."../about/index.php");
define("WORK", dirname(__DIR__)."../work/index.php");
define("SERVICES", dirname(__DIR__)."../services/index.php");
define("CLIENTS", dirname(__DIR__)."../clients/index.php");
define("CONTACT", dirname(__DIR__)."../contact/index.php");
$page_titles = array (
'home_page' => 'Home | Page',
'about_page' => 'About | Page',
'work_page' => 'Work | Page',
'services_page' => 'Services | Page',
'clients_page' => 'Clients | Page',
'contact_page' => 'Contact | Page'
);
if (HOME == $page_titles[0]) {
return $page_titles[0];
}
if (ABOUT == $page_titles[1]) {
return $page_titles[1];
}
if (WORK == $page_titles[2]) {
return $page_titles[2];
}
if (SERVICES == $page_titles[3]) {
return $page_titles[3];
}
if (CLIENTS == $page_titles[4]) {
return $page_titles[4];
}
if (CONTACT == $page_titles[5]) {
return $page_titles[5];
}