![](/img/trans.png)
[英]Magento CE: How to change position of block inside phtml file depending on screen resolution
[英]Magento call account information phtml block
我们正在网站上制作另一个页面,其中包含帐户信息布局。
我们想调用此块,但最终只得到h3标题:帐户信息。
我们使用了这个:
{{block type="core/template" template="customer/account/dashboard.phtml"}}
结果:
我们想要什么:
没关系的类别!
我们有做错什么吗,好吧,显然我们做错了什么。
需要更多信息吗? 随便问!
首先,您必须在布局xml中为此操作设置页面模板。
如下所示:
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
然后将代码块放入<reference name="content"> ..... </reference>
块中。
当输出{{block ...}}声明时,是在页面内容中进行的,您要做的是使用XML布局将菜单插入“ left”块,也就是左侧边栏
在“设计”>“页面布局”>“布局”中,选择左侧两栏,然后将此块粘贴到XML部分中(如果需要,请删除不必要的链接):
<reference name="left">
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
<action method="addLink" translate="label" module="downloadable"><name>downloadable_products</name><path>downloadable/customer/products</path><label>My Downloadable Products</label></action>
<action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
<action method="addLink" translate="label" module="oauth"> <name>OAuth Customer Tokens</name> <path>oauth/customer_token</path> <label>My Applications</label> </action>
<action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
<action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
<action method="addLink" translate="label" module="tag"><name>tags</name><path>tag/customer/</path><label>My Tags</label></action>
<action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Wishlist</label></action>
</block>
</reference>
这个答案是对这篇文章的部分参考,我对magento的其他代码块做了一些研究
由于无法确保此页面的安全性,因此此实现也有局限性。 据我所知,您需要为此创建一个自定义模块,@ AlanStorm的这篇文章应该可以为您提供帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.