Differences

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

deutsch:ersetzer_rts:frontend_init:cp_trigger:sort-section [2010/02/21 01:39]
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 \\
-**Update:** V1.3 //20.02.10// \\ 
- * Nur notwendig für sehr spezielle JavaScripte  
-**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 235: 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 300: 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 324:
 +===== PHP Script V1.2: =====
 +
 +**Dateiname:** cp_trig_sort_section_v12.php \\
 +**Verzeichnis:**   template/inc_script/frontend_init/ \\
 +
 +
 +<code php |h cp_trig_sort_section_v12.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_V12//-->
 + * - change first "if statement" to all three cp´s 29,31,32
 + * ------------------------------------------------------------------------------------------- */
 +
 +
 +function CP_TRIG_SORT_SECTION_V12($text, & $data) {
 +//function CP_IMAGES_SORT_THUMBS_AND_IMAGES($text, & $data) {
 +
 +// ======= CUSTOM vars ========================================================
 +
 +$cp_identification = '<!--SORT_INTO_NEW_BLOCKS//-->';  // 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
 +$sec[2] = 'BLOCK_02X'; // wrapper of the second section
 +
 +// Only an estupid example, kill this entry)
 +$sec[3] = 'BLOCK_NIXX'; // wrapper of the third section
 +// ============================================================================
 +
 +
 + // 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();
 +
 + 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
 + }
 +
 +
 + // 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]);
 + $_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];
 + 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];
 + else $_text['content'][$key] .= '<!--no definiton end //-->'.LF;
 +
 + }
 +
 + }
 +
 +
 + // 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
 + }
 + }
 +
 + return $text;
 +
 +} // ---- END function
 +
 +register_cp_trigger('CP_TRIG_SORT_SECTION_V12');
 +
 +?>
 +</code>
 +
 +
 +\\
===== PHP Script V1.3: ===== ===== PHP Script V1.3: =====
<file> <file>
* Update: 20.02.10 V1.3 * 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.   * 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.   * Neue Platzhalter [CLASS_0yX_FIRST/LAST] z.B.
Line 328: Line 461:
  * In die erste und/oder letzte Zeile (Tab) eines Blocks können Strings eingefügt werden (z.B.:class="active")   * In die erste und/oder letzte Zeile (Tab) eines Blocks können Strings eingefügt werden (z.B.:class="active")
</file> </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> <note>
**UPdate V1.3:** **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.:** **Bitte auf Namensgleichheit für die Tags im Template und im PHP-Script achten - Bsp.:**
Line 349: Line 489:
\\ \\
-**Dateiname:** cp_trig_sort_section.php \\+**Dateiname:** cp_trig_sort_section_v13.php \\
**Ort:**   template/inc_script/frontend_init/  \\ **Ort:**   template/inc_script/frontend_init/  \\
-<code php |h cp_trig_sort_section.php |h>+<code php |h cp_trig_sort_section_v13.php |h>
<?php <?php
// ------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------
Line 368: Line 508:
 * - change first "if statement" to all three cp´s 29,31,32  * - change first "if statement" to all three cp´s 29,31,32
 * Update: 20.02.10 V1.3  * 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 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]  * - new [CLASS_0yX_FIRST/LAST] placeholder e.g. [CLASS_01X_FIRST]...[/CLASS_01X_FIRST], [CLASS_02X]
Line 374: Line 515:
-function CP_TRIG_SORT_SECTION($text, & $data) {+function CP_TRIG_SORT_SECTION_V13($text, & $data) {
//function CP_IMAGES_SORT_THUMBS_AND_IMAGES($text, & $data) { //function CP_IMAGES_SORT_THUMBS_AND_IMAGES($text, & $data) {
// ======= CUSTOM vars ======================================================== // ======= CUSTOM vars ========================================================
-$cp_identification = '<!--SORT_INTO_NEW_BLOCKS//-->';  // cp identifier+$cp_identification = '<!--SORT_INTO_NEW_BLOCKS_V13//-->';  // cp identifier
// use only if the CP IDs should be indicated (very fast) // use only if the CP IDs should be indicated (very fast)
Line 490: Line 631:
} // ---- END function } // ---- END function
-register_cp_trigger('CP_TRIG_SORT_SECTION');+register_cp_trigger('CP_TRIG_SORT_SECTION_V13');
?> ?>
</code> </code>
deutsch/ersetzer_rts/frontend_init/cp_trigger/sort-section.1266712785.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