Popup Template (popup_template.php) π
This popup template serves as a lightweight wrapper for rendering standalone popup pages across the Logistics portal. It handles configuration, metadata, and content inclusion without the full site chrome.
Purpose
- Provide a minimal HTML skeleton for popup dialogs.
- Load global configuration and assets.
- Inject template-specific header, meta tags, and content.
- Keep popups consistent and maintainable.
High-Level Flow
- Bootstrap Configuration: Load
inc/config.phpfor constants and environment setup. - Optional Header: If a template-specific βtopβ file exists, include it.
- Metadata & Assets: Delegate meta tags, CSS, and JS declarations to
inc/template_meta.php. - Optional Meta Overrides: Include template-specific meta definitions if present.
- Content Injection: Load the templateβs content file into the popup body.
Integration with Routing βοΈ
The routing logic directs certain pages into this popup wrapper. For example, in linuxfront-v2-logistics/28-11-2012_route.php, the router includes popups for NMFC and freight-class help pages:
// If the requested page matches one of the help popups:
if (in_array($currnt_file_name, ['nmfc_no_help.php', 'freight_class_help.php', 'shippment_detail.php'])) {
include_once("popup_template.php");
} else {
include_once("site_template.php");
}
This ensures help pages load inside a modal context .
Included Files & Responsibilities
| Include Path | Responsibility |
|---|---|
inc/config.php |
Start session; define TEMPLATE_DIR, SITE_DIR, and other constants |
TEMPLATE_DIR . "{$name}_top.php" |
Optional template header (e.g., nav, banner) |
inc/template_meta.php |
Emit <meta>, <title>, <link> and <script> tags |
TEMPLATE_DIR . "{$name}_meta.php" |
Optional per-template meta tag overrides |
TEMPLATE_DIR . "{$name}_content.php" |
Main HTML content for the popup |
Core Template Code
<?php
// Load global settings and constants
include_once("inc/config.php");
// Include template-specific header if available
if (file_exists(TEMPLATE_DIR . $current_template_name . "_top.php")) {
include_once(TEMPLATE_DIR . $current_template_name . "_top.php");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php
// Emit global meta, CSS, and JS
include_once(TEMPLATE_DIR . "inc/template_meta.php");
// Optional meta overrides
if (file_exists(TEMPLATE_DIR . $current_template_name . "_meta.php")) {
include_once(TEMPLATE_DIR . $current_template_name . "_meta.php");
}
?>
</head>
<body class="popup_body">
<div id="popup-wrapper">
<div id="popup-content-wrap">
<?php
// Inject the popup's main content
include_once(TEMPLATE_DIR . $current_template_name . "_content.php");
?>
</div>
</div>
</body>
</html>
β popup template skeleton
Key Constants & Paths
- TEMPLATE_DIR: Base directory for reusable template snippets.
- SITE_DIR: Root directory of the application.
- $current_template_name: Derived at runtime based on the requested filename.
Developers add new popup content by creating:
- A content file:
my_popup_content.php - Optionally, meta overrides:
my_popup_content_meta.php - Optionally, header layout:
my_popup_content_top.php
The router automatically wraps these in popup_template.php.
This design keeps popups self-contained and leverages shared configuration and asset management for consistency.