How to make injection in Dolphin 7.1.

Injection in Dolphin means possibility to add own code to the common parts of pages which are usually out from modules actions. Like header, footer, left and right sides (typical example - default banners feature).

For insertion of own injection to the Dolphin 7.1 need to complete the following actions:

1) Create MySQL query similar to the next example from "Simple Messenger" BoonEx module:

INSERT INTO 
        `sys_injections`
    SET
        `name`       = 'bx_simple_messenger_core_init',
        `page_index` = '0',
        `key`        = 'injection_header',
        `type`       = 'php',
        `data`       = 'return BxDolService::call(''simple_messenger'', ''get_messenger_core'');',
		`replace`    = '0',
        `active`     = '1';

Let's review every part of this code:

a) 'name' = 'bx_simple_messenger_core_init' - unique name for new injection

b) 'page_index' = '0' - means number of page where code of injection will appear. If u choose "0" then injection will work in all pages. If set another number - then in pages which have the same number in $_page['name_index'] variable. For example - member.php (account page) has code like $_page['name_index'] = 81; so for injection in this page page_index parameter will be 81.

c) 'key' = 'injection_header' - means template system key, where code of injection will be added. List of system keys u may see in inc/classes/BxDoltemplate.php file, in method parseSystemKey. Usual key for injection is injection_header, banners feature uses banner_right, top, left, bottom. Full list of available injections keys:

Predefined template keys to add injections:

  1. injection_head - add injections in the <head> tag.
  2. injection_body - add ingection(attribute) in the <body> tag.
  3. injection_header - add injection inside the <body> tag at the very beginning.
  4. injection_logo_before - add injection at the left of the main logo(inside logo's DIV).
  5. injection_logo_after - add injection at the right of the main logo(inside logo's DIV).
  6. injection_between_logo_top_menu - add injection between logo and top menu.
  7. injection_top_menu_before - add injection at the left of the top menu(inside top menu's DIV).
  8. injection_top_menu_after - add injection at the right of the top menu(inside top menu's DIV).
  9. injection_between_top_menu_breadcrumb - add injection between top menu and breadcrumb.
  10. injection_breadcrumb_before - add injection at the left of the breadcrumb(inside breadcrumb's DIV).
  11. injection_breadcrumb_after - add injection at the right of the breadcrumb(inside breadcrumb's DIV).
  12. injection_between_breadcrumb_content - add injection between breadcrumb and main content.
  13. injection_content_before - add injection just before main content(inside content's DIV).
  14. injection_content_after - add injection just after main content(inside content's DIV).
  15. injection_between_content_footer - add injection between content and footer.
  16. injection_footer_before - add injection at the left of the footer(inside footer's DIV).
  17. injection_footer_after - add injection at the right of the footer(inside footer's DIV).
  18. injection_footer - add injection inside the <body> tag at the very end.

d) 'type' = 'php' - injection's type. If set "php" then system will try to execute injection code, if "text" - then includes text which will be placed to then enxt parameter

e) 'data' = 'return BxDolService::call(''simple_messenger'', ''get_messenger_core'');' - "body" of injection. Means code which will be executed everytime when injection is connected (if type parameter = 'php') or just plain text or HTML (if type = 'text')

f) 'replace' = '0' - means will be key, where injection works, replaced or just added by injection's code.

g) 'active' = '1' - means active (with value "1") or inactive (with "0") status of injection

2) Execute new MySQL query with your injection in DB of your Dolphin's site.

3) Login as admin, go to tools->cache section and clear all caches.

Last modified 4 years ago Last modified on Oct 18, 2013, 7:28:57 AM
 
Fork me on GitHub