Move portfolio case studies to data-driven template system and archive old individual files

This commit is contained in:
Ovidiu U
2026-03-15 18:04:56 +00:00
parent ac917dbc0a
commit 28cd60a427
21 changed files with 1789 additions and 1188 deletions

31
LocalValetDriver.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
class LocalValetDriver extends \Valet\Drivers\BasicValetDriver
{
public function frontControllerPath(string $sitePath, string $siteName, string $uri): ?string
{
$path = trim(parse_url($uri, PHP_URL_PATH), '/');
// /portfolio → portfolio.php
if ($path === 'portfolio') {
return $this->servePhpFile($sitePath, '/portfolio.php');
}
// /portfolio/{slug} → portfolio-page.php?slug={slug}
if (preg_match('#^portfolio/([a-z0-9-]+)$#', $path, $m)) {
$_GET['slug'] = $m[1];
return $this->servePhpFile($sitePath, '/portfolio-page.php');
}
return parent::frontControllerPath($sitePath, $siteName, $uri);
}
private function servePhpFile(string $sitePath, string $file): string
{
$_SERVER['SCRIPT_FILENAME'] = $sitePath . $file;
$_SERVER['SCRIPT_NAME'] = $file;
$_SERVER['DOCUMENT_ROOT'] = $sitePath;
return $sitePath . $file;
}
}