RE: [PEAR-DEV] yet another template
| From: | Naoki Shima | Date: | Wed, 07 Nov 2001 19:48:37 +0000 |
| Subject: | RE: [PEAR-DEV] yet another template | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-2622@lists.php.net to get a copy of this message | ||
Hello Wolfram,
>that would mean what i had written before was not entirely correct
> $tpl['blockname']['value'] = $string;
>OR
> $tpl['blockname'] [ ] ['value'] = $string;
>could be the right syntax depending if the block is meant as a loop,
>which mostly is the case
I strongly believe that I shouldn't allow directly accessing variable, array
or object inside the object.
Instead, they should be accessed by method of the object.
This way, change in how data is stored won't affect your script unless I
keep the same API.
>$res = $db->getAll( "SELECT col1,col2,col3 FROM table" );
>$tpl['block1'] = $res;
Also, unless the class relies on some database abstraction layer, database
resource cannot be passed
to the object because there is no internal database abstruction in PHP.
The reason why my template class doesn't support PEAR::DB is that I didn't
have time to do it.
Best regards,
Naoki Shima