Magento的:通过Ajax调用模板PHTML文件模板、文件、Magento、Ajax

由网友(等雨哗哗下)分享简介:我试图打电话对我的Magento站点的主页从阿贾克斯一个PHTML文件。基本上,我创建了应用程序/设计/前端/基/默认/模板/目录/产品/ list.phtml的副本,并对其进行了定制,以查看特定类别。如果我添加一块指向CMS中的部分文件,我可以查看它就好了。不过,我想打电话给通过Ajax这个文件。I'm attem...

我试图打电话对我的Magento站点的主页从阿贾克斯一个PHTML文件。基本上,我创建了应用程序/设计/前端/基/默认/模板/目录/产品/ list.phtml的副本,并对其进行了定制,以查看特定类别。如果我添加一块指向CMS中的部分文件,我可以查看它就好了。不过,我想打电话给通过Ajax这个文件。

I'm attempting to call a phtml file from Ajax on the homepage of my Magento site. I basically created a copy of app/design/frontend/base/default/template/catalog/product/list.phtml and customized it to view a particular category. If I add a block pointing to this file in the CMS section, I can view it just fine. However, I want to call this file via Ajax.

我按照说明创建一个模块此处,然后我试图通过下面跟随阿贾克斯在Magento的逻辑的这个帖子。然而,在最后一步它列出:

I followed the instructions to create a module here, and then I attempted to follow the logic of Ajax in Magento by following this post. However, in the last step it lists:

< module_controller_action>   <块类型=模块/块NAME =根输出=toHtml模板=模块/ template.phtml/> < / module_controller_action>

<module_controller_action> <block type="module/block" name="root" output="toHtml" template="module/template.phtml"/> </module_controller_action>

我在哪里插入呢?此外,对于模板=模块/ template.phtml,什么文件夹是指?

Where do I insert this? Also, for the template="module/template.phtml", what folder is that referring to?

推荐答案

需要XML的该位被放在一个布局的XML文件,该文件被发现在app /设计/前端/基/默认/布局/目录。您可以更新任何与该的这段布局文件,但是我不建议。我通常建议在创建模板的布局目录(应用程序/设计/前端/ * / * /布局/那个local.xml)一个local.xml文件,。

That bit of xml needs to be put in a layout xml file, which are found in the app/design/frontend/base/default/layout/ directory. You can update any of the layout files with that snippit, but I don't recommend that. I usually recommend creating a local.xml file in your template's layout directory (app/design/frontend/*/*/layout/local.xml).

现在,请确保您更新XML的这段也因此,它说你的真实模块,控制器和动作名称! :)

Now, make sure you update the xml snippit too so that it says your real module, controller, and action name! :)

模板=模块/ template.phtml也需要进行定制,以反映路径PHTML文件。所以,如果你把你的自定义PHTML文件在app /设计/前端/ * / * /模板/ MyFolder中/ myphtml.phtml,那么code将模板=MyFolder中/ myphtml.phtml

The template="module/template.phtml" will also need to be customized to reflect the path to the phtml file. So if you put your custom phtml file in app/design/frontend/*/*/template/myfolder/myphtml.phtml, then the code would be template="myfolder/myphtml.phtml"

阅读全文

相关推荐

最新文章