Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

output the rowcount in the volt view

I am doing the following and wanted to output the rowcount in the volt view file, can someone help me with an example.

$robots = $robots::find(); $result = $robots->rowCount();

Am I doing it correctly, please let me know and if yes, I am always getting an error if I try to use any of these in the volt with {{ result }} or with {{robots |length}}, the error is undefined variable. Please help someone.



66.1k
Accepted
answer

you have to pass it to the view from your controller like so

$this->view->result = Robots::find();

Can you be more specific, I am unable to understand. I would really appreciate if you can do an example. I am sorry I am a newbie to phalcon and wanted to learn it.

you have to pass it to the view from your controller like so

```php $this->view->result = Robots::find(); ```

can you show us your controller and volt code so we can show you where the problem is?

edited Nov '15

thank you so much, your answer did helped me over coming the issue that I was facing. I was not passing it to the view like you mentioned and hence getting that error.