在我的模块配置中,我有一个按钮。点击该按钮后,我弹出一个窗口,收集更多的输入。该文件只是一个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>
谢谢你的回答。而不是/px.html,我的window.open应该采取/ myfrontname/mycontroller/myaction的参数吗? – user649650 2011-04-27 11:20:31