Differences

This shows you the differences between two versions of the page.

deutsch:technik:aufruf-interner-funktionen:skript-in-den-head-bereich [2009/04/25 08:06]
127.0.0.1 external edit
deutsch:technik:aufruf-interner-funktionen:skript-in-den-head-bereich [2018/06/03 18:08] (current)
Line 16: Line 16:
Die Prozeduren können auch in einem frontend_render-Skript abgelegt werden. Die Prozeduren können auch in einem frontend_render-Skript abgelegt werden.
-Der **Skript-Dateiname** //(here: $block['custom_htmlhead']['**...script...**'])// wird immer als Array Index verwendet.+Der **Skript-Dateiname** //(hier: $block['custom_htmlhead']['**...script...**'])// wird immer als Array Index verwendet.
-Bsp.:  +Bsp. frontend_render-Skript:  
-<code php|h script into head area |h>+<code php>
<?php <?php
Line 25: Line 25:
   $block['custom_htmlhead']['mootools.js']   = '  <script src="'.TEMPLATE_PATH.'inc_js/mootools/mootools-release-1.11.js" type="text/javascript"></script>';    $block['custom_htmlhead']['mootools.js']   = '  <script src="'.TEMPLATE_PATH.'inc_js/mootools/mootools-release-1.11.js" type="text/javascript"></script>';
-   /* Load Mootools in newer releases */+   /* Load Mootools in newer releases < V1.4.3 r380 */
   initMootools();    initMootools();
 +
 +
 +   /* Load Mootools in newer releases >= V1.4.4 r381 */
 +   initJSLib();
 +
   /* Load My custom JavaScript */    /* Load My custom JavaScript */
   $block['custom_htmlhead']['my.js']      = '  <script src="'.TEMPLATE_PATH.'inc_js/my.js" type="text/javascript"></script>';    $block['custom_htmlhead']['my.js']      = '  <script src="'.TEMPLATE_PATH.'inc_js/my.js" type="text/javascript"></script>';
 +   /* or alternatively */
 +   $block['custom_htmlhead']['my.js']      =    getJavaScriptSourceLink('template/inc_js/my.js');
     
   /* Load some other <head> positions */    /* Load some other <head> positions */
Line 47: Line 54:
?> ?>
</code> </code>
 +
 +\\
 +
 +<note>
 +Sollen php-Anweisungen direkt in einem Template ausgeführt werden, wird der TAG **%%[PHP]%%**%% ... Anweisungen ...%%**%%[/PHP]%%** verwendet. \\ Außerdem ist ein direkter Zugriff auf die oben gezeigt Variablen aus %%[PHP] ... [/PHP]%% nicht möglich, dazu muss dann $GLOBALS bemüht werden. \\ Bsp.: <code>$GLOBALS['block']['custom_htmlhead']['my.js']</code> anstatt <code>$block['custom_htmlhead']['my.js']</code>
 +
 +</note>
\\ \\
Line 55: Line 69:
<code php> <code php>
$GLOBALS['block']['css']['reg_tabs_accordion01_login'] = 'specific/reg_tabs_accordion01_login.css'; $GLOBALS['block']['css']['reg_tabs_accordion01_login'] = 'specific/reg_tabs_accordion01_login.css';
 +</code>
 +
 +
 +\\
 +
 +
 +==== Ab phpwcms r411: ====
 +
 +Forum: [[http://forum.phpwcms.org/viewtopic.php?p=127961#p127961|…and some more too]]
 +
 +<note important>
 +**Notation:** %%<!--%%##%% %%##%%[CSS:|JS:]%%##%% %%##Anweisung##%% %%##%%-->%%
 +
 +Die gekennzeichneten Leerzeichen##%% %%##  sind zwingend!!
 +</note>
 +
 +=== CSS: ===
 +
 +
 +<code css>
 +<!-- CSS: {TEMPLATE}inc_css/my.css -->
 +</code>
 +\\
 +
 +- Als Inline CSS:
 +
 +<code css>
 +<!-- CSS: body {background:yellow;} -->
 +<!-- CSS:
 +  body {
 +    background:yellow;
 +  }
 +  a {
 +    text-decoration: none;
 +    background: transparent url({TEMPLATE}img/link.png) no-repeat left center;
 +    padding-left: 25px;
 +  }
 +-->
 +</code>
 +
 +\\
 +
 +=== JavaScript: ===
 +Aktuell im Sitetemplate ausgewählte (aber nicht standardmäßig zu laden aktivierte) js-libary starten:
 +<code html>
 +<!-- JS: initJSLib -->
 +</code>
 +\\
 +- andere JS-Dateine einbinden
 +<code html>
 +<!-- JS: {TEMPLATE}inc_js/calendarDateInput/calendarDateInputX.js -->
 +<!-- JS: {TEMPLATE}inc_js/MyFolder/MyScript.js -->
 +</code>
 +
 +\\
 +- Plugins einbinden (jQuery) z.B. mit den Dateien in:
 +  * template/lib/jquery/plugin/ui-1.8.custom.min.js
 +  * template/lib/jquery/plugin/jquery.easing.min.js
 +
 +<code html>
 +<!-- JS: ui-1.8.custom.min -->
 +<!-- JS: easing.min -->
 +</code>
 +
 +\\
 +Analog dazu für MooTools :
 +
 +- Plugins einbinden z.B. MooTools 1.2x mit den Dateien in:
 +  * template/lib/mootools/plugin-1.2/mootools.flext.js
 +  * template/lib/mootools/plugin-1.2/mootools.Quickie-yui.js
 +
 +<code html>
 +<!-- JS: flext -->
 +<!-- JS: Quickie-yui -->
 +</code>
 +
 +\\
 +- Laden von More Komponenten:
 +
 +<code html>
 +<!-- JS: myplugin -->
 +<!-- JS: MORE:Fx/Fx.Elements,Fx/Fx.Accordion -->
 +</code>
 +\\
 +
 +- Mehrzeiliges JavaScript als <script /> im "head" Bereich.
 +
 +Alle gleichen JavaScript-Abschnitt wie in sich wiederholenden ContentParts einmal gerendert. \\
 +Um als JavaScript erkannt zu werden brauchen wir ##%%;%%##, ##%%//%%## und/oder ##%%/*%%##.\\
 +Der Abschluss einer JavaScript Zeile mit einem ##%%;%%## ist der sicherste Weg:
 +
 +<code html>
 +<!-- JS:
 +  // My Custom JS
 +  alert('hey dude it works as expected');
 +-->
</code> </code>
Line 67: Line 177:
Um CSS- oder JS-Dateien in die Frontendeausgabe des Moduls im <head> Bereich einzubinden wird folgender Code hinzugefügt:   Um CSS- oder JS-Dateien in die Frontendeausgabe des Moduls im <head> Bereich einzubinden wird folgender Code hinzugefügt:  
-<code php|h script into module head area |h>+<code php>
// ==== load js functions // ==== load js functions
$block['custom_htmlhead']['javascript.js'] = '  <script src="'.$phpwcms['modules'][$crow['acontent_module']]['dir'].'template/js/javascript.js" type="text/javascript"></script>'; $block['custom_htmlhead']['javascript.js'] = '  <script src="'.$phpwcms['modules'][$crow['acontent_module']]['dir'].'template/js/javascript.js" type="text/javascript"></script>';
deutsch/technik/aufruf-interner-funktionen/skript-in-den-head-bereich.1240639561.txt.gz · Last modified: 2018/06/03 18:06 (external edit)
www.planmatrix.de www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0