Hook attach
(→pgm-template_builder.php) |
|||
(28 intermediate revisions by 6 users not shown) | |||
Line 15: | Line 15: | ||
− | The end-result of examples 1 and 2 is that Pro Edition will include() your script at the designated location (determined by hook id). So when Pro Edition processes header.php and gets to that line with a hook() on it that your plugin has attached to (by calling hook_attach in its install_manifest.php), it basically does this... | + | '''The end-result of examples 1 and 2''' is that Pro Edition will include() your script at the designated location (determined by hook id). So when Pro Edition processes header.php and gets to that line with a hook() on it that your plugin has attached to (by calling hook_attach in its install_manifest.php), it basically does this... |
<pre>include("[path_your_plugin_folder]/quickedit_js.php");</pre> | <pre>include("[path_your_plugin_folder]/quickedit_js.php");</pre> | ||
− | [[Category: Plugins]] | + | ==Additional Attach Locations== |
+ | |||
+ | ===pgm-realtime_builder.php=== | ||
+ | <pre>hook_attach("attachment_file.php", "pgm-realtime_builder.php:after_custom_auto_menu_check");</pre> | ||
+ | Allows adding code after the custom auto menu check. Replace attachment_file.php with your file name. | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-realtime_builder.php:template_loop");</pre> | ||
+ | Allows adding code to the beginning of the template parsing loop. Replace attachment_file.php with your file name. | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-realtime_builder.php:rtb_contentloop");</pre> | ||
+ | Allows adding code within the content parsing loop. Replace attachment_file.php with your file name. | ||
+ | |||
+ | ===pgm-template_builder.php=== | ||
+ | These are the same as the ones above but for shopping cart pages. Please note the file name difference in the following hooks | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-template_builder.php:after_custom_auto_menu_check");</pre> | ||
+ | Allows adding code after the custom auto menu check. Replace attachment_file.php with your file name. | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-template_builder.php:template_loop");</pre> | ||
+ | Allows adding code to the beginning of the template parsing loop. Replace attachment_file.php with your file name. | ||
+ | |||
+ | ===pgm-payment_gateway.php=== | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-payment_gateway.php:plugin_paytypes");</pre> | ||
+ | <pre>hook_attach("attachment_file.php", "pgm-payment_gateway.php:gateway_submit");</pre> | ||
+ | |||
+ | ===pgm-show_invoice.php=== | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-show_invoice.php:gateway_catch");</pre> | ||
+ | |||
+ | ===pgm-checkout.php=== | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-checkout.php:initial_data");</pre> | ||
+ | <pre>hook_attach("attachment_file.php", "pgm-checkout.php:gateway_button");</pre> | ||
+ | |||
+ | ===pgm-more_information.php=== | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-more_information.php:initial_data");</pre> | ||
+ | <pre>hook_attach("attachment_file.php", "pgm-more_information.php:above_moreinfo-pricing_table");</pre> | ||
+ | |||
+ | ===pgm-add_cart.php=== | ||
+ | |||
+ | <pre>hook_attach("attachment_file.php", "pgm-add_cart.php:initial_data");</pre> | ||
+ | <pre>hook_attach("attachment_file.php", "pgm-add_cart.php:above_current_cart_contents");</pre> | ||
+ | |||
+ | |||
+ | [[Category:Plugins]] |
Latest revision as of 17:01, 5 June 2008
- Syntax
- hook_attach(plugin file, hook id name)
- What it does
- Includes (attaches) your custom script (plugin file) at a pre-designated place (hook id) in the Pro Edition source code.
Example 1 - What a designated hook looks like in the Pro Edition source code
Taken from in sohoadmin/program/header.php (~line #375 as of v4.9 Beta2)
eval(hook("header.php:top_javascript", basename(__FILE__)));
Example 2 - calling hook attachement() from your install_manifest.php
Taken from QuickEdit Dropdown Menu plugin
hook_attach("quickedit_js.php", "header.php:top_javascript");
The end-result of examples 1 and 2 is that Pro Edition will include() your script at the designated location (determined by hook id). So when Pro Edition processes header.php and gets to that line with a hook() on it that your plugin has attached to (by calling hook_attach in its install_manifest.php), it basically does this...
include("[path_your_plugin_folder]/quickedit_js.php");
Contents |
Additional Attach Locations
pgm-realtime_builder.php
hook_attach("attachment_file.php", "pgm-realtime_builder.php:after_custom_auto_menu_check");
Allows adding code after the custom auto menu check. Replace attachment_file.php with your file name.
hook_attach("attachment_file.php", "pgm-realtime_builder.php:template_loop");
Allows adding code to the beginning of the template parsing loop. Replace attachment_file.php with your file name.
hook_attach("attachment_file.php", "pgm-realtime_builder.php:rtb_contentloop");
Allows adding code within the content parsing loop. Replace attachment_file.php with your file name.
pgm-template_builder.php
These are the same as the ones above but for shopping cart pages. Please note the file name difference in the following hooks
hook_attach("attachment_file.php", "pgm-template_builder.php:after_custom_auto_menu_check");
Allows adding code after the custom auto menu check. Replace attachment_file.php with your file name.
hook_attach("attachment_file.php", "pgm-template_builder.php:template_loop");
Allows adding code to the beginning of the template parsing loop. Replace attachment_file.php with your file name.
pgm-payment_gateway.php
hook_attach("attachment_file.php", "pgm-payment_gateway.php:plugin_paytypes");
hook_attach("attachment_file.php", "pgm-payment_gateway.php:gateway_submit");
pgm-show_invoice.php
hook_attach("attachment_file.php", "pgm-show_invoice.php:gateway_catch");
pgm-checkout.php
hook_attach("attachment_file.php", "pgm-checkout.php:initial_data");
hook_attach("attachment_file.php", "pgm-checkout.php:gateway_button");
pgm-more_information.php
hook_attach("attachment_file.php", "pgm-more_information.php:initial_data");
hook_attach("attachment_file.php", "pgm-more_information.php:above_moreinfo-pricing_table");
pgm-add_cart.php
hook_attach("attachment_file.php", "pgm-add_cart.php:initial_data");
hook_attach("attachment_file.php", "pgm-add_cart.php:above_current_cart_contents");