More Simple Examples Needed

Discussions related to customizing hooks. Hooks are documented at http://bigprof.com/appgini/help/advanced-topics/hooks/
Post Reply
Johnk
AppGini Super Hero
AppGini Super Hero
Posts: 68
Joined: 2013-01-09 03:47
Location: Cairns, Australia

More Simple Examples Needed

Post by Johnk » 2013-01-20 16:27

I'm not exactly hooked on hooks, but maybe I'll get hooked when I understand them better. It would be great to see some very basic examples and even better if they were incorporated into a small axp file. I don't think I'm alone here, as new users discover AppGini, they will want to learn and understand hooks quickly. Not all people are PHP programmers. I know I'm not, so when I write code it's very basic.

I could fill this forum with questions to suit my own need (or is that greed?), but I'd like to see samples I can adapt in everyday use.

An example would be:
Creating a Global or local Variable and implementing it.
I have a table called Settings and it includes the end of financial year. I wish to use the end date everywhere. When I open my Members table I wish to read that date in settings into a variable and compare it with today's date. I can get it all to work as hand written code in PHP, but when I add it to a hook, it doesn't work. The variables are always empty. Somewhere I saw "echo" used to transfer field data to a variable, but you don't use echo to do that in PHP.

So there's the first example: The correct Appgini code to open a database in Hooks, add field data to a variable and compare that variable with other field data. Simple really, until I apply it to Appgini.

Post Reply