Skip to content

Instantly share code, notes, and snippets.

@wethu
Last active August 29, 2015 14:15
Show Gist options
  • Select an option

  • Save wethu/b57dc60bd59e075fdd67 to your computer and use it in GitHub Desktop.

Select an option

Save wethu/b57dc60bd59e075fdd67 to your computer and use it in GitHub Desktop.
<?php
/**
* Header template
*/
?><!doctype html>
<html lang="en">
<head>
<title><?php echo $site_title; ?></title>
<!-- style.css should be shared styles across all pages -->
<link rel="stylesheet" type="text/css" src="style.css" />
<!-- $stylesheet was set in our index.php file which will only be included on that page -->
<link rel="stylesheet" type="text/css" src="<?php echo $stylesheet; ?>" />
</head>
<body>
<div class="page"><!-- Begin page content -->
body {
background-color: blue;
}
body {
background-color: red;
}
<?php
// This is page 1, with a body that wants to be styled a certain way
$stylesheet = "page-one-styles.css";
$site_title = "Page One";
include('header.php');
<!-- this is inside .page -->
<p>Hello this is page 1</p>
include('footer.php');
<?php
// This is page 2, with a body that wants to be styled another way
$stylesheet = "page-two-styles.css"; // notice i'm including a different stylesheet file
$site_title = "Page Two";
include('header.php');
<!-- this is inside .page -->
<p>Hello this is page 2</p>
include('footer.php');
body {
width: 960px;
margin: 0 auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment