Changes between Initial Version and Version 1 of HowToMakeInjections


Ignore:
Timestamp:
Oct 14, 2013, 10:30:33 AM (11 years ago)
Author:
LeonidS
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowToMakeInjections

    v1 v1  
     1== How to make injection in Dolphin 7.1. == 
     2 
     3Injection 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). 
     4 
     5For insertion of own injection to the Dolphin 7.1 need to complete the following actions: 
     6 
     71) Compile MySQL query like the next example from BoonEx module "simple_messenger": 
     8 
     9 
     10{{{ 
     11INSERT INTO  
     12        `sys_injections` 
     13    SET 
     14        `name`       = 'bx_simple_messenger_core_init', 
     15        `page_index` = '0', 
     16        `key`        = 'injection_header', 
     17        `type`       = 'php', 
     18        `data`       = 'return BxDolService::call(''simple_messenger'', ''get_messenger_core'');', 
     19                `replace`    = '0', 
     20        `active`     = '1'; 
     21}}} 
     22 
     23                 
     24Let's review every part of this code: 
     25 
     26        a) `name`       = 'bx_simple_messenger_core_init' - unique name for new injection[[BR]] 
     27 
     28        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.[[BR]] 
     29 
     30        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:[[BR]] 
     31 
     32         
     33''       * Predefined template keys to add injections: 
     34         *  1. injection_head - add injections in the <head> tag. 
     35         *  2. injection_body - add ingection(attribute) in the <body> tag. 
     36         *  3. injection_header - add injection inside the <body> tag at the very beginning. 
     37         *  4. injection_logo_before - add injection at the left of the main logo(inside logo's DIV). 
     38         *  5. injection_logo_after - add injection at the right of the main logo(inside logo's DIV). 
     39         *  6. injection_between_logo_top_menu - add injection between logo and top menu. 
     40         *  7. injection_top_menu_before - add injection at the left of the top menu(inside top menu's DIV). 
     41         *  8. injection_top_menu_after - add injection at the right of the top menu(inside top menu's DIV). 
     42         *  9. injection_between_top_menu_breadcrumb - add injection between top menu and breadcrumb. 
     43         *  10. injection_breadcrumb_before - add injection at the left of the breadcrumb(inside breadcrumb's DIV). 
     44         *  11. injection_breadcrumb_after - add injection at the right of the breadcrumb(inside breadcrumb's DIV). 
     45         *  12. injection_between_breadcrumb_content - add injection between breadcrumb and main content. 
     46         *  13. injection_content_before - add injection just before main content(inside content's DIV). 
     47         *  14. injection_content_after - add injection just after main content(inside content's DIV). 
     48         *  15. injection_between_content_footer - add injection between content and footer. 
     49         *  16. injection_footer_before - add injection at the left of the footer(inside footer's DIV). 
     50         *  17. injection_footer_after - add injection at the right of the footer(inside footer's DIV). 
     51         *  18. injection_footer - add injection inside the <body> tag at the very end.''[[BR]] 
     52 
     53                  
     54        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[[BR]] 
     55 
     56        e) `data`       = 'return BxDolService::call(''simple_messenger'', ''get_messenger_core'');' - "body" of injection. Means code which will be executed everytiem when injection is connected (if `type` parameter = 'php') or just plain text or HTML (if `type` = 'text')[[BR]] 
     57 
     58        f) `replace`    = '0' - means will be key, where injection works, replaced or just added by injection's code. [[BR]] 
     59 
     60        g) `active`     = '1' - means active (with value "1") or inactive (with "0") status of injection[[BR]] 
     61         
     62        2) Execute new MySQL query with your injection in DB of your Dolphin's site. 
     63         
     64        3) Login as admin, go to tools->cache section and clear all caches. 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.
Fork me on GitHub