Zmena cesty pre sablony – nefunguje
- Raiper34
- Člen | 65
Zdar, mam taky problem, potrebujem pre niektore presentery zmenit cestu sablony, mam x presenterov pre administraicu a tie beru svoje sablony zo zlozky templates, to sa mi podarilo zmenit, urobil som base presenter, od ktoreho vsetky dedia. Ale teraz ptorebujem zmenit cestu k sablony pre to co vidi uzivatel, to chcem mat v zlozke themes, ale nechapem preco, aj ked nededim z presenteru a nastavujem cestu k sablonam v danom presentere, tak to stale bere zo zlozky templates, nechapem ale preco, pretoze to nebere z tej default nette, ale tej mojje nastavenej co som nastavoval pre administraciu… Ked zmenit cestu v base presentere pre administraciu, tak stale to funguje, aj ked by podla spravnosti nemalo najst… Skusal som aj cache premazat ako prehliadacu, tak aj nette, ale nepomohlo…
public function formatLayoutTemplateFiles()
{
$layoutFiles = parent::formatLayoutTemplateFiles();
$dir = dirname($this->getReflection()->getFileName());
$layoutFiles[] = "$dir/../themes/@layout.latte";
return $layoutFiles;
}
- David Matějka
- Moderator | 6445
nette pouzije prvni existujici sablonu z toho pole
$layoutFiles
. takze tu tvou dej na zacatek pole.
- David Matějka
- Moderator | 6445
a mas spravne cestu? file_exists("$dir/../themes/@layout.latte")
ukaze co?
btw, v tomhle pripade to asi nebude problem, ale
$layoutFiles[0]
ti nezajisti, ze ten prvek bude na prvnim miste.
jistejsi je pouzit
array_unshift($layoutFiles, "$dir/../themes/@layout.latte");
- Raiper34
- Člen | 65
Takze moja funkcia
public function formatLayoutTemplateFiles()
{
$layoutFiles = parent::formatLayoutTemplateFiles();
$dir = dirname($this->getReflection()->getFileName());
//$layoutFiles[] = realpath("$dir/../themes/@layout.latte");
//array_unshift($layoutFiles, realpath("$dir/../themes/Page/default.latte"));
array_unshift($layoutFiles, realpath("$dir/../themes/@layout.latte"));
\Tracy\Debugger::barDump($layoutFiles);
return $layoutFiles;
}
Ladenka vypisuje
array (4)
0 => "/opt/lampp/htdocs/Raiper-CMS/app/themes/@layout.latte" (53)
1 => "/opt/lampp/htdocs/Raiper-CMS/app/templates/Page/@layout.latte" (61)
2 => "/opt/lampp/htdocs/Raiper-CMS/app/templates/Page.@layout.latte" (61)
3 => "/opt/lampp/htdocs/Raiper-CMS/app/templates/@layout.latte" (56)
Ale stale to hlada tu Page v priecinku templates a nie themes… Uz fakt neviem, skusal som tam dat natvrdo aj cestu pre themes/Page/default.latte ale nic…
- David Matějka
- Moderator | 6445
ale vis, ze tady jen resis cestu pro layout a ne pro jednotlive sablony presenteru? k tomu slouzi metoda formatTemplateFiles
- David Matějka
- Moderator | 6445
a co vraci
file_exists('/opt/lampp/htdocs/Raiper-CMS/app/themes/@layout.latte')
?