Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could do something like this, with the example for a home page:</p> <pre><code>&lt;?php // put metadata inside this array $pageData = array( 'title' =&gt; 'my page title', 'metaDataDescription' =&gt; 'my meta data for this page', 'customAssets' =&gt; array( array( 'type' =&gt; 'js', 'src' =&gt; '//ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js' ) ) ); // include your header file now require_once 'header.php'; ?&gt; &lt;div&gt; This is where the unique content or HTML for this page should go. You could also include unique JavaScript here as well &lt;/div&gt; &lt;?php require_once 'footer.php'; ?&gt; </code></pre> <p>And then the <code>header.php</code> file could look like this:</p> <pre><code>&lt;?php // TODO add a null check for $pageData // and fill in with defaults ?&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en-US"&gt; &lt;head&gt; &lt;meta charset="utf-8" /&gt; &lt;title&gt;&lt;?php echo $pageData['title'];?&gt;&lt;/title&gt; &lt;!-- add general css and js files here --&gt; &lt;?php foreach($pageData['customAssets'] as $index =&gt; $asset) { // TODO do some code to write out custom assets // ex: if($asset['type'] === "js") { echo '&lt;script type="text/javascript" src="' . $asset['src'] . ' "&gt;&lt;/script&gt;'; } }?&gt; &lt;!-- use php to get meta data like title, description, keywords... ex: --&gt; &lt;meta name="description" content="&lt;?php echo $pageData['metaDataDescription'];?&gt;" /&gt; &lt;!-- add favicon and whatever else in the header here --&gt; &lt;/head&gt; &lt;body&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload