site-accueil-insa/structure/template.php

58 lines
No EOL
2.4 KiB
PHP

<?php
$relativepath = $infopage[0]; // position relative de la page, si la page est à la racine, alors on laisse le champ vide
$pagetitle = $infopage[1]; // titre de la page affiché dans la balise <title>
$pagecontent = $infopage[2]; // contenu de la page qui se retrouve dans le <body>
$pagescript = $infopage[3]; // contenu de la page qui doit se retrouver en dehors du <body>
$pagename = $infopage[4]; // nom de la page exact servant à appeler le css (cf <link rel="stylesheet" ...> sur /structure/template.php). Ex : ceciestunepage.php => { $pagetitle = "Ceci est une page" et $pagename = "ceciestunepage" }
?>
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset='utf-8'>
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<meta name="viewport" content="width=device-width,maximum-scale=2">
<link rel="shortcut icon" href="<?= $relativepath ?>favicon.ico">
<link rel="stylesheet" type="text/css" href="<?= $relativepath ?>assets/css/page/<?= $pagename ?>.css" />
<link rel="stylesheet" type="text/css" href="<?= $relativepath ?>assets/css/menu.css" />
<link rel="stylesheet" type="text/css" href="<?= $relativepath ?>assets/css/footer.css" />
<title><?= $pagetitle ?> | INSAT Accueil</title>
<!-- Matomo (analytic) -->
<script type="text/javascript">
var _paq = _paq || [];
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
_paq.push(['disableCookies']);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//etud.insa-toulouse.fr/~accueil_insa/analytics/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body>
<header>
<?php include $relativepath."structure/menu.php"; ?>
</header>
<?php
if (isset($pagecontent)) {
echo $pagecontent; //ici on appelle le contenu de la page
}
?>
<footer>
<?php include $relativepath."structure/footer.php"; ?>
</footer>
</body>
</html>
<?php
if (isset($pagescript)) {
echo $pagescript; //ici on appelle les scripts de la page (s'il y en a)
}
?>