views:

347

answers:

2

Lets assume the following code within a controller:

$this->view->addScriptPath('dir1/views/scripts');
$this->view->addScriptPath('dir2/views/scripts');
$this->render('index.phtml');

Where dir1/views/scripts contains 2 files:

-index.phtml  
-table.phtml

And dir2/views/scripts:

-table.phtml

Now, it will render the index.phtml in dir1 since dir 2 doesn't have an index.phtml.

Index.phtml looks something like:

<somehtml>
       <?= $this->render('table.phtml') ?>
</somehtml>

This is where the confusion starts for me. I would expect it to render the table.phtml in the last directory added to the script path stack, but it doesn't.
Is there a simple solution/explanation to my problem?

+1  A: 

Seems that paths are used in LIFO order.

Take a look at viewRednderer and view source files to see how does it work.

takeshin
A: 

u can use

> $this->view->setBasePath("../application/dir1/views");

that is more specific

S.Hawary