We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Picking Views doc

Hi all, I'm a noob here, and reading the doc. Just need a clarification about a doc: https://docs.phalcon.io/en/latest/reference/views.html#picking-views

<?php

class ProductsController extends \Phalcon\Mvc\Controller
{

    public function listAction()
    {
        // Pick "views-dir/products/search" as view to render
        $this->view->pick("products/search");

        // Pick "views-dir/products/list" as view to render
        $this->view->pick(array('products'));

        // Pick "views-dir/products/list" as view to render
        $this->view->pick(array(1 => 'search'));
    }

}

All the comments are refer to "views-dir/products/list". Is this correct?



98.9k

I think it must be:

<?php

class ProductsController extends \Phalcon\Mvc\Controller
{

    public function listAction()
    {
        // Pick "views-dir/products/search" as view to render
        $this->view->pick("products/search");

        // Pick "views-dir/books/list" as view to render
        $this->view->pick(array('books'));

        // Pick "views-dir/products/search" as view to render
        $this->view->pick(array(1 => 'search'));
    }

}


934

Cool. Then it needs a fix.

Thx, mate