Re: [PRES] cvs: pres2 / show.php

From: Date: Thu, 07 Nov 2002 07:16:04 +0000
Subject: Re: [PRES] cvs: pres2 / show.php
References: 1  Groups: php.pres 
Request: Send a blank email to pres+get-498@lists.php.net to get a copy of this message
Rasmus Lerdorf wrote:
+ // Determine if we should cache + $cache_ok = 1; + foreach($objs as $obj) { + if(is_a($obj, '_example')) { + if(strtolower($obj->type) == 'php') { + $cache_ok = 0; + } + } + } + reset($objs); // shouldn't be necessary, but is
I don't think that $obj->type == php check is appropriate here. You don't want to cache if type is system either, for example. But if $object->result is false, then you might be able to cache. Of course if the example code is loaded in from an external file and $obj->hide is false then you'd need to check that external file for a timestamp. I think in the end you might as well just turn off caching if there is an example tag at all. OK, I'll make the changes accordingly. BTW, the array pointer seems to be moved (without the reset(), the each() that follows doesn't do anything, however, the documentation says that the foreach() is supposed to operate on a copy of the array and *not* modify the array pointer?
Is the documentation out of date, or is this a bug? .l -- .leonard http://randomfoo.net/

« previous php.pres (#498) next »