Nginx config example and relative path

This commit is contained in:
Pablo Ferreiro 2022-01-03 14:32:35 +01:00
parent 3dd723309d
commit 477efe8486
No known key found for this signature in database
GPG key ID: 41FBCE65B779FA24
3 changed files with 34 additions and 5 deletions

View file

@ -9,7 +9,7 @@ $dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
function getSubdir(): string {
return $_ENV['APP_SUBDIR'] ? $_ENV['APP_SUBDIR'] : '/';
return $_ENV['APP_SUBDIR'] ? $_ENV['APP_SUBDIR'] : '';
}
function getApi(array $proxy_elements): \Sovit\TikTok\Api {
@ -25,13 +25,17 @@ function getApi(array $proxy_elements): \Sovit\TikTok\Api {
}
function getLatte(): \Latte\Engine {
$subdir = getSubdir();
$latte = new Latte\Engine;
$latte->setTempDirectory('./cache/views');
$latte->addFunction('assets', function (string $name, string $type) {
$subdir = getSubdir();
$latte->addFunction('assets', function (string $name, string $type) use ($subdir) {
$path = "{$subdir}/{$type}/{$name}";
return $path;
});
$latte->addFunction('path', function (string $name) use ($subdir) {
$path = "{$subdir}/{$name}";
return $path;
});
return $latte;
}