Nginx config example and relative path
This commit is contained in:
parent
3dd723309d
commit
477efe8486
3 changed files with 34 additions and 5 deletions
10
index.php
10
index.php
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue