Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

Dynamisches Caching

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German
View previous topic :: View next topic  
Author Message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Wed Feb 27, 2013 8:44 am    Post subject: Dynamisches Caching Reply with quote

Hallo,

ich habe vor meine Daten zu cachen, das Problem ist allerdings, dass "zu viel" gecached wird. Bei mir wird nun auf jeder Seite das selbe angezeigt. Ich möchte allerdings dass der Inhalt (der sich ja von page zu page ändert) immer neu geholt wird.

Im Grunde möchte ich dass alles bis auf dieses eine Template gecached wird, da dort der Inhalt immer wieder neu geholt werden soll. Mit clearCache hat das leider nicht funktioniert. Was kann ich dagegen machen?
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Feb 27, 2013 10:33 am    Post subject: Reply with quote

Handelt es sich um ein Subtemplate das nicht gecached werden soll?

Dann kannst Du das mit {include file=... nocache} erreichen.
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Wed Feb 27, 2013 10:49 am    Post subject: Reply with quote

Das schon, allerdings rufe ich die "anzuzeigenden" templates meist über ein selbstgeschriebenes PlugIn auf. Dieses Plugin erstellt eine neue Instance des controls und ruft die Methode Show() auf. Dort wird dann über Smarty->display() das template gerendert.
Back to top
View user's profile Send private message Visit poster's website
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 5068
Location: Hamburg / Germany

PostPosted: Wed Feb 27, 2013 12:05 pm    Post subject: Reply with quote

Dann setze doch $smarty->caching = false; für das Template was nicht gecached werden soll.
Back to top
View user's profile Send private message
Grizzly
Smarty Pro


Joined: 15 Apr 2011
Posts: 172
Location: Germany

PostPosted: Wed Feb 27, 2013 12:36 pm    Post subject: Reply with quote

Das ist aber leider ein singleton Smarty-Objekt

EDIT:

Ich habe gerade festgestellt, dass es wohl trotzdem funktioniert! Danke

EDIT 2:

ich habe allerdings jetzt einen komischen Fehler. Bei mir unter Xampp läuft es nun super. Es wird gecached. Im Cache-Ordner gibts es nun z. B. eine Datei in der das HTML ausgegeben wurde (Smarty-Variablen wurden dann durch Inhalt ersetzt z. B. {$test->hello} ==> "<div>Hallo das ist mein test</div>")

Kopiere ich das auf meinen Server, wird ebenfalls gechached. Im Cache-Ordner ist auch eine Datei, in dieser steht allerdings sowas hier:

Code:
<?php echo $_smarty_tpl->getVariable('test')->value->hello;?>


Was beim zweiten Laden der Page dazu führt, dass ein "Trying to get property of non-object" fehler kommt. Was mache ich falsch?

EDIT 3:

Okay, es ich hab den Fehler, ich habe nun im "template_c"-Ordner alle Dateien gelöscht und nun gehts
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: German All times are GMT
Page 1 of 1

 
Jump to:  
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
Protected by Anti-Spam ACP