Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6089007
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T12:03:02+00:00 2026-05-23T12:03:02+00:00

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

  • 0

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 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T12:03:02+00:00Added an answer on May 23, 2026 at 12:03 pm

    I ended up extending Zend_View and adding the function renderParent:

    class My_View extends Zend_View
    {
        private $_file = null;
    
        private $_name = null;
    
        /**
         * Finds a view script from the available directories.
         *
         * @param $name string The base name of the script.
         * @return void
         */
        protected function _script($name)
        {
            $this->_file = parent::_script($name);
            $this->_name = $name;
    
            return $this->_file;
        }
    
        /**
         * Renders the parent script by looping through all the script paths.
         *
         * @return void
         */
        public function renderParent()
        {
            $scriptPaths = $this->getScriptPaths();
    
            $found = false;
            for ($i = 0; $i < count($scriptPaths); $i++) {
                if ($this->_file == $scriptPaths[$i] . $this->_name) {
                    $found = true;
                } elseif ($found) {
                    if (is_readable($scriptPaths[$i] . $this->_name)) {
                        return $this->_run($scriptPaths[$i] . $this->_name);
                    }
                }
            }
        }
    }
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

ok, this should be interesting. lets assume i have the following code: in this
Lets assume we have the following code: abstract class Base1 { protected int num;
Lets assume I have the following 3 entities: Customer,Order,Product which interact in the View
Lets assume I have the following Java code: public String foo() { // returns
Lets assume I have the following : 1- a code snippet CODE1 with time
Let's assume I have the following code: public class MainClass { public static void
Let's assume we've got the following Java code: public class Maintainer { private Map<Enum,
Lets assume following classes definition: public class A { public final static String SOME_VALUE;
Lets assume we have this xml: <?xml version=1.0 encoding=UTF-8?> <tns:RegistryResponse status=urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Failure xmlns:tns=urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0 xmlns:rim=urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0> <tns:RegistryErrorList
Assume that the following code is being executed by 10 threads. pthread_mutex_lock(&lock) Some trivial

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.