Added getPath function

This commit is contained in:
Conner Harkness 2025-08-05 08:27:49 -06:00
parent 6c4237ec9b
commit cc5474ef80
2 changed files with 44 additions and 30 deletions

View File

@ -65,6 +65,9 @@
$varMimeTypes = array(
array("/\.css$/", "text/css"),
array("/\.js$/", "application/javascript"),
array("/\.png$/", "image/png"),
array("/\.jpg$/", "image/jpeg"),
array("/\.jpeg$/", "image/jpeg"),
);
foreach ($varMimeTypes as $varMimeType)
@ -126,45 +129,49 @@
requireAll("init.php");
?>
<!DOCTYPE html>
<html>
<head>
<?php requireAll("head.php"); ?>
</head>
<body>
<div class="app-header">
<?php requireAll("header.php"); ?>
</div>
<body data-path="<?= Request::getPath(); ?>">
<div class="app">
<div class="app-header">
<?php requireAll("header.php"); ?>
</div>
<div class="app-body">
<?php
try
{
require Request::getScript();
}
catch (Exception $x)
{
ob_clean();
header("Content-Type: text/plain");
$strMessage = $x->getMessage();
echo $strMessage;
echo "\n\n";
<div class="app-body">
<?php
try
{
require Request::getScript();
}
catch (Exception $x)
{
ob_clean();
header("Content-Type: text/plain");
$strMessage = $x->getMessage();
echo $strMessage;
echo "\n\n";
$strFile = $x->getFile();
$intLine = $x->getLine();
echo "#-1 {$strFile}({$intLine}): {$strMessage}\n";
echo $x->getTraceAsString();
$strFile = $x->getFile();
$intLine = $x->getLine();
echo "#-1 {$strFile}({$intLine}): {$strMessage}\n";
echo $x->getTraceAsString();
ob_end_flush();
exit;
}
?>
</div>
ob_end_flush();
exit;
}
?>
</div>
<div class="app-footer">
<?php requireAll("footer.php"); ?>
<div class="app-footer">
<?php requireAll("footer.php"); ?>
</div>
</div>
</body>
</html>

View File

@ -98,6 +98,13 @@
return Request::$varPathParts;
}
public static function getPath()
{
$strPath = "/";
$strPath .= implode("/", Request::getPathParts());
return $strPath;
}
// Safely returns a request argument by its index or null if it doesn't exist (without error)
public static function getArg($intIndex)
{