代码之家  ›  专栏  ›  技术社区  ›  hsz

将自定义模板路径设置为渲染而不是标准路径

  •  5
  • hsz  · 技术社区  · 14 年前

    有可能吗 ZendFramework 当我调用某个操作时设置自定义模板? 例如我打电话给 /category/show/id/123 View /category/show.html 文件。

    我想能够呈现另一个模板- /category/showOther.html

    我该怎么办?

    2 回复  |  直到 14 年前
        1
  •  17
  •   opHASnoNAME    14 年前

    当然。在ControllerAction中执行以下操作:

    $this->_helper->viewRenderer('showOther');  
    
        2
  •  0
  •   Acelasi Eu    11 年前
    <div class="jumbotron">
        <h1><?php echo sprintf($this->translate('Welcome to %sZend Framework 2%s'), '<span class="zf-green">', '</span>') ?></h1>
        <p><?php echo sprintf($this->translate('Congratulations! You have successfully installed the %sZF2 Skeleton Application%s. You are currently running Zend Framework version %s. This skeleton can serve as a simple starting point for you to begin building your application on ZF2.'), '<a href="https://github.com/zendframework/ZendSkeletonApplication" target="_blank">', '</a>', \Zend\Version\Version::VERSION) ?></p>
        <p><a class="btn btn-success btn-lg" href="https://github.com/zendframework/zf2" target="_blank"><?php echo $this->translate('Fork Zend Framework 2 on GitHub') ?> &raquo;</a></p>
    </div>
    
    <div class="row">
    
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title"><?php echo $this->translate('Follow Development') ?></h3>
                </div>
                <div class="panel-body">
                    <p><?php echo sprintf($this->translate('Zend Framework 2 is under active development. If you are interested in following the development of ZF2, there is a special ZF2 portal on the official Zend Framework website which provides links to the ZF2 %swiki%s, %sdev blog%s, %sissue tracker%s, and much more. This is a great resource for staying up to date with the latest developments!'), '<a href="http://framework.zend.com/wiki/display/ZFDEV2/Home">', '</a>', '<a href="http://framework.zend.com/zf2/blog">', '</a>', '<a href="https://github.com/zendframework/zf2/issues">', '</a>') ?></p>
                    <p><a class="btn btn-success pull-right" href="http://framework.zend.com/zf2" target="_blank"><?php echo $this->translate('ZF2 Development Portal') ?> &raquo;</a></p>
                </div>
            </div>
        </div>
    
        <div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading">
    
    推荐文章