where to place code for application hook

i want to execute some code on every page load. i fully understand that i can use a statement like the following to accomplish this\

$hook_array[‘after_ui_frame’][] = Array(1, ‘Hook Name’, ‘PHP_file_with_function_to_be_called_during_hook.php’, ‘class_in_that_file’, ‘function_in_that_class’);

per documentation at: http://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_6.5/Module_Framework/Logic_Hooks/Application_Hooks/after_ui_frame/ , and various instructions in blogs on the web tell me that this statement should be placed in “/custom/modules/logic_hooks.php”, however, at the top of that file there is the following statement:

// Do not store anything in this file that is not part of the array or the hook version. This file will
// be automatically rebuilt in the future.

So, if not here, then where? i tried creating a file in “custom/Ext/application/Ext/LogicHooks/” called myLogicHooj.php and placed this code in it, but it never seems to fire.

Help? Explanation would be greatly appreciated!

Your hook will be part of the array, so you can store it there. Have you tried? also you need to set the after_ui_frame in at the beginning of the array

best regards

my logic hook works fine when i make the call from within the custom/modules/logic_hooks.php

it doesn’ work when i put it in custom/Extension/application/Ext/LogicHooks/my_logic_hook.php.

if you’re asking whether or not i have code in the my_logic_hook.php file to create the array if it doesn’t already exist, the answer is yes. it looks like the following:

if (!isset($hook_array) || !is_array($hook_array)) {
$hook_array = array();
}
if (!isset($hook_array[‘after_ui_frame’]) || !is_array($hook_array[‘after_ui_frame’])) {
$hook_array[‘after_ui_frame’] = array();
}

btw, thanks for the reply!! :slight_smile:

sorry… it looks like this…

if (!isset($hook_array) || !is_array($hook_array)) {
$hook_array = array();
}
if (!isset($hook_array[‘after_ui_frame’]) || !is_array($hook_array[‘after_ui_frame’])) {
$hook_array[‘after_ui_frame’] = array();
}

NEVERMIND!!! got it to work. it just needed a repair and rebuild because it was in the Extension dir.