Differences

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

deutsch:ersetzer_rts:frontend_render:artikel-menue-archiv [2009/08/16 00:49]
Knut Heermann (flip-flop)
— (current)
Line 1: Line 1:
-{{indexmenu_n>700}} 
-====== Artikelmenü (+Archiv) ====== 
- 
- 
-**Ein RT wie CP Artikelmenü, erweitert um auch archivierte Artikel anzeigen zu können.** 
- 
-**rt_article_menu_archive** V1.0  23.03.09   
- 
-**Update: 16.08.09 KH:** + Zähler für "Wie viele der ersten Artikel werden ausgeblendet" 
- 
-**Syntax:** {ARTICLE_MENU_ARCHIVE:category-ID, count-hide} //(Beide Parameter müssen gesetzt sein)//  \\ 
- 
-Bsp.:{ARTICLE_MENU_ARCHIVE:-1,0}  //Aktuelle Kategorie, kein führender Artikel ausgeblendet// \\ 
-Bsp.:{ARTICLE_MENU_ARCHIVE:23,2}  //Artikel in der Kategorie mit der ID 23, die beiden ersten Artikel werden nicht angezeigt// \\ 
- 
- 
- 
-Docu: -- \\ 
-Forum: -- 
- 
-**Autor:** K.Heermann (flip-flop) http://planmatrix.de \\ 
-**CMS Version:** >= 1.4 \\  
-**Version:** V1.0 \\ 
- 
-Basierend auf dem CP Artikelmenü.  
- 
-Tag: **{ARTICLE_MENU_ARCHIVE:category-ID, count-hide}** oder **{ARTICLE_MENU_ARCHIVE:-1, count-hide}** für aktuelle Kategorie 
- 
-Dateiname: **rt_article_menu_archive.php**  
- 
-Ort:  ** template/inc_script/frontend_init/ **  
- 
-**Bedingung:** -> [[http://www.phpwcms-docu.de/config_dateien.phtml|/config/phpwcms/conf.inc.php]] \\ 
- 
-  * ##$phpwcms['allow_ext_render'] = 1;##  
- 
- 
----- 
----- 
- 
- 
-<code php |h article menu archive |h > 
-<?php 
-/************************************************************************************* 
-   Copyright notice 
-    
-   (c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. 
-  
-   This script is part of PHPWCMS. The PHPWCMS web content management system is 
-   free software; you can redistribute it and/or modify it under the terms of 
-   the GNU General Public License as published by the Free Software Foundation; 
-   either version 2 of the License, or (at your option) any later version. 
-   
-   The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html 
-   A copy is found in the textfile GPL.txt and important notices to the license  
-   from the author is found in LICENSE.txt distributed with these scripts. 
-   
-   This script is distributed in the hope that it will be useful, but WITHOUT ANY  
-   WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A 
-   PARTICULAR PURPOSE.  See the GNU General Public License for more details. 
-  
-   This copyright notice MUST APPEAR in all copies of the script! 
-   
-------------------------------------------------------------------------------------- 
-15.03.09 KH (flip-flop) CP article menu cut out (frontend snippet) 
-   Enhanced for showing archived articles 
-   {ARTICLE_MENU_ARCHIVE:category-ID} 
-...If you use the automatic for category-ID, please set category-ID = -1 (actual category is fetched) 
-   E.g.:{ARTICLE_MENU_ARCHIVE:-1} 
-    
-16.08.09 KH Update + counter for How many leading articles must be hide 
-   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide} 
-   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0}  (Both parameters must be set) 
-*************************************************************************************/ 
- 
-// ---------------------------------------------------------------- 
-// obligate check for phpwcms constants 
-if (!defined('PHPWCMS_ROOT')) { 
-   die("You Cannot Access This Script Directly, Have a Nice Day."); } 
-// ---------------------------------------------------------------- 
- 
- 
-//article menu enhanced 
-// $catid: the category ID where the articles are (-1 = actual category)) 
-// $leading_article_hide: How many leading articles must be hide 
- 
-function my_article_menu_archive ($catid = 0, $leading_article_hide = 0, $CNT_TMP = '') { 
- 
-global $aktion; 
- 
- 
-// ===== Simulated CP paramter ================================================ 
- 
-// 0: all articles 
-// 1: article_archive_status=1 AND article_begin<NOW() AND article_end<NOW() 
-// 2: article_archive_status=1 AND article_begin<NOW() AND article_end>NOW() 
-// 3: article_archive_status=1 AND article_begin>NOW() AND article_end>NOW() 
- 
-// 4: article_archive_status=0 AND article_begin<NOW() AND article_end<NOW() 
-// 5: article_archive_status=0 AND article_begin<NOW() AND article_end>NOW() 
-// 6: article_archive_status=0 AND article_begin>NOW() AND article_end>NOW() 
- 
-$article_archive_status       = 2;  // Show entries with activated archive status? 
- 
- 
-// How many leading articles must be hide (hardcoded) ---------------------- 
- 
-// $leading_article_hide         = 1;  // default: 0 (now article hide) 
- 
- 
-// CSS classes and IDs ---------------------- 
- 
-$alinkmenu['wrap_all']        = array('<div class="vlist">','</div>');    // Wrap around all 
-$alinkmenu['wrap_data']       = array('','');                             // Data wrap begin, end 
-$alinkmenu['wrap_title']      = array('','');                             // Title wrap around all  begin, end 
-$alinkmenu['wrap_subtitle']   = array('','');                             // SubTitle wrap begin, end 
-$alinkmenu['wrap_summary']    = array('','');                             // Wrap around summary  begin, end 
-$alinkmenu['class_active_link'] = 'active_link';                          // Active link class 
- 
- 
-$alinkmenu["style_before"] = '';  // Format before every data set. 
-$alinkmenu["style_behind"] = '';  // Format behind every data set. 
- 
- 
-/* 
-// CSS classes and IDs ---------------------- 
- 
-$alinkmenu['wrap_all']        = array('<div class="teaser_right">','</div>');                   // Wrap around all 
-$alinkmenu['wrap_data']       = array('','');                                                   // Data wrap begin, end 
-$alinkmenu['wrap_title']      = array('<div style="padding-bottom:2px; "><h6>','</h6></div>');  // Title wrap around all  begin, end 
-$alinkmenu['wrap_subtitle']   = array('<p style="font-size: 0.8em;  ">','</p>');                // SubTitle wrap begin, end 
-$alinkmenu['wrap_summary']    = array('','');  // Wrap around summary  begin, end 
-$alinkmenu['class_active_link'] = 'active_link';                                                // Active link class 
- 
- 
- 
-$alinkmenu["style_before"] = '';  // Format before every data set. 
-// Format behind every data set. 
-$alinkmenu["style_behind"] = '<div style="margin:5px 0 8px 0;padding:0;height:1px;border:0;border-bottom:1px dotted #CCCCCC;clear:both"><!-- line //--></div>'; 
-*/ 
- 
-// Insert title/subtitle name and css for the virtual content part  
-$virt_article_title      = '';    // <div id="box02_top_header"><h1>MyTitle</h1></div> 
-$virt_article_subtitle   = '';    // <div id="box02_top_header"><h2>MySubTitle</h2></div> 
- 
- 
-$alinkmenu['subtitle_on']   = 0;            // Article sub title text output [0|1] 
- 
-// Content part parameters ------------------ 
-$alinkmenu['headertext']    = 0;            // summary text [0|1] 
-$alinkmenu['ul']            = 2;            // 1: render as unordered list / 2: render as div /  3: render as table 
-$alinkmenu['class']         = '';           // wrapped class 
-$alinkmenu['maxchar']       = 0;            // maxchars summary  
-$alinkmenu['morelink']      = ' &raquo;';   // more link text 
-$alinkmenu['hideactive']    = 0;            // hide active article in article menu 
- 
- 
- 
-/* Sorting order for "second entry"  
-------------------------------  
- $ao[2] = ' article_sort ASC';  
- $ao[2] = ' article_sort DESC'; 
- $ao[2] = ' article_created ASC'; 
- $ao[2] = ' article_created DESC'; 
- $ao[2] = ' article_tstamp ASC'; 
- $ao[2] = ' article_tstamp DESC'; 
- $ao[2] = ' article_begin ASC'; 
- $ao[2] = ' article_begin DESC'; 
- $ao[2] = ' article_title ASC'; 
- $ao[2] = ' article_title DESC'; 
- $ao[2] = ' article_end ASC'; 
- $ao[2] = ' article_end DESC'; 
-  
- $ao[2] = ' article_priorize DESC,'.$ao[2]; 
- ------------------------------ */ 
- 
-// Sorting order ---------------------------- 
- $ao['2']  = ' article_priorize DESC,'; // Don´t change 
- $ao['2'] .= ' article_sort ASC';       // second entry 
-  
- 
-// ===== END defination ======================================================= 
- 
-// catid = -1: The actual category is fetched 
-$alinkmenu["catid"]         = ($catid < 0) ? $GLOBALS['content']['cat_id'] : $catid; // Article category-ID 
-$alinkmenu['link']          = '';     // reserved, don´t change 
- 
- 
-switch($article_archive_status) {  
-  case 0:   // article_archive_status ist not set 
-    $alinkmenu['article_archive_status'] = ' ';  
-    break; 
-  case 1:    
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin<NOW() AND article_end<NOW() ';  
-    break; 
-   
-  case 2:    
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin<NOW() AND article_end>NOW() ';  
-    break; 
-   
-  case 3:    
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin>NOW() AND article_end>NOW() ';  
-    break; 
- 
-  case 4:    
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=0 AND article_begin<NOW() AND article_end<NOW() ';  
-    break; 
-   
-  case 5:    
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=0 AND article_begin<NOW() AND article_end>NOW() ';  
-    break; 
-   
-  case 6:    
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=0 AND article_begin>NOW() AND article_end>NOW() ';  
-    break; 
- 
-  default:  
-    $alinkmenu['article_archive_status'] = 'AND article_archive_status=1 AND article_begin<NOW() AND article_end<NOW() '; 
-} 
- 
- 
-$alink_sql  = "SELECT article_id, article_title ,article_subtitle, article_cid, article_summary "; 
-$alink_sql .= "FROM ".DB_PREPEND."phpwcms_article "; 
-$alink_sql .= "WHERE article_public=1 AND article_aktiv=1 AND article_deleted=0 "; 
-$alink_sql .= 'AND article_cid='.intval($alinkmenu["catid"]).' '; 
-$alink_sql .= $alinkmenu['article_archive_status']; 
- 
-if(!empty($alinkmenu['hideactive'])) { 
- 
-  $alink_sql .= 'AND article_id != '. $aktion[1] . ' '; 
-} 
-$alink_sql .= 'ORDER BY ' . $ao[2] ; 
- 
- 
-$result = _dbQuery($alink_sql); 
- 
- 
- if(isset($result[$leading_article_hide]['article_id'])) { 
- 
-  $count = 0; 
- 
-  foreach($result as $value) { 
- 
-   if( $count >= $leading_article_hide ) {  // Hide first articles? 
- 
-    $tempRowSpan      = ''; 
- 
-    $value['article_summary'] = preg_replace('/<br[^>]*?>$/i', '', $value['article_summary']);  // article_summary 
- 
- 
-    if($alinkmenu['headertext'] && !empty($value['article_summary'])) { 
-     
-      $alinkmenu['sum'] = $value['article_summary']; 
-       
-       
-      if(!empty($alinkmenu['maxchar'])) { 
-       
-        $alinkmenu['sum']     = clean_replacement_tags($alinkmenu['sum']); 
-        $alinkmenu['sum']     = remove_unsecure_rptags($alinkmenu['sum']); 
-        $alinkmenu['sum']     = preg_replace('/\s/i', ' ', $alinkmenu['sum']); 
-        $alinkmenu['sum']     = preg_replace('/\s{2,}/i', ' ', $alinkmenu['sum']); 
-        $alinkmenu['sum']     = trim(decode_entities($alinkmenu['sum'])); 
-        $alinkmenu['sum']   = wordwrap($alinkmenu['sum'], $alinkmenu['maxchar'], "\n"); 
-        list($alinkmenu['sum']) = explode("\n", $alinkmenu['sum']); 
-        $alinkmenu['sum']   = trim($alinkmenu['sum']); 
-        $alinkmenu['sum']   = html_specialchars($alinkmenu['sum']); 
-         
-        if(!empty($alinkmenu['morelink'])) { 
-           
-          $alinkmenu['sum']  .= '<a href="index.php?aid='.$value['article_id'].'">'; 
-          $alinkmenu['sum']  .= $alinkmenu['morelink']; 
-          $alinkmenu['sum']  .= '</a>'; 
-           
-        } 
-        // Set css wrapper 
-        $alinkmenu['sum'] = LF.$alinkmenu['wrap_summary'][0].LF.$alinkmenu['sum'].LF.$alinkmenu['sum'][1]; 
-       
-      } 
-         
-    } else { 
-     
-       
-       
-      $alinkmenu['sum'] = false; 
-     
-    } 
-     
-    // SubTitle ---------------------- 
-    $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ?  
-    $alinkmenu['wrap_subtitle'][0].html_specialchars($value['article_subtitle']).$alinkmenu['wrap_subtitle'][1] : ''; 
- 
-    // Format before every data set. 
-    $alinkmenu['link'] .= LF.$alinkmenu["style_before"].LF;  
-     
-     
-    // set link or link with active link class -------------------- 
-     
-    $alinkmenu['link_wrap'] = '<a href="index.php?aid='.$value['article_id'].'">';  
- 
-    if (empty($alinkmenu['hideactive']) AND ($value['article_id'] == $aktion[1])) { 
-        $alinkmenu['link_wrap'] = '<a href="index.php?aid='.$value['article_id'].'" '.get_class_attrib($alinkmenu['class_active_link']).'>'; 
-    } 
-     
-     
-     
-    switch($alinkmenu['ul']) { 
-     
-      case 1:   // render as unordered list 
-            $alinkmenu['link'] .= '<li>'.$alinkmenu['wrap_data'][0].$alinkmenu['wrap_title'][0]; 
-//            $alinkmenu['link'] .= '<a href="index.php?aid='.$value['article_id'].'">'; 
-            $alinkmenu['link'] .= $alinkmenu['link_wrap']; 
-            $alinkmenu['link'] .= html_specialchars($value['article_title']); 
-            $alinkmenu['link'] .= $alinkmenu['morelink'].'</a>'.$alinkmenu['wrap_title'][1]; 
-            $alinkmenu['link'] .= $alinkmenu['subtitle']; 
-             
-            if($alinkmenu['sum'] !== false) { 
-              $alinkmenu['link'] .= "\n".$alinkmenu['sum']; 
-            } 
-             
-            $alinkmenu['link'] .= $alinkmenu['wrap_data'][1]."</li>\n"; 
-            break; 
-             
-      case 2:   // render as div 
-            $alinkmenu['link'] .= '<div>'.$alinkmenu['wrap_data'][0].$alinkmenu['wrap_title'][0]; 
-//            $alinkmenu['link'] .= '<a href="index.php?aid='.$value['article_id'].'">'; 
-            $alinkmenu['link'] .= $alinkmenu['link_wrap']; 
-            $alinkmenu['link'] .= html_specialchars($value['article_title']); 
-            $alinkmenu['link'] .= $alinkmenu['morelink'].'</a>'.$alinkmenu['wrap_title'][1]; 
-            $alinkmenu['link'] .= $alinkmenu['subtitle']; 
-             
-            if($alinkmenu['sum'] !== false) { 
-              $alinkmenu['link'] .= "\n".$alinkmenu['sum']; 
-            } 
-             
-            $alinkmenu['link'] .= $alinkmenu['wrap_data'][1]."</div>\n"; 
-            break; 
-     
-      default:  // render as table 
-     
-            // SubTitle ------------ 
-            if ($alinkmenu['subtitle'] !== ''  AND !empty($alinkmenu['subtitle_on'])) { 
-              $tempRowSpan    = ' rowspan="2"'; 
-              $alinkmenu['subtitle'] = "<tr>\n\t<td>" .$alinkmenu['subtitle']. "</td>\n</tr>\n"; 
-            } 
-     
-            if($alinkmenu['sum'] !== false) { 
-              $tempRowSpan    = ' rowspan="2"'; 
-              $alinkmenu['sum'] = "<tr>\n\t<td>" . $alinkmenu['sum'] . "</td>\n</tr>\n"; 
-            } 
-           
-            $alinkmenu['link'] .= "<tr>\n\t<td valign=\"top\"".$tempRowSpan." nowrap=\"nowrap\">".$template_default["article"]["link_article_sign"]."</td>\n\t"; 
-//            $alinkmenu['link'] .= '<td>'.$alinkmenu['wrap_title'][0].'<a href="index.php?aid='.$value['article_id'].'" '; 
-            $alinkmenu['link'] .= '<td>'.$alinkmenu['wrap_title'][0].$alinkmenu['link_wrap']; 
-//            $alinkmenu['link'] .= get_class_attrib($template_default["article"]["link_article_class"]).">"; 
-            $alinkmenu['link'] .= html_specialchars($value['article_title']).$alinkmenu['morelink'].'</a>'.$alinkmenu['wrap_title'][1]."</td>\n</tr>\n"; 
-            $alinkmenu['link'] .= $alinkmenu['subtitle']; 
-            $alinkmenu['link'] .= $alinkmenu['sum']; 
-       
-    }  
-     
-    // Format behind every data set. 
-    $alinkmenu['link'] .= $alinkmenu["style_behind"];  
-     
-   } // END if $count .... 
-   
-  $count++;   
-   
-  } // END foreach 
-   
-//  mysql_free_result($result); 
- 
-} 
- 
-if($alinkmenu['link']) { 
- 
-  switch($alinkmenu['ul']) { 
-   
-      case 1:   // render as unordered list 
-            $alinkmenu['link'] = "<ul>\n" . $alinkmenu['link'] . "</ul>\n";            
-            break; 
-             
-      case 2:   // render as div       
-            break; 
-     
-      default:  // render as table 
-            $alinkmenu['link'] = '<table border="0" cellspacing="0" cellpadding="0">'."\n" . $alinkmenu['link'] . "</table>\n"; 
-       
-  } 
- 
-  // now check if class name is given 
-  // if so wrap article menu in div 
-  if(!empty($alinkmenu['class'])) { 
-   
-    $alinkmenu['link'] = '<div class="' . html_specialchars($alinkmenu['class']) . "\">\n" . $alinkmenu['link'] . "</div>\n"; 
-   
-  }  
-  $CNT_TMP .= $alinkmenu['wrap_all'][0].LF.$virt_article_title . $virt_article_subtitle . $alinkmenu['link'].LF.$alinkmenu['wrap_all'][1].LF; 
-   
-} 
- 
-unset($alinkmenu); 
- 
-return $CNT_TMP; 
-} 
- 
-// $content['all'] = str_replace('{ARTICLE_MENU_ARCHIVE}', my_article_menu_archive() ,$content['all']); 
- 
-$content["all"] = preg_replace('/{ARTICLE_MENU_ARCHIVE:(.*?),(.*?)}/e', 'my_article_menu_archive("$1","$2")', $content["all"]); 
- 
-?> 
-</code> 
deutsch/ersetzer_rts/frontend_render/artikel-menue-archiv.1250376575.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