File "title.php"
Full path: /home/u525140468/domains/productsizer.com/public_html/inc/title.php
File
size: 832 B (832 B bytes)
MIME-type: text/x-php
Charset: utf-8
Download Open Edit Advanced Editor Back
<?php
// title From Data File
// Get the current URL path
$request_uri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
// Extract the base filename (e.g., macro-calculator.php)
$url_filename = pathinfo(basename($request_uri), PATHINFO_FILENAME) . '.php';
// Load tools data
$tools_data = ['categories' => [], 'tools' => []];
if (file_exists(__DIR__ . '/../inc/data.tools.php')) {
$tools_data = include __DIR__ . '/../inc/data.tools.php';
}
// Find the matching tool
$tool = null;
foreach ($tools_data['tools'] as $t) {
if (trim($t['file']) === $url_filename) {
$tool = $t;
break;
}
}
// Set title and description
$title = $tool ? htmlspecialchars($tool['name']) : 'Tool Not Found';
$description = $tool ? htmlspecialchars($tool['desc']) : 'No description available.';