PHP includes are a great way to reuse common page parts like headers and footers. Since the header may also include links to scripts or stylesheets, it would also be nice to change or add those as necessary. To do that we assign the appropriate info to PHP variables in each file that includes the header and use the same variables in the header file to assign the variable to the script and link tags.
This uses a custom style from the added stylesheet.
In the content file:
<?php $customStyle="customStyles1.css"; $customScript="customScripts1.js"; ?> <?php include('cfa-header.php'); ?>In the cfa-header.php file:
For the sake of elegance we could also make sure the variables have a value set before calling them as in: