2011-04-26 76 views
0

在我的模塊配置中,我有一個按鈕。點擊該按鈕後,我彈出一個窗口,收集更多的輸入。該文件只是一個html文件,但它應該放在模塊的目錄結構中?Magento配置彈出窗口 - html文件應該放在模塊層次結構中的位置?

爲了給多一點信息 - 剛剛看到的東西的工作,我定義我的領域如下:

<button_url_test_window_open><![CDATA[/px.html]]></button_url_test_window_open> 
<frontend_model>mymodule/adminhtml_system_config_testWindowOpenDialog</frontend_model> 

,我把px.html文件在我的htdocs/Magento的文件夾中。當我點擊按鈕時,會打開/px.html,但這看起來不正確。我不知道該怎麼說這個問題,但我覺得我應該做更多的事情,比如'打開名爲mymodule的px.html文件',然後magento會查找正確的位置。對於術語感到抱歉,我仍然在處理Magento/PHP/Apache。

只是爲了完成什麼,我目前擁有的畫面,frontend_model塊是:

protected function _prepareLayout() 
{ 
    parent::_prepareLayout(); 
    if (!$this->getTemplate()) { 
     $this->setTemplate('mypackage/system/config/test_window_open_dialog.phtml'); 
    } 
    return $this; 
} 

public function render(Varien_Data_Form_Element_Abstract $element) 
{ 
    $element->unsScope()->unsCanUseWebsiteValue()->unsCanUseDefaultValue(); 
    return parent::render($element); 
} 

protected function _getElementHtml(Varien_Data_Form_Element_Abstract $element) 
{ 
    $originalData = $element->getOriginalData(); 
    $this->addData(array(
     'button_label_test_window_open' => Mage::helper('mymodule')->__($originalData['button_label_test_window_open']), 
     'button_url_test_window_open' => $originalData['button_url_test_window_open'], 
     'html_id' => $element->getHtmlId(), 
    )); 
    return $this->_toHtml(); 
} 

和test_window_open_dialog.phtml文件包含:

<table> 
    <tr> 
     <td> 
      <button style="" onclick="javascript:window.open('<?php echo $this->getButtonUrlTestWindowOpen()?>', 'testing','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, ,left=100, top=100, width=600, height=470'); return false;" class="scalable" type="button" id="<?php echo $this->getHtmlId() ?>"> 
       <span><?php echo $this->escapeHtml($this->getButtonLabelTestWindowOpen()); ?></span> 
      </button> 
     </td> 
    </tr> 
</table> 

回答

1

PHTML文件沒有在任何地方你的模塊目錄。模塊目錄包含您的Blocks,Helper,模型,控制器,Sql安裝/升級文件以及您的配置xml文件。模板文件進入app/design/adminhtml(如果它是一個管理模板),或者在app/design/frontend中,如果它將被用在網站的前端。

+0

謝謝你的回答。而不是/px.html,我的window.open應該採取/ myfrontname/mycontroller/myaction的參數嗎? – user649650 2011-04-27 11:20:31