Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/253.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 查看zend framework中另一个模块中模块的输出_Php_Zend Framework_Module - Fatal编程技术网

Php 查看zend framework中另一个模块中模块的输出

Php 查看zend framework中另一个模块中模块的输出,php,zend-framework,module,Php,Zend Framework,Module,我有两个模块 1-登录模块 2-应用模块 我想查看MyLoginModule/view/MyLoginModule/index/index.phtml(在这个文件中我有登录表单) 在我的主页上 我使用应用程序模块创建主页 我想在此文件中查看MyLoginModule中的登录表单:module\Application\view\Application\index\index.phtml 或 我有联系我们模块我想查看模块\contact us\view\contact us\index\index.

我有两个模块 1-登录模块 2-应用模块 我想查看MyLoginModule/view/MyLoginModule/index/index.phtml(在这个文件中我有登录表单) 在我的主页上 我使用应用程序模块创建主页 我想在此文件中查看MyLoginModule中的登录表单:module\Application\view\Application\index\index.phtml

我有联系我们模块我想查看模块\contact us\view\contact us\index\index.phtml 在我的主页上

使用应用程序模块创建我的主页

<?php

   echo $this->loginForm();
?>
thanx提前

我解决了它

代码ViewHelper
namespace Login\View\Helper;

use Zend\View\Helper\AbstractHelper;
use Zend\ServiceManager\ServiceLocatorAwareInterface;
use Zend\ServiceManager\ServiceLocatorInterface;
use Zend\View\Model\ViewModel;
use Login\Form\LoginForm as Formulaire;

class LoginForm extends AbstractHelper implements ServiceLocatorAwareInterface
{

    protected $sm;

    public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
    {
        $this->sm = $serviceLocator;
        return $this;
    }

    public function getServiceLocator()
    {
        return $this->sm;
    }

    public function __invoke()
    {
        $form = new Formulaire();
        $layout = new ViewModel(array(
            'form' => $form
        ));
        $viewRender = $this->getServiceLocator()->getServiceLocator()->get('ViewRenderer');
        $layout->setTemplate('login/index/index.phtml');
        return $viewRender->render($layout);
    }
}
登录模块中module.config.php中的语句

'view_helpers' => array(
        'invokables' => array(
            'loginForm' => 'Login\View\Helper\LoginForm'
        )
    ),
从应用程序模块的角度使用

<?php

   echo $this->loginForm();
?>

是正确的