Differences

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

deutsch:ersetzer_rts:frontend_init:cp_trigger:sort-section [2010/02/17 13:26]
Knut Heermann (flip-flop)
deutsch:ersetzer_rts:frontend_init:cp_trigger:sort-section [2018/06/03 18:09] (current)
Line 26: Line 26:
**Version:** V1.1 //(09.02.2010)// \\ **Version:** V1.1 //(09.02.2010)// \\
**Update:** V1.2 //(15.02.2010)//  \\ **Update:** V1.2 //(15.02.2010)//  \\
- * Genereller CP Identifizierer %%<!--SORT_INTO_NEW_BLOCKS//-->%% \\+ * Genereller CP Identifizierer %%<!--SORT_INTO_NEW_BLOCKS_V12//-->%% \\
 * Erstes IF geändert um immer alle drei CPs zu erfassen 29,31,32 \\  * Erstes IF geändert um immer alle drei CPs zu erfassen 29,31,32 \\
-**Download**-PHP: {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:cp_trig_sort_section.zip|}} //(V1.2)//+**Update:** V1.3 //(20.02.2010)// \\ 
 + * Nur notwendig für sehr spezielle JavaScriptanwendungen \\ 
 + * Genereller CP Identifizierer geändert von %%<!--SORT_INTO_NEW_BLOCKS//-->%% nach %%<!--SORT_INTO_NEW_BLOCKS_V13//-->%% \\ 
 + 
 + 
 +**Download**-PHP: {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:cp_trig_sort_section_v12.zip|}} //(V1.2)// \\ 
 +**Download**-PHP: {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:cp_trig_sort_section_v13.zip|}} //(V1.3)// 
**Bedingung:**  -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\ **Bedingung:**  -> [[http://www.phpwcms-docu.de/confincphp_de.phtml|/config/phpwcms/conf.inc.php]] \\
Line 233: Line 240:
{{:deutsch:ersetzer_rts:frontend_init:cp_trigger:register_tabs_sort_temp01_1.gif|}} {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:register_tabs_sort_temp01_1.gif|}}
-**Dateiname:** tab_sort_section.tmpl \\+**Dateiname:** tab_sort_section_v12.tmpl \\
**Ort:**   template/inc_cntpart/tabs/ **Ort:**   template/inc_cntpart/tabs/
Hier müssen noch die Wrapper-Tags eingesetzt werden: Hier müssen noch die Wrapper-Tags eingesetzt werden:
-<code html |h Register Tabs |h>+<code html |h tab_sort_section_v12.tmpl |h>
<!--TABS_START//--> <!--TABS_START//-->
-<!--SORT_INTO_NEW_BLOCKS//-->+<!--SORT_INTO_NEW_BLOCKS_V12//-->
[TITLE]<h3>{TITLE}</h3>[/TITLE] [TITLE]<h3>{TITLE}</h3>[/TITLE]
Line 298: Line 305:
<note important> <note important>
**Wichtig:** **Wichtig:**
-<code><!--SORT_INTO_NEW_BLOCKS//--></code> muss im Template und im PHP-Script identisch eingetragen werden um dieses Script genau für dieses Template zu identifizieren.+<code><!--SORT_INTO_NEW_BLOCKS_V12//--></code> muss im Template und im PHP-Script identisch eingetragen werden um dieses Script genau für dieses Template zu identifizieren.
</note> </note>
Line 319: Line 326:
===== PHP Script V1.2: ===== ===== PHP Script V1.2: =====
-**Dateiname:** cp_trig_sort_section.php \\ +**Dateiname:** cp_trig_sort_section_v12.php \\ 
-**Ort:**   template/inc_script/frontend_init/ \\ +**Verzeichnis:**   template/inc_script/frontend_init/ \\ 
-**Download**: {{:deutsch:ersetzer_rts:frontend_init:cp_trigger:cp_trig_sort_section.zip|}} +
-<code php |h cp_trig_sort_section.php |h>+<code php |h cp_trig_sort_section_v12.php |h>
<?php <?php
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
Line 335: Line 342:
 * V1.1  09.02.10 K.Heermann  http://planmatrix.de  * V1.1  09.02.10 K.Heermann  http://planmatrix.de
 * Update: 15.02.10 V1.2  * Update: 15.02.10 V1.2
- * - new general cp identifier <!--SORT_INTO_NEW_BLOCKS//-->+ * - new general cp identifier <!--SORT_INTO_NEW_BLOCKS_V12//-->
 * - change first "if statement" to all three cp´s 29,31,32  * - change first "if statement" to all three cp´s 29,31,32
 * ------------------------------------------------------------------------------------------- */  * ------------------------------------------------------------------------------------------- */
-function CP_TRIG_SORT_SECTION($text, & $data) {+function CP_TRIG_SORT_SECTION_V12($text, & $data) {
//function CP_IMAGES_SORT_THUMBS_AND_IMAGES($text, & $data) { //function CP_IMAGES_SORT_THUMBS_AND_IMAGES($text, & $data) {
Line 437: Line 444:
} // ---- END function } // ---- END function
-register_cp_trigger('CP_TRIG_SORT_SECTION');+register_cp_trigger('CP_TRIG_SORT_SECTION_V12');
?> ?>
</code> </code>
 +
 +
 +\\
 +===== PHP Script V1.3: =====
 +<file>
 +* Update: 20.02.10 V1.3
 +  * Identifizierer von <!--SORT_INTO_NEW_BLOCKS//--> nach <!--SORT_INTO_NEW_BLOCKS_V13//--> geändert.
 +  * Neuer Zähler um die Gesamtsumme der Tabs zu erhalten [COUNTX_TOTAL] (Für spezielle JS Anwedungen.
 +  * Neue Platzhalter [CLASS_0yX_FIRST/LAST] z.B.
 +    * Definition: [CLASS_01X_FIRST]......[/CLASS_01X_FIRST]
 +    * Platzhalter: [CLASS_01X_FIRST]
 +  * In die erste und/oder letzte Zeile (Tab) eines Blocks können Strings eingefügt werden (z.B.:class="active")
 +</file>
 +
 +Das Update ist nur notwendig für Scripte die z.B. eine spezielle Klasse im ersten oder/und letzten Tab beim ersten Seitenaufruf benötigen. \\
 +-> Z.B.: [[deutsch/phpwcms-system/artikel/contentparts/register-tabs/mootools-nutabs#template|nuTabs (MooTools v1.2x)]]
 +
 +<note>
 +**UPdate V1.3:**
 +
 +Identifizierer \\
 +von **%%<!--SORT_INTO_NEW_BLOCKS//-->%%** \\
 +nach **%%<!--SORT_INTO_NEW_BLOCKS_V13//-->%%** geändert :!:
 +
 +**Bitte auf Namensgleichheit für die Tags im Template und im PHP-Script achten - Bsp.:**
 +\\
 +
 +  * ** Template:**
 +    * [**BLOCK_02X**_SUFFIX]  ''%%// Definition%%''
 +    * [**BLOCK_02X**]         ''%%// Platzhalter%%''
 +    * [**CLASS_02X**_FIRST] ''%%// Definition%%''
 +    * [**CLASS_02X_FIRST**]     ''%%// Platzhalter%%''
 +
 +\\
 +
 +  * ** PHP-Script:**
 +    * $sec[2] = '**BLOCK_02X**';
 +    * $cla[2] = '**CLASS_02X**';
 +</note>
 +\\
 +
 +**Dateiname:** cp_trig_sort_section_v13.php \\
 +**Ort:**   template/inc_script/frontend_init/  \\
 +
 +
 +<code php |h cp_trig_sort_section_v13.php |h>
 +<?php
 +// -------------------------------------------------------------------------------------------
 +// obligate check for phpwcms constants
 +  if (!defined('PHPWCMS_ROOT')) {die("You Cannot Access This Script Directly, Have a Nice Day.");}
 +// -------------------------------------------------------------------------------------------
 + 
 +/**
 + * * -------------------------------------------------------------------------------------------
 + * Sort particular sections into separate blocks
 + * V1.1  09.02.10 K.Heermann  http://planmatrix.de
 + * Update: 15.02.10 V1.2
 + * - new general cp identifier <!--SORT_INTO_NEW_BLOCKS//-->
 + * - change first "if statement" to all three cp´s 29,31,32
 + * Update: 20.02.10 V1.3
 + * - Indetifier changed from <!--SORT_INTO_NEW_BLOCKS//--> to <!--SORT_INTO_NEW_BLOCKS_V13//-->
 + * - new counter for "Total number tabs" [COUNTX_TOTAL] for some specail JS.
 + * - new [CLASS_0yX_FIRST/LAST] placeholder e.g. [CLASS_01X_FIRST]...[/CLASS_01X_FIRST], [CLASS_02X]
 + * . for every block to inject strings (eg.:class="active") into the first and/or last tab
 + * ------------------------------------------------------------------------------------------- */
 +
 +
 +function CP_TRIG_SORT_SECTION_V13($text, & $data) {
 +//function CP_IMAGES_SORT_THUMBS_AND_IMAGES($text, & $data) {
 +
 +// ======= CUSTOM vars ========================================================
 +
 +$cp_identification = '<!--SORT_INTO_NEW_BLOCKS_V13//-->';  // cp identifier
 +
 +// use only if the CP IDs should be indicated (very fast)
 +// $cp_cpID = array(14,25,116);
 +$sec[1] = 'BLOCK_01X'; // wrapper of the first section
 +$cla[1] = 'CLASS_01X'; // class for the first/last line in block
 +$sec[2] = 'BLOCK_02X'; // wrapper of the second section
 +$cla[2] = 'CLASS_02X'; // class for the first/last line in block
 +
 +// Only an estupid example, kill this entry)
 +$sec[3] = 'BLOCK_NIXX'; // wrapper of the third section
 +$cla[3] = 'CLASS_NIXX'; // class for the first/last line in block
 +// ============================================================================
 +
 +
 + // CP: 29 => image <div>   CP: 31 => image special    CP: 32 => register tabs
 +
 + if(($data['acontent_type'] == 29
 + OR $data['acontent_type'] == 31
 + OR $data['acontent_type'] == 32) AND strpos($text, $cp_identification) ) {
 +
 + // use only if the CP IDs should be indicated (very fast)
 +// if (in_array ($data['acontent_id'],$cp_cpID) ) {
 +
 + $_text = array();
 +
 + // Catch the content area from template
 +
 + preg_match_all('/\[CP_TRIG_CONTENT\](.*?)\[\/CP_TRIG_CONTENT\]/ism',$text, $_text['content_area']);
 +
 + if ($_text['content_area'][1][0]) {  // is there any content?
 +
 + // some parameters ---------
 + $defsec = array();
 + $_count = count($_text['content_area'][1]);
 +
 + foreach ($sec as $key=>$value) {
 +
 + $defsec[$key]['pref'] = $value.'_PREFIX'; // prefix for the first section
 + $defsec[$key]['suff'] = $value.'_SUFFIX'; // suffix for the first section
 + $defcla[$key]['first'] = $cla[$key].'_FIRST'; // e.g. class only for the first line entry
 + $defcla[$key]['last'] = $cla[$key].'_LAST'; // e.g. class only for the last line entry
 + }
 +
 + // Catch content section by section and sort into the right block --------
 +
 + foreach ( $_text['content_area'][1] as $key01 => $value01 ) {
 +
 + foreach ($sec as $key02=>$value02) {
 + // parsing particular section
 + preg_match('/\['.$value02.'\](.*?)\[\/'.$value02.'\]/ism',$value01, $_temp);
 +
 + $_temp[1] = str_replace('[COUNTX]', $key01+1, $_temp[1]);  // insert running counter
 +
 + // kill placeholder CLASS in all lines > first line and < last line
 + if ($key01 > 0) $_temp[1] = str_replace('['.$defcla[$key02]['first'].']','', $_temp[1]);
 + if ($key01 < $_count-1) $_temp[1] = str_replace('['.$defcla[$key02]['last'].']' ,'', $_temp[1]);
 +
 + $_text['content'][$key02] .= $_temp[1].LF;
 +
 + }
 + }
 +
 +
 + // Parsing the definition list ----------------------------------
 +
 + preg_match_all('/\[CP_TRIG_DEFINITION\](.*?)\[\/CP_TRIG_DEFINITION\]/ism',$text, $_text['definition']);
 +
 + if ($_text['definition'][1][0]) {  // is there any content in definition section?
 +
 + foreach ($defsec as $key=>$value) {
 +
 + if (preg_match('/\['.$value['pref'].'\](.*?)\[\/'.$value['pref'].'\]/ism',$_text['definition'][1][0], $_temp))
 + $_text['content'][$key] = $_temp[1] . $_text['content'][$key];  // Davorsetzen
 + else $_text['content'][$key] = LF.'<!-- no definiton begin //-->'.LF . $_text['content'][$key];
 +
 + if (preg_match('/\['.$value['suff'].'\](.*?)\[\/'.$value['suff'].'\]/ism',$_text['definition'][1][0], $_temp))
 + $_text['content'][$key] .= $_temp[1];  // Anhaengen
 + else $_text['content'][$key] .= '<!--no definiton end //-->'.LF;
 +
 + // CLASS available ?  -> replace the CLASS_yX_FIRST and CLASS_yX_LAST
 + if (preg_match('/\['.$defcla[$key]['first'].'\](.*?)\[\/'.$defcla[$key]['first'].'\]/ism',$_text['definition'][1][0], $_temp))
 + $_text['content'][$key] = str_replace('['.$defcla[$key]['first'].']',$_temp[1],$_text['content'][$key]);
 +
 + if (preg_match('/\['.$defcla[$key]['last'].'\](.*?)\[\/'.$defcla[$key]['last'].'\]/ism',$_text['definition'][1][0], $_temp))
 + $_text['content'][$key] = str_replace('['.$defcla[$key]['last'].']',$_temp[1],$_text['content'][$key]);
 + }
 +
 + }
 +
 +
 + // Kill all DEFINITION entries in template
 +
 + $text = preg_replace('/\[CP_TRIG_DEFINITION\](.*?)\[\/CP_TRIG_DEFINITION\]/ism', '', $text);  
 +
 + // Insert new sorted content ------------------------------------
 + $_temp = '';
 + foreach ($_text['content'] as $value) {
 + $_temp .= LF.$value;
 + }
 +
 +
 + $text = preg_replace('/\[CP_TRIG_WRAP_CONTENT\](.*?)\[\/CP_TRIG_WRAP_CONTENT\]/ism', '<!--new_sort_order//-->'.$_temp, $text);  // fill content
 + $text = str_replace ('[COUNTX_TOTAL]',$key01+1, $text);  // Set COUNTX_SUM (block count) outsite my range e.g. in PHP Section :)
 + }
 + }
 +
 + return $text;
 +
 +} // ---- END function
 +
 +register_cp_trigger('CP_TRIG_SORT_SECTION_V13');
 +
 +?>
 +</code>
 +
deutsch/ersetzer_rts/frontend_init/cp_trigger/sort-section.1266409586.txt.gz · Last modified: 2018/06/03 18:07 (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