21-11-2012_site_template.php πŸ“„

Overview

This PHP file defines the global HTML wrapper for pages in the Linuxfront Logistics v2 application.
It orchestrates the inclusion of configuration, metadata, navigation panels, page-specific content, and footer fragments.

Purpose

  • Establish a consistent site layout across all pages.
  • Load environment settings and constants.
  • Dynamically include header, navigation, banner, content, and footer based on the current template.

Dependencies

  • inc/config.php
    • Starts session, sets headers, memory limits, error reporting.
    • Defines constants like TEMPLATE_DIR, SITE_DIR, SITE_PATH, and the $exclude_banner array.
  • Template fragments (located under TEMPLATE_DIR)
    • <template>_top.php – optional top-of-page overrides
    • <template>_meta.php – optional meta tags
    • <template>_content.php – main page content
  • inc/template_meta.php – core <meta> and CSS/JS includes
  • inc/panels/meta.php – shared head elements
  • inc/panels/header.php – site header
  • inc/panels/top_nav.php – main navigation bar
  • inc/panels/small_banner.php – promotional banner (conditionally included)
  • inc/panels/footer.php – site footer

Key Variables & Constants

  • TEMPLATE_DIR (string)
    Base filesystem path to template fragments
  • $current_template_name (string)
    Directory/name prefix for the active page template
  • $currnt_template (string)
    Filename (without extension) used to check banner exclusion
  • $exclude_banner (array)
    List of template names that should skip the small banner

File Inclusion Flow

flowchart TD
  A[Load inc/config.php] --> B{Exists <em>_top</em> fragment?}
  B -->|Yes| C[Include <em>_top.php</em>]
  B -->|No| D[Skip top fragment]
  C --> D
  D --> E[Output <!DOCTYPE> & <html> tags]
  E --> F[<head> Section]
  F --> G[Include template_meta.php]
  G --> H[Include panels/meta.php]
  H --> I{Exists <em>_meta</em> fragment?}
  I -->|Yes| J[Include <em>_meta.php</em>]
  I -->|No| K[Skip meta fragment]
  J --> L[Open <body> & wrapper]
  K --> L
  L --> M[Include panels/header.php]
  M --> N[Include panels/top_nav.php]
  N --> O[<div id="content-wrap">]
  O --> P{Template not in <em>$exclude_banner</em>?}
  P -->|Yes| Q[Include panels/small_banner.php]
  P -->|No| R[Skip banner]
  Q --> S[Include <em>_content.php</em>]
  R --> S
  S --> T[Include panels/footer.php]
  T --> U[Close wrapper & output dialog container]

Code Structure

1. Configuration & Top Fragment

<?php
include_once("inc/config.php");
if (file_exists(TEMPLATE_DIR . $current_template_name . "_top.php")) {
    include_once(TEMPLATE_DIR . $current_template_name . "_top.php");
}
?>
  • Loads environment and optional top‐of‐page override .

2. Head Section

<head>
  <?php
  include_once(TEMPLATE_DIR . "inc/template_meta.php");
  include_once("inc/panels/meta.php");
  if (file_exists(TEMPLATE_DIR . $current_template_name . "_meta.php")) {
      include_once(TEMPLATE_DIR . $current_template_name . "_meta.php");
  }
  ?>
</head>
  • Core meta tags and page-specific meta fragment.

3. Body & Wrapper

<body>
  <div id="wrapper">
    <?php include_once("inc/panels/header.php"); ?>
    <?php include_once("inc/panels/top_nav.php"); ?>
    <div id="content-wrap">
      <?php
      if (!in_array($currnt_template, $exclude_banner)) {
          include_once("inc/panels/small_banner.php");
      }
      ?>
      <?php include_once(TEMPLATE_DIR . $current_template_name . "_content.php"); ?>
    </div>
    <?php include_once("inc/panels/footer.php"); ?>
  </div>
  <div id="del-confirm-dialog" title=""></div>
</body>
</html>
  • Header, navigation, conditional banner, main content, and footer are injected in sequence.

Conditional Logic

  • Top fragment and meta fragment are only loaded if the corresponding file exists.
  • Small banner is skipped for templates listed in $exclude_banner, allowing pages like quotes or popups to remain uncluttered.
  • site_template.php
    A more recent variant with additional header-home logic.
  • contact_template.php
    Specialized layout for contact pages.

This template ensures a consistent look and feel across the entire application, simplifies maintenance of shared UI elements, and supports per‐page customizations via optional fragments.