Search code examples
phpzend-frameworkpaginationzend-view

Zend Paginator can't find view file


I have extended the Zend paginator so I can use it in my own service layer. The issue is getting it to display in my view. (My admin page is not in a view/script folder but in a some legacy code in public - don't ask lol). I have got an instance of view from the bootstrap and I am trying to display the paginator.

Fatal error: Uncaught exception 'Zend_View_Exception' with message 'no view script directory set; unable to determine location for view script' in /usr/share/php/Zend/View/Abstract.php:973

$adapter = new Think_Paginator_Adapter_ServiceQuery($logging, 'getAllActions');
    $paginator = new Zend_Paginator($adapter);
<table>
<?php foreach($paginator as $data){ ?>
                    <tr>
                    <td><?php echo $data->adminId ?></td>
                    <td><?php echo $data->lastName ?></td>
                    <td><?php echo $data->firstName ?></td>
                    <td><?php echo $data->loanId ?></td>
                    <td><?php echo $data->createTimestamp ?></td>
                    <td><?php echo $data->action ?></td>
                    </tr>    
                <?php } ?>
                    <?php 
                   echo $view->paginationControl($paginator,
                                    'Sliding',
                                    'pagination.phtml');
                   ?>
                </table>

Any idea why it's not finding my pagination.phtml in the view/scripts dir?

Thanks


Solution

  • It's not a problem with paginator the application is not finding the default script paths, maybe try

    $view->addScriptPath('PATH');

    or

    $view->setScriptPath('PATH').

    You may have broken something in the bootstrap.