NAVIGATION
This shows you the differences between two versions of the page.
|
english:technics:internal-function-call [2009/11/27 10:30] Knut Heermann (flip-flop) |
english:technics:internal-function-call [2018/06/03 18:09] (current) |
||
|---|---|---|---|
| Line 24: | Line 24: | ||
| ===== Init Mootools Library ===== | ===== Init Mootools Library ===== | ||
| + | |||
| + | ==== Till V1.4.3 r380 ==== | ||
| **File:** /include/inc_front/front.func.inc.php | **File:** /include/inc_front/front.func.inc.php | ||
| Line 33: | Line 35: | ||
| **Initialize** the active mootools framework in /template/inc_js/mootools/mootools.js | **Initialize** the active mootools framework in /template/inc_js/mootools/mootools.js | ||
| - | **Registriert** mit: | + | **Registered** with: |
| * mootools.js | * mootools.js | ||
| Line 45: | Line 47: | ||
| + | ==== Since V1.4.4 r381 ==== | ||
| + | |||
| + | |||
| + | **File:** /include/inc_front/front.func.inc.php | ||
| + | |||
| + | **Docu:** [[http://forum.phpwcms.org/viewtopic.php?p=122090#p122090]] | ||
| + | |||
| + | **Call:** initJSLib(); | ||
| + | |||
| + | **Tag:** -- -> **function:** initJSLib() //(in the corresponding JS-Lib in include/inc_front/lib/*)// | ||
| + | |||
| + | |||
| + | **Initializes** the currently active JS framework in **template/lib/mootools/*** or **template/lib/jquery/*** //(depending on the framework set up in template)//. | ||
| + | |||
| + | **Registered** with ##mootools.js## if **MooTools 1.1/1.2** is set in template //(JS Library)//: | ||
| + | |||
| + | **Call:** | ||
| + | <code php>initJSLib();</code> | ||
| + | |||
| + | or | ||
| + | |||
| + | **Registered** with ##jquery.js## if **jQuery 1.3/1.4** is set in template //(JS Library)//: | ||
| + | |||
| + | **Call:** | ||
| + | <code php>initJSLib();</code> | ||
| + | |||
| + | \\ | ||
| + | After v1.4.3 R380 the handling for JS Libs and files was switched. | ||
| + | |||
| + | |||
| + | The call **initMootools();** does not exist anymore. Now it is substituted by **initJSLib();**, whereby the JS-Framework set in template is loaded. | ||
| + | |||
| + | By using the call **initializeLightbox();** //(deprecated)// or **initSlimbox();** the right JS framework is atom. loaded. | ||
| + | |||
| + | |||
| + | It must be changed all the external calls of the framework into this standardized way of calling. | ||
| + | |||
| + | |||
| + | Such calls: | ||
| + | <code php> | ||
| + | $GLOBALS['block']['custom_htmlhead']['mootools.js'] = ' <script src="'.TEMPLATE_PATH.'inc_js/smoothgallery/mootools.js" type="text/javascript"></script>'; | ||
| + | </code> | ||
| + | |||
| + | should / can no longer be used. Own Mootools sets are no longer the first choice. All components are present in the system. | ||
| + | |||
| + | |||
| + | If additional functions from the **Moore series** are used, then these can be integrated like this: | ||
| + | |||
| + | |||
| + | **In HTML-sourde:** | ||
| + | <code html><!-- JS: MORE:Fx/Fx.Elements,Fx/Fx.Accordion --></code> | ||
| + | |||
| + | \\ | ||
| + | **or as inline-PHP** //(not recommended)//: | ||
| + | <code php> | ||
| + | [PHP] | ||
| + | $js[1] = 'MORE:Fx/Fx.Elements,Fx/Fx.Accordion'; | ||
| + | renderHeadJS($js); | ||
| + | [/PHP] | ||
| + | </code> | ||
| + | |||
| + | \\ | ||
| + | **or this variant** //(e.g. in a forntend_render-Script)//: | ||
| + | <code php> | ||
| + | $mootools_more = array( | ||
| + | 'Fx/Fx.Elements', | ||
| + | 'Fx/Fx.Accordion' | ||
| + | ); | ||
| + | initJSPlugin($mootools_more, true); | ||
| + | </code> | ||
| + | \\ | ||
| + | |||
| + | === External JavaScripts === | ||
| + | ** are merged best as Plugin:** | ||
| + | |||
| + | **Example** SimpleTabs: | ||
| + | ---------------------------------- | ||
| + | **File:** template/lib/mootools/plugin-1.2/mootools.SimpleTabs.js \\ | ||
| + | |||
| + | Integrating with: | ||
| + | |||
| + | <code php> | ||
| + | initJSPlugin('SimpleTabs'); | ||
| + | |||
| + | $GLOBALS['block']['css']['reg_tabs_simpletabs01'] = 'specific/mootools/reg_tabs_simpletabs01.css'; | ||
| + | ... | ||
| + | ... | ||
| + | </code> | ||
| + | |||
| + | **initJSPlugin('SimpleTabs');** the right JS framework calls. | ||
| + | |||
| + | Alternatively, in a template: | ||
| + | <code php> | ||
| + | [PHp]initJSPlugin('SimpleTabs');[/PHP] | ||
| + | </code> | ||
| + | or | ||
| + | <code php> | ||
| + | <!-- JS: SimpleTabs --> | ||
| + | <!-- JS: http://digitarald.de/project/simple-tabs/1-0/source/SimpleTabs.js --> | ||
| + | </code> | ||
| + | |||
| + | |||
| + | <note important> | ||
| + | Since version r410 the call of external scripts like \\ ##%%<!-- JS: http://XYZ.js -->%%## for security is no longer possible. \\ | ||
| + | |||
| + | \\ | ||
| + | Alternatively, this method can be selected:\\ ##%%[PHP]$GLOBALS['block']['custom_htmlhead']['XYZ'] = getJavaScriptSourceLink(html_specialchars('http://XYZ.js'));[/PHP] %%## | ||
| + | |||
| + | </note> | ||
| + | |||
| + | * **External scripts** are now started from the appropriate plugin directory. | ||
| + | * The original file name **SimpleTabs.js** will be prefixed by **mootools.** or **jquery.** -> **mootools.SimpleTabs.js**. | ||
| + | |||
| + | The right JS-framework is now automatically assigned by the system. | ||
| + | |||
| + | |||
| + | |||
| + | <note>**All past external JS-integrations must be revised in this direction.**</note> | ||
| + | |||
| + | |||
| + | \\ | ||
| + | |||
| + | === check instantly appointed JS Lib === | ||
| + | |||
| + | templates -> JS Library: [Var: PHPWCMS_JSLIB] | ||
| + | |||
| + | |||
| + | <code php> | ||
| + | if(PHPWCMS_JSLIB == 'mootools-1.1') { ...... } | ||
| + | if(PHPWCMS_JSLIB == 'mootools-1.2') { ...... } | ||
| + | if(PHPWCMS_JSLIB == 'jquery-1.3') { ...... } | ||
| + | if(PHPWCMS_JSLIB == 'jquery-1.4') { ...... } | ||
| + | </code> | ||
| + | |||
| + | |||
| + | ~~UP~~ | ||
| ===== Init Lightbox ===== | ===== Init Lightbox ===== | ||
| Line 54: | Line 192: | ||
| **Tag:** -- -> **function:** initializeLightbox() | **Tag:** -- -> **function:** initializeLightbox() | ||
| - | **Initialize** the SlimBox /template/inc_js/slimbox/js/slimbox.js und den und Mootools //(see above)//. | + | **Initialize %%<=%% v1.4.3 r380** the SlimBox /template/inc_js/slimbox/js/slimbox.js and Mootools //(see above)//.\\ |
| + | **Initialize %%>=%% v1.4.4 r381** the SlimBox /template/lib/slimbox/[slimbox.mootools-1.1.js]|[slimbox.mootools-1.2.js]|[slimbox.jquery.js] and Mootools //(see above)//. | ||
| **Registered** with: | **Registered** with: | ||
| Line 76: | Line 216: | ||
| **Call:** | **Call:** | ||
| <code php> | <code php> | ||
| - | Unset ($GLOBALS['block']['custom_htmlhead']['slimbox.js']); | + | // unset Slimbox CCC and JS |
| + | Unset( | ||
| + | $GLOBALS['block']['custom_htmlhead']['lightbox.css'], | ||
| + | $GLOBALS['block']['custom_htmlhead']['slimbox.js'] | ||
| + | ); | ||
| initializeLightbox(); | initializeLightbox(); | ||
| - | // alternatively for initializeLightbox(); | + | // Alternativ zu initializeLightbox(); |
| + | // $GLOBALS['block']['['css']']['lightbox.css'] = ' ../lib/slimbox/slimbox.css'; | ||
| // $GLOBALS['block']['custom_htmlhead']['slimbox.js'] = ' <script type="text/javascript" src="template/slimbox/js/slimbox.js" ></script>'; | // $GLOBALS['block']['custom_htmlhead']['slimbox.js'] = ' <script type="text/javascript" src="template/slimbox/js/slimbox.js" ></script>'; | ||
| </code> | </code> | ||
| - | \\ | + | |
| + | ~~UP~~ | ||
| ===== Init SwfObject JS Library ===== | ===== Init SwfObject JS Library ===== | ||
| Line 111: | Line 258: | ||
| </code> | </code> | ||
| - | \\ | + | ~~UP~~ |
| Line 192: | Line 339: | ||
| - | \\ | + | ~~UP~~ |
| \\ | \\ | ||
| Line 226: | Line 373: | ||
| - | \\ | + | ~~UP~~ |
| ===== Subsequent exchange of a CSS file, which is registered in the Template ===== | ===== Subsequent exchange of a CSS file, which is registered in the Template ===== | ||