-- etopian <[EMAIL PROTECTED]> wrote
(on Wednesday, 02 July 2008, 02:56 AM -0700):
> I'm trying to move some functions from older applications to my Zend
> Framework application. I assume I put these each in a seperate view helper?
> Besides that, I have this function:
>
> function findNumParents($id, $parents){
> $sql = "SELECT
> id,
> parent_id
> FROM
> cms_pages
> WHERE id=".$id;
> $fnp = fmsq($sql, true);
> $parents++;
> if($id == $fnp['id']){
> if($fnp['parent_id']){
> return findNumParents($fnp['parent_id'], $parents);
> }
> }
> return $parents;
> }
>
> My question is, how can I make the query to the database inside a View
> Helper? Or is that the wrong way to approach this?
This is a fine use case for a helper... and you do it just like you've
done above, only by wrapping the function as a class method in your
helper. Or am I missing something? Do you need help creating a helper?
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/