Partials have their own local variable scope so wat u can do is define local variables in the partial and instead of passing a rowset object pass an array of key value pairs as the second parameter to the partialLoop, the keys will be the local variable names, this allows you to standardise the partial and re-use else where just by passing an array.

Dan

On 12 Dec 2009, at 22:28, Stephenalistoun <[email protected]> wrote:


Hey all,

I'm wanting to use a partial for a list, to be able to read my columns names automatically instead of me manually saying which columns must be read for
example $this->strTitle,$this->strLastUser etc.
So that i can use one partial.

Is there a way of doing this?

//index.pthml
$this->partialLoop()->setObjectKey('model');

echo $this->partialLoop('partials/userRow.phtml' ,$this->title );

//View Partial
<tr>
  <td>
  </td>
  <td>
       "/ZendCasts/public/index/create/<?php echo $this- TitleID;
?>"><?php echo $this->strTitle; ?>
  </td>
  <td>
      <?php echo $this->strLastUser; ?>
  </td>
  <td>
      <?php echo $this->strLastEdit; ?>
  </td>
  <td>
      <?php echo 'Edit' ?>
  </td>
  <td>
"/ZendCasts/public/index/delete/<?php echo $this- TitleID; ? >">Del
  </td>
</tr>





--
View this message in context: 
http://n4.nabble.com/Zend-Partials-tp962726p962726.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to