RE: new snapshot - new fetch functionality

From: Date: Thu, 14 Mar 2002 16:17:36 +0000
Subject: RE: new snapshot - new fetch functionality
References: 1 2  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-3058@lists.php.net to get a copy of this message
Ok, here's the deal with caching the fetched content. If you turn caching on in Smarty, the fetched content will be cached with the rest of the page. The problem arises when you want make the fetched content cached independent of Smarty's built-in cache, such as the example of weather. Maybe the Smarty cache is set for an hour, but you want the weather updated every 15 minutes. This can already be accomplished with an {insert} function, (which is how we did it): {insert name=fetch file=$url cache_lifetime=300} Currently, the {insert} tag is the only tag exempt from Smarty's cache. Ideally it would be nice to have any function independently cachable, which currently isn't possible. Hmm, it might be feasible to "cheat" by a built-in cache wrapper function: {cache function="fetch" lifetime="300" file=$url ...} This way you could cache any function independently. Other ideas: {cache lifetime=300} This part of the page is not cached! {func1 ...} {func2 ...} blah {$blah} {/cache} I'll ponder these thoughts for a bit, see what is feasible ;-) Monte Monte Ohrt wrote: > > Actually we already have that routine written for a client, I'll look it > up. They fetch the weather but don't want it fetched on every hit, just > every 30 minutes. > > Jimmy Harlindong wrote: > > > > Oh yes that would be much cleaner, I agree. > > > > OK here's another idea.... can the fetch be cached, and say either > > refresh the fetch only when there's new document (using http expire or > > date?) or only refetch at a certain time and at other time use the > > cache? It'd be useful if I want to fetch a news site say every 3 hours > > or every 9 am in the morning (barring any time difference) > > > > I think I can write the extraction routine as a custom function or > > better yet if the *extracted* data can be cached as well.... oh well > > ideas ideas :) > > > > cheers > > > > > -----Original Message----- > > > From: Monte Ohrt [mailto:monte@ispi.net] > > > Sent: Thursday, 14 March 2002 1:03 PM > > > To: Jimmy Harlindong > > > Cc: smarty@lists.ispi.net > > > Subject: Re: [smarty] RE: new snapshot - new fetch functionality > > > > > > > > > like what? strip out the links, or strip out the html tags? > > > > > > Maybe that should be another function or modifier, so you can > > > use it for > > > any text. > > > > > > {fetch file=$url assign="contents"} > > > > > > {$contents|extract_links} > > > {$contents|strip_html_tags} > > > > > > Jimmy Harlindong wrote: > > > > > > > > Monte, > > > > > > > > This is great, and maybe you can also add the function to > > > let us filter > > > > / extract certain parts of the fetched document too? > > > > > > > > Cheers > > > > Jimmy > > --- > You are currently subscribed to smarty as: monte@ispi.net > To unsubscribe send a blank email to $subst('Email.Unsub') > Visit Smarty's homepage at > http://www.phpinsider.com/php/code/Smarty/ -- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.

« previous php.smarty.general (#3058) next »