douzhong8856 2014-10-15 20:49
浏览 48

从View Helper调用Zend View Script

I'd like to call a .phtml file I have in /application/views/scripts in my view helper located in /library/Foo/View/Helper. Zend shows an error as partial is not a defined method within Zend_View_Helper.

Is what I am trying to do possible? On Zend Framework v1.12.

Syntax would look something like below:

View Helper:

class Foo_View_Helper_NavPopup extends Zend_View_Helper_Abstract
{
    public function navPopup() {

        $popup = $this->partial("popup.phtml");
        return $popup;
    }
}

View Script (popup.phtml):

<div id="container">html things and stuff and such and so forth..</div>
  • 写回答

1条回答 默认 最新

  • dongzhoutuo0883 2014-10-16 15:14
    关注

    The main source of the problem here was a quirky namespacing issue with my codebase, specifically because I am working with the header of the page and not a specific module within the application itself.

    By using $this->view->addScriptPath(APPLICATION_PATH . "/views/scripts/"); I gave the view an explicit direction to the path to find the script. This fixed the problem.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于FOC驱动器,如何实现卡丁车下坡无阻力的遛坡的效果
  • ¥15 IAR程序莫名变量多重定义
  • ¥15 (标签-UDP|关键词-client)
  • ¥15 关于库卡officelite无法与虚拟机通讯的问题
  • ¥100 已有python代码,要求做成可执行程序,程序设计内容不多
  • ¥15 目标检测项目无法读取视频
  • ¥15 GEO datasets中基因芯片数据仅仅提供了normalized signal如何进行差异分析
  • ¥100 求采集电商背景音乐的方法
  • ¥15 数学建模竞赛求指导帮助
  • ¥15 STM32控制MAX7219问题求解答