0

I'm trying to replace my header in my admin pages from my index.php file but I can't figure out how to call them. First of all, this is my first router and index.php page so I probably made a few mistakes.

I've tried something like this but it returns false where ever I am on the website so that doesn't work. I searched the web and found something about looking at the url but I can't figure it out how to use that either.

<?php
$title = '';
include_once 'resources/include.php';
$header = isset($admin);
var_dump($header);

$request = $_SERVER['REQUEST_URI'];
// include_once 'header.php';

$route = new Router($request);
if($header = true) {
    include_once 'admin/adminheader.php';
} else {
    include_once 'header.php';
}

$route->get('', '/start');

$route->get('products', '/shop/products');

$route->get('checkout', '/shop/checkout');

$route->get('orderconfirmation', '/shop/orderconfirmation');

$route->get('category' , '/shop/category-page');

$route->get('tillverknings-policy', 'tillverknings-policy.php');

// Customer pages

$route->get('customerstart', '/customerpages/customerstart');

$route->get('yourorders', '/customerpages/customerorders');

$route->get('update', '/customerpages/customerupdate');

$route->get('login', '/customerpages/customerlogin');

$route->get('logout', '/logout');

// Admin pages

$admin = $route->get('login-admin', '/admin/adminlogin');

$admin = $route->get('start', '/admin/adminpanel');

$admin = $route->get('kunder', '/admin/changecustomerinfo');

$admin = $route->get('skapa-admin', '/admin/createadmin');

$admin = $route->get('skapa-produkt', '/admin/createproduct');

$admin = $route->get('orders', '/admin/orders');

include_once 'footer.php';

?>

Does anyone have any pointers or suggestions? I feel so stupid that I can't solve it myself and it's probably because I'm so stressed over this. It's my final school project and it need to be turned in really soon.

Thanks in regards!

0 Answers0