|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
eazytrader Smarty Rookie
Joined: 16 Jul 2010 Posts: 33
|
Posted: Wed Jul 16, 2014 7:46 am Post subject: Problem beim Cachen dynamischer Seiten |
|
|
Hallo Leute,
ich will meine Seiten Cachen.
Nun habe ich die Option aktiviert und das Verzeichnis angegeben, welches auch genutzt wird. Jedoch wird immer das gleiche Template angezeigt.
Z.b. rufe ich die Seiten so auf:
index.php?content=1
index.php?content=2
index.php?content=3
usw.
Im Template selber werden dann die INhalte dynamisch geladen.
Jetzt wird leider nur immer dieselbe Seite angezeigt.
Was mache ich falsch?
Gruß und Danke. |
|
Back to top |
|
Grizzly Smarty Pro
Joined: 15 Apr 2011 Posts: 172 Location: Germany
|
Posted: Wed Jul 16, 2014 9:35 am Post subject: |
|
|
Du musst einen anderen "CachingKey" nehmen.
Code: |
$content = $_GET["content"];
$cacheKey = "Content_".$content;
if(!$smarty->isCached("index.tpl", $cacheKey ))
{
//Hier den Dynamischen Inhalt "laden"
}
$smarty->display("index.tpl", $cacheKey);
|
Mit
Code: |
$smarty->clearCache("index.tpl", $cacheKey);
|
kannst du den Cache leeren.
ACHTUNG: Wenn du z. B. eine eigenes Template für die Top Navigation hast in dem auch immer der "aktuelle Seite markieren" gewählt wird oder ähnliches, musst ggf. in den jeweiligen Template vor dem laden folgendes machen:
Code: |
$smarty->caching = false;
|
und danach, wenn es gebraucht wird, wieder auf true. |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|