Forums Sign Up Reply Search Statistics
Fast Template GraFX Software Solutions - Forum / Fast Template /

Cache issue?

 
Author rr1024
Forums Member
#1 Posted: 19 Nov 2007 07:50:23
Reply 
I was playing around and checking out the sample cache cache_ex.php

here is what I set up
include "cls_fast_template.php";

$ft = new FastTemplate('./templates');

// CACHE will be used
$ft->CACHE_PATH = '/testing/fast_tpl/orgingal/temp';
$ft->setCacheTime(60);

It seams that the cache will not display until the 60 seconds is up, this seems to operate the total opposite what I thought it should.

If I try to refresh the page under 60 seconds I get the following error
Warning: FastTemplate::include(/home/public_html/testing/fa st_tpl/orgingal/temp/37335d923fbd6a40a718a326ecd6b 1c7
/home/public_html/testing/fast_tpl/orgingal/cls_fa st_template.php on line 1175

It seems it should be displaying the cache file 37335d923fbd6a40a718a326ecd6b1c7.ft which is present in the temp directory but it doesn't it tosses this error and only displays the cache once after the 60 seconds are up....it doesn't seem to make sence to me.

So I assume I'm not looking at this right or doing something wrong.
Author software
Admin
#2 Posted: 19 Nov 2007 08:34:02
Reply 
Please get http://fasttemplate.grafxsoftware.com/cls_fast_tem plate.zip and let us know if you still have same problem. This is 1.5.3 beta.
Author rr1024
Forums Member
#3 Posted: 19 Nov 2007 17:03:50
Reply 
I found the issue last night and thought I posted the answer but I guess not.

I fixed it with
Find
include $this->self_script();
Replace with
include $this->self_script().".ft";

I'm not sure if that is the correct way but is seem to work perfectly after that.
Author rr1024
Forums Member
#4 Posted: 19 Nov 2007 17:22:50
Reply 
I will check out the new beta release

Note another mod I made was to the directory for cache.

Most of the time coders like to be very consistant with how directories are specified.
I found it easier at least for me to always specify end slashes for a directory.
So rather than specifing ./tmp it would be ./tmp/ and as for set up I'd also prefer full path.
So I made the following modifications which seem to work well.

FIND
if (filemtime($dir."/".$fname) < $expired && $fname != "." && $fname != ".." && $ext[1]=="ft") {
@unlink($dir."/".$fname);
}
REPACE
if (filemtime($dir.$fname) < $expired && $fname != "." && $fname != ".." && $ext[1]=="ft") {
@unlink($dir.$fname);
}
FIND
return $_SERVER['DOCUMENT_ROOT'].$this->CACHE_PATH.'/'.ba sename($fname);
REPLACE
return $this->CACHE_PATH.basename($fname);

I think that is it and now
I specify the path to cache like so

in cache_ex.php

DEFINE('DIR_TEMPLATES', '/home/public_html/testing/fast_tpl/orgingal/templ ates/');

DEFINE('DIR_CACHE', '/home/public_html/testing/fast_tpl/orgingal/temp/ ');

Then
$ft = new FastTemplate(DIR_TEMPLATES);


$ft->CACHE_PATH = DIR_CACHE;
$ft->setCacheTime(CACHE_SETTIME); #Cache Duration, how long in seconds
$ft->USE_CACHE();

I was not sure if the templates needed similar changes because of the way it was specified orginally but I did not see anywhere in the script where you added a '/' to the template path and it seems to work as I did above.

So I'm not sure if the template part $ft = new FastTemplate(DIR_TEMPLATES); with DIR_TEMPLATES already ending in a slash is going to hurt something later on????
Author rr1024
Forums Member
#5 Posted: 19 Nov 2007 17:32:04
Reply 
Feed back on the beta version


I have the same issue on
include $this->self_script();

I fixed with

include $this->self_script().".ft";

If you haven't seen this problem then maybe it is something to do with server config??? Maybe consider testing with my mod to see if it works more generically???? don't know that much about server configs my self.
Author software
Admin
#6 Posted: 21 Nov 2007 12:20:59
Reply 
After you send to us the code cleaned up, we will compare it and see how can we do the release to not harm to anyone :-)
Author rr1024
Forums Member
#7 Posted: 21 Nov 2007 19:39:42
Reply 
I sent a copy to the admin address listed in your profile
Author software
Admin
#8 Posted: 22 Nov 2007 08:54:38
Reply 
It is OK, we received.
 
Your Reply

» Username  » Password 
Only registered users are allowed to post here. Please enter your login/password details upon posting a message, or sign up first.