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 pa开发者_StackOverflowge is loaded.
How can it be done.
Is there any event which is executed at the end when the page is getting loaded?
The
controller_front_send_response_after
event should work for you. Temporarily adding some logging to app/Mage.php
public static function dispatchEvent($name, array $data = array())
{
//Mage::Log($name);
file_put_contents('/tmp/event.log',"$name\n",FILE_APPEND);
Varien_Profiler::start('DISPATCH EVENT:'.$name);
$result = self::app()->dispatchEvent($name, $data);
#$result = self::registry('events')->dispatch($name, $data);
Varien_Profiler::stop('DISPATCH EVENT:'.$name);
return $result;
}
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.
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 with Mage::registry('some_variable_name');
Refer to @Alan Storm's answer here for more information.
精彩评论