Re: [Template] Design issues

From: Date: Fri, 11 Jun 2004 18:58:03 +0000
Subject: Re: [Template] Design issues
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-30518@lists.php.net to get a copy of this message
Another pestering question; is this part in output() done? // make the data available // this still needs some thought: // flexy uses an object to get around the rather nasty // issue of having to run extract. // - how to flag this up ? - compiler.uses_t (assigned by the compiler.. backend) $t = isset($this->options['compiler.uses_t']) && !$this->data['object']) ? new StdClass : false; if ($this->data['variables']) { if ($t !== false;) { $t = (object) $this->data['variables']; } extract($this->data['variables']); } if ($this->data['byref']) { foreach(array_keys($this->data['byref']) as $_k) { $$_k = &$this->$this->data['byref'][$_k]; if ($t !== false;) { $t->$k = &$this->$this->data['byref'][$_k]; } } } // make the object available as $t! if ($t === false && $this->data['object']) { $t = &$this->data['object'] } ...Becuase it seems to me that $t gets set regardless of whether or not compiler_uses_t. It also looks like vars and refs get extracted regarless of using $t or not. Obviously I don't understand what's going on here. Anyway, a little cleanup makes it more readable for dummies. // make the data available // this still needs some thought: // flexy uses an object to get around the rather nasty // issue of having to run extract. // - how to flag this up ? - compiler.uses_t (assigned by the compiler.. backend) if (isset($this->options['compiler.uses_t']) && ! $this->data['object']) { $t = new StdClass; } else { $t = false; } if ($this->data['variables']) { if ($t) { $t = (object) $this->data['variables']; } extract($this->data['variables']); } if ($this->data['byref']) { foreach(array_keys($this->data['byref']) as $_k) { $$_k = &$this->$this->data['byref'][$_k]; if ($t !== false;) { $t->$k = &$this->$this->data['byref'][$_k]; } } } // make the object available as $t! if (! $t && $this->data['object']) { $t = &$this->data['object'] } -- Paul M. Jones Savant: the simple alternative to Smarty for PHP. http://phpsavant.com/ DB_Table: build RDBMS tables and XHTML forms in one PHP class. http://wiki.ciaweb.net/yawiki/index.php?area=DB_Table Yawiki: a collaborative online documentation system. http://wiki.ciaweb.net/yawiki/index.php?area=Yawiki Yawp: a single-file foundation for PHP applications. http://phpyawp.com/

« previous php.pear.dev (#30518) next »