Possible to turn off cache on a particular page?

Possible to turn off cache on a particular page?

Postby Mischa on Wed Aug 07, 2013 6:30 am

I am having trouble with a page.
The page works after cleaning up cache one time only. Reloading that page (by me or somebody else in the world), gives the infamous:
Code: Select all
Fatal error: Call to a member function parse() on a non-object in .../tmp/1/%%93^93B^93B41C19%%avfall.template.inc on line 12


I think turning off cache on that particular page would solve the issue.
Any way I can turn off cache on a particular page (e.g. in that page's template file)?
Using lifetype-1.2.12 pretty standard config
Mischa
 
Posts: 39
Joined: Fri Jun 20, 2008 9:27 am
Location: Åland Islands
LifeType Version: 1.2.12

Re: Possible to turn off cache on a particular page?

Postby jondaley on Wed Aug 07, 2013 10:17 am

What is on that page, and why do you call it "infamous"? I have not seen this bug before, I think.
The only "bug" I know about with regard to caching is if you use plugins inside of {dynamic} tags, which doesn't work at all.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Possible to turn off cache on a particular page?

Postby Mischa on Wed Aug 07, 2013 11:30 am

Apart from header/panel/footer, there is a dynamic code that gets and parses google news items in rss form, like this:
Code: Select all
{dynamic}
   {if $rss->parse("http://news.google.se/news?pz=1&cf=all&ned=sv_se&hl=sv&q=djurpl%C3%A5geri&as_qdr=d&as_qdr=d&as_drrb=q&cf=all&scoring=n&output=rss")}   
    {assign var=channel value=$rss->getChannel()}
    <h3>{$channel->getTitle()}</h3>
    <p>{$channel->getDescription()}</p>
    <ul style="list-style: none;">
     {foreach from=$rss->getItems() item=rssItem}
     <li>
      <a href="{$rssItem->getLink()}" target="_blank">{$rssItem->getTitle()}</a><br/>
       {$rssItem->getDescription()}
     </li>
    {/foreach}
    </ul>
  {/if}
{/dynamic}

I don't think I am using a plugin, in the above.
Using lifetype-1.2.12 pretty standard config
Mischa
 
Posts: 39
Joined: Fri Jun 20, 2008 9:27 am
Location: Åland Islands
LifeType Version: 1.2.12

Re: Possible to turn off cache on a particular page?

Postby jondaley on Tue Aug 13, 2013 5:21 pm

Ah, I see. The $rss object isn't loaded either. You could modify that in view/blogview.class.php and change render() so that the rss object is loaded below the if(!cached){...} statement, so then it is always loaded.

I've wondered if there is a good way to automatically figure out what stuff is needed inside of the {dynamic} tag and then just load those relevant parts.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch

Re: Possible to turn off cache on a particular page?

Postby Mischa on Wed Aug 14, 2013 11:06 am

jondaley wrote:Ah, I see. The $rss object isn't loaded either. You could modify that in view/blogview.class.php and change render() so that the rss object is loaded below the if(!cached){...} statement, so then it is always loaded.

Great!
Check it here, it now loads uncached: Link

I moved these two lines, in class/view/blogview.class.php:
Code: Select all
lt_include( PLOG_CLASS_PATH.'class/xml/rssparser/rssparser.class.php' );
$this->setValue( 'rss', new RssParser());
and put them below this line:
Code: Select all
// these things can go in since they do not mean much overhead when generating the view...
Last edited by Mischa on Thu Aug 15, 2013 7:34 am, edited 1 time in total.
Using lifetype-1.2.12 pretty standard config
Mischa
 
Posts: 39
Joined: Fri Jun 20, 2008 9:27 am
Location: Åland Islands
LifeType Version: 1.2.12

Re: Possible to turn off cache on a particular page?

Postby Mischa on Wed Aug 14, 2013 12:01 pm

But it would still be a good thing to do, at times - Turning off cache on a page-by-page basis.
Is this possible?
Using lifetype-1.2.12 pretty standard config
Mischa
 
Posts: 39
Joined: Fri Jun 20, 2008 9:27 am
Location: Åland Islands
LifeType Version: 1.2.12

Re: Possible to turn off cache on a particular page?

Postby jondaley on Tue Aug 20, 2013 6:32 pm

Sorry - I was on vacation last week.
Yes, you moved the code correctly.

Yes, that might be interesting, to have some pages that never cache. I wonder what the best user interface is for that - list certain URLs? Or maybe specify particular template files? I'd have to think about where it makes sense in the classes, when it goes to pick between a "uncached" template and a "cached" template.
jondaley
Lifetype Expert
 
Posts: 6169
Joined: Thu May 20, 2004 6:19 pm
Location: Pittsburgh, PA, USA
LifeType Version: 1.2.11 devel branch


Return to Other Problems

cron