Table specific hook doesn't seem to work, help and tips for debuging

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
chrisagon
Posts: 14
Joined: 2016-10-13 19:38
Location: Paris, France
Contact:

Table specific hook doesn't seem to work, help and tips for debuging

Post by chrisagon » 2020-01-06 14:10

I have read and read again the page https://bigprof.com/appgini/help/advanc ... ific-hooks.
I have modified my tablename.php file in the hook directory. You can see it here : https://github.com/chrisagon/hrcv3/blob ... t.php#L188
I have no error, but I don't understand why I don't even see the echo I have put for debugging purpose and why my code is not executed !? :shock:

What kind of tools do you use for debuging your php file ?
Anyboby have an idea ?
Chrisagon.

pböttcher
AppGini Super Hero
AppGini Super Hero
Posts: 869
Joined: 2018-04-01 10:12

Re: Table specific hook doesn't seem to work, help and tips for debuging

Post by pböttcher » 2020-01-06 14:45

Hi,
just put

exit;

after

Code: Select all

echo "<br>apres INSERT&nbsp; Consultant </br>";
like

Code: Select all

echo "<br>apres INSERT&nbsp; Consultant </br>";exit;
Then you should see your text.

The hook file gets executed but will then return with true or false to indicate that the function terminated correctly or not (e.g. instert to be done or not).
Then the page gets reloaded, so that you will not see the output that you produce in the hook itself via echo.

You can e.g. use the "exit;" version, or write your output to a file.

chrisagon
Posts: 14
Joined: 2016-10-13 19:38
Location: Paris, France
Contact:

Re: Table specific hook doesn't seem to work, help and tips for debuging

Post by chrisagon » 2020-01-06 16:31

YES of course ;) !
Thank you for your help.
Chrisagon.

chrisagon
Posts: 14
Joined: 2016-10-13 19:38
Location: Paris, France
Contact:

Re: Table specific hook doesn't seem to work, help and tips for debuging

Post by chrisagon » 2020-01-07 10:43

here is an help for debugging.
You can use "error_log" : https://www.php.net/manual/fr/function.error-log
like this :

Code: Select all

// error message to be logged
$error_message = "Ceci est un message erreur!\r";

// path of the log file where errors need to be logged
$log_file = "./mes-erreurs.log";

// logging error message to given log file
error_log($error_message, 3, $log_file); 
or like this :

Code: Select all

        $error_message = $chemin_cv." Fichier non trouve !";
        error_log($error_message, 3, "./mes-erreurs.log");
This help me to find my bug. :roll:
Chrisagon.

Post Reply