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

Cache Id & Cache Group

 
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 -> General
View previous topic :: View next topic  
Author Message
sean-prosper
Smarty Rookie


Joined: 22 Jul 2011
Posts: 8
Location: Vancouver, Canada

PostPosted: Fri Jul 22, 2011 8:23 am    Post subject: Cache Id & Cache Group Reply with quote

Hello everyone.

I am building a system with various forums, and each forum has a number of members. I got a file, named members.php, to show members in each forum.

I used
Code:
$tpl->display('members.html', $cache_id);

to output the page. The $cache_id is a combination of forum id, $_GET['fid'], and current page number, $_GET['page'].

My goal is to delete cache files (all pages) when a new member joins, so that a new members list will be pulled from database, then a new cache file will be generated in the next visit.

I don't know how to achieve this, the best I could find is using cache group. I am wondering if I shall store the $cache_id like this,
Code:
$cache_id = $_GET['fid'] . "|" . $_GET['page'];


I was testing on Windows, when the php engine ran the code, it returned the following errors,

Warning: rename(F:\wamp\www\Tpl\_Compile\wrtE131.tmp,./Tpl/_Compile/1|1^47aa54bb39f6e5fd67ad0a1fe8a321b5d5e8ec64.file.Members.html.cache.php) [function.rename]: The filename, directory name, or volume label syntax is incorrect. (code: 123) in F:\wamp\www\Common\Class\sysplugins\smarty_internal_write_file.php on line 48

Warning: chmod() [function.chmod]: No such file or directory in F:\wamp\www\Common\Class\sysplugins\smarty_internal_write_file.php on line 50

I realized that Windows wouldn't allow "|" symbol in its filename. Is this an issue?


Lastly about deleting cache files, the documentation says when I delete cache files from cache group, I should leave the first param, template name, blank. I don't know why how smarty finds the right file.

Please help me out. Thank you very much.
Back to top
View user's profile Send private message
ChrisFah
Smarty Pro


Joined: 02 Nov 2009
Posts: 159
Location: Traun, Austria

PostPosted: Fri Jul 22, 2011 9:12 am    Post subject: Reply with quote

Hi,

have a look at the file path:
Code:
F:\wamp\www\Tpl\_Compile\wrtE131.tmp,./Tpl/_Compile/1|1^47aa54bb39f6e5fd67ad0a1fe8a321b5d5e8ec64.file.Members.html.cache.php


the directroty name \wrtE131.tmp,./ seems not be ok. Maybe a typo i your filepath...

Regards, Chris
Back to top
View user's profile Send private message
sean-prosper
Smarty Rookie


Joined: 22 Jul 2011
Posts: 8
Location: Vancouver, Canada

PostPosted: Fri Jul 22, 2011 9:20 am    Post subject: Reply with quote

ChrisFah wrote:
Hi,

have a look at the file path:
Code:
F:\wamp\www\Tpl\_Compile\wrtE131.tmp,./Tpl/_Compile/1|1^47aa54bb39f6e5fd67ad0a1fe8a321b5d5e8ec64.file.Members.html.cache.php


the directroty name \wrtE131.tmp,./ seems not be ok. Maybe a typo i your filepath...

Regards, Chris


Hello Chris,
The error code was generated by Apache, I just copied it.
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Fri Jul 22, 2011 9:33 am    Post subject: Reply with quote

actually it was generated by PHP. But that's beside the point. Which Version are you using and have you run Smarty::testInstall()?

looking at your filepaths, you may want to enable subdirs: $smary->use_sub_dirs = true;
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
sean-prosper
Smarty Rookie


Joined: 22 Jul 2011
Posts: 8
Location: Vancouver, Canada

PostPosted: Fri Jul 22, 2011 10:14 am    Post subject: Reply with quote

globe wrote:
actually it was generated by PHP. But that's beside the point. Which Version are you using and have you run Smarty::testInstall()?

looking at your filepaths, you may want to enable subdirs: $smary->use_sub_dirs = true;


Thanks for you reply.

The version I am using is 3.0.8. I guess that is a stable release.

And I have run testInstall(), all directories were tested OK.

After I turned on use_sub_dirs, it seems that a new warning appeared before the two.

Thanks again.
Back to top
View user's profile Send private message
rodneyrehm
Administrator


Joined: 30 Mar 2007
Posts: 674
Location: Germany, border to Switzerland

PostPosted: Fri Jul 22, 2011 10:16 am    Post subject: Reply with quote

… and what would that warning be?
what's your smarty setup? (just copy your code…)
_________________
Twitter
Back to top
View user's profile Send private message Visit poster's website
sean-prosper
Smarty Rookie


Joined: 22 Jul 2011
Posts: 8
Location: Vancouver, Canada

PostPosted: Fri Jul 22, 2011 10:25 am    Post subject: Reply with quote

globe wrote:
… and what would that warning be?
what's your smarty setup? (just copy your code…)


I've figured out the problem. It was because the new class that extends from the original Smarty class.

Thanks for your help. Very Happy
Back to top
View user's profile Send private message
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 -> General 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