2012-03-13 23 views
1

我有一個使用REST API的客戶端html和javascript應用程序,該應用程序返回JSON。現在,我有登錄時的主頁面,將配置文件信息存儲在JavaScript對象中。然後系統中的所有其他頁面都會顯示在iFrame中,以便他們可以訪問父頁面中的JSON數據,而無需另外調用Ajax。使用Zend Framework應用程序將子視圖加載到IFrame中

由於未來需求,我需要將應用程序移動到Zend Framework,我不確定如何呈現包含iframe的單個視圖,然後將所有其他視圖加載到它中,而不是實例化新的佈局模板,並加載視圖。

我對Zend Framework有足夠的瞭解,所以我沒有尋找基本的Zend Framework幫助,只是一個瘋狂的用例,爲什麼一個iframe ...我不知道,客戶需求。

感謝提前:)

回答

0
  1. 設置默認佈局是iframe中(即,裝飾最小)使用

    ; application.ini 
    
    resources.layout.layoutPath = APPLICATION_PATH "/layouts/scripts" 
    resources.layout.layout = "iframe" 
    ; refers to application/layouts/scripts/iframe.phtml 
    
  2. 在你的主頁控制器一個,設置佈局成爲整頁版

    public function indexAction() { 
        $this->_helper->layout->setLayout('full'); 
        // refers to application/layouts/scripts/full.phtml 
    } 
    
  3. 在您的整個頁面佈局,創建你的iframe,並將其命名

    <iframe src="" name="content" height="100" width="200">You need a Frames Capable browser to view this content.</iframe> 
    
  4. 在您的主頁視圖,直接鏈接到的iframe

    <a href="<?php echo $this->url(array(
        'action' => 'some-action' 
    )) ?>" target="content">Click me</a> 
    
+0

我會嘗試一下,看看它是否工作打開...謝謝:)如果它工作,將標記爲答案...現在嘗試。 – 2012-03-14 07:30:54

相關問題