Magento - 加载页面后执行的最后一个事件名称
在我的自定义模块中,我在会话变量中设置了一个标志,并在 controller_action_layout_render_before
事件中设置了标志,检查是否设置了标志,然后附加自定义内容。
我想在页面加载后取消设置会话变量中的标志。
怎么办呢。
当页面加载时,是否有任何事件在最后执行?
In my custom module i have set a flag in session variable, and in controller_action_layout_render_before
event, checking if the flag is set in then append a custom content.
I want to unset the flag in session variable after the page is loaded.
How can it be done.
Is there any event which is executed at the end when the page is getting loaded?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该
活动应该适合您。暂时向
app/Mage.php
添加一些日志记录可以获取针对特定请求触发的事件列表,这通常足以跟踪您自己查找的事件。
The
event should work for you. Temporarily adding some logging to
app/Mage.php
can get you a list of events that have fired for a particular request, which is usually enough to track down the event you're looking for yourself.
如果您希望仅在单个请求的生命周期内存储变量,您可以考虑使用 Magento 的注册表。基本上,您可以使用
Mage::register('some_variable_name',$variable);
插入一个值,并在同一请求的其他上下文中使用Mage::registry('some_variable_name' );
参考@Alan Storm 的回答此处了解更多信息。
I've you're looking to store a variable only for the life of a single request, you might consider using Magento's registry. Basically, you insert a value with
Mage::register('some_variable_name',$variable);
and retrieve it in some other context in the same request withMage::registry('some_variable_name');
Refer to @Alan Storm's answer here for more information.