milov.nl

Interaction design • webdevelopment • web art • photography

November 2002

"funky caching" is what I usually try to do too on templated php-powered sites; generating static pages on access rather than on saving of data simply makes a lot more sense once you're used to it.

Although the concept of using a custom 404 php-script hadn't occured to me yet: checking if the appropriate static copy exists and the optional generating occurs in one main index.php. [via kryogenix.org]



poi wrote on 2002/11/25:
Great idea.
If the amount of user types is reasonably low "funky caching" could even provide a certain "baked page" according to the rights of the user. And only "fried pages" to the Administrators.


milov wrote on 2002/11/25:
What I do is I check all parameters that might influence the output of a script (entry, date, tmpl, logged-in-status etc.), combine them into a unique filename, and then check if a static copy with that filename exists; if not, generate it.


poi wrote on 2002/11/25:
I rather had in mind to keep the filename simple and to store the variants of the static pages in seperated folders and then simply readfile() the right static page if you don't want to show your "funky folders name" to the users.
But basically that's the idea, and it's simple, elegant and efficient, I LOVE it.


milov wrote on 2002/11/25:
Oh definitely. This filename that I'm generating stays hidden to the user... you don't want to uglify your urls too much. For example, the hidden filename for this page is milov_php2070780107_tmpl1036941578_login1_comments1782.txt
(also taking into account the lastmodified date of php-scripts and templates).


milov wrote on 2002/11/25:
or milov_php2070780107_tmpl1036941578_login0_comments1782.txt for you :)


Tim wrote on 2003/01/20:
don't overlook another awesome aspect to this hack that I use all the time in Vignette based site - it's called OID overstuffing - basically, you stuff parameters into the url BEFORE the .html or whatever your extension is. Use something like | or @ to separate the variables. Then your template does a split on the special character. So a url might end like this "/weather_framework@worldview@rome.html" This way you get a docroot full of generated files that can be fully cached, and still pass multiple parameters to the template.


Prohor wrote on 2006/10/09:
Hello+people%21+Nice+site%21+


Katie wrote on 2006/10/09:
Very cool design! Useful information. Go on!u