This is an old revision of the document!


(Einfache Version)

Artikelmenü (+Zähler +Archiv)

Ein RT wie CP Artikelmenü, erweitert um auch archivierte Artikel anzeigen zu können und zwei Zähler: 1) Artikel ausblenden, 2) Anzahl der darzustellenden Artikel.

rt_article_menu_archive V1.0 23.03.09
rt_article_menu_archive V1.1 05.09.09

Update: 16.08.09 KH: + Zähler für “Wie viele der ersten Artikel werden ausgeblendet” (0 = nichts ausblenden)
Update: 05.09.09 KH: + Zähler für “Wie viele Artikel werden angezeigt” (0 = alle)
Update: 10.12.09 KH: + BBCode in Titel und Subtitel möglich
Update: 09.03.10 KH: + Artikel-Status über den Tag einstellbar [0-6] V1.2

Syntax: {ARTICLE_MENU_ARCHIVE:category-ID, count-hide} (Beide Parameter müssen gesetzt sein)
V1.1
Syntax: {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-article} (Alle drei Parameter müssen gesetzt sein)

Bsp.: {ARTICLE_MENU_ARCHIVE:-1,0,0} Aktuelle Kategorie, kein führender Artikel ausgeblendet, alle Artikel anzeigen
Bsp.: {ARTICLE_MENU_ARCHIVE:23,2,5} Artikel in der Kategorie mit der ID 23, die beiden ersten Artikel werden nicht angezeigt, von den restlichen die ersten fünf anzeigen

V1.2
Syntax: {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-article, article-status} (Alle vier Parameter müssen gesetzt sein)

Bsp.: {ARTICLE_MENU_ARCHIVE:-1,0,0,0} Aktuelle Kategorie, kein führender Artikel ausgeblendet, alle Artikel anzeigen, auch wenn (archivieren) gesetzt ist und das Artikelenddatum in der Vergangenheit liegt
Bsp.: {ARTICLE_MENU_ARCHIVE:23,2,5,1} Artikel in der Kategorie mit der ID 23, die beiden ersten Artikel werden nicht angezeigt, von den restlichen die ersten fünf anzeigen, es werden nur die abgelaufenen Artikel angezeigt bei denen (archivieren) gesetzt ist

Docu: –
Forum: –

Autor: K.Heermann (flip-flop) http://planmatrix.de
CMS Version: >= 1.4
Version: V1.1

Basierend auf dem CP Artikelmenü.

Dateiname: rt_article_menu_archive.php

Ort: template/inc_script/frontend_render/

Bedingung:/config/phpwcms/conf.inc.php

  • $phpwcms['allow_ext_render'] = 1;



V1.1

Tag: {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-article} oder {ARTICLE_MENU_ARCHIVE:-1, count-hide, count-article} für aktuelle Kategorie


Code V1.1

article menu archive

<?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 (the current category is selected)
   E.g.:{ARTICLE_MENU_ARCHIVE:-1}
 
16.08.09 KH Update: + counter for "How many of the first articles are to be hidden"
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide}
   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0}  (Both parameters must be set)
 
05.09.09 KH Update: + count_article for "How many of articles are to be shown" (if available)
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-articles}
   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0,4}  (All three parameters must be set)
         Automatic category-ID, no article hidden, show the first for articles
 
10.12.09 KH Update: + BBCode in titel and subtitel possible
   E.g.: [i]Title[/i]  [b]Subtitle[/b] ......
*************************************************************************************/
 
// ----------------------------------------------------------------
// 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 = current category))
// $leading_article_hide: How many of the first articles are to be hidden
// $count_article: How many articles are to be shown (0=all)
 
function my_article_menu_archive ($catid = 0, $leading_article_hide = 0, $count_article, $CNT_TMP = '') {
 
 
 // Test if all paramters have integer format
if (!(is_intval($catid) AND is_intval($leading_article_hide) AND is_intval($count_article)) ) {
    echo '============================================ <br>';
    echo '&nbsp;<b>ERROR</b>: Wrong integer parameter in {ARTICLE_MENU_ARCHIVE:...<br>';
    echo '============================================ <br>';
    return false;
}
 
 
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 of the first articles are to be hidden (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 current category is selected
$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;
  // Max article output ( Input <= 0   --> All articles output )
  ($count_article <= 0) ? $count_art == -1000 : $count_art = 0;
 
  foreach($result as $value) {
 
   if( $count >= $leading_article_hide ) {  // Hide first articles?
 
    if( $count_article > $count_art ) {  // Max article shown
 
 
      $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['wrap_summary'][1];
 
        }
 
      } else {
 
 
 
        $alinkmenu['sum'] = false;
 
      }
 
     // SubTitle ----------------------
      $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ?
      $alinkmenu['wrap_subtitle'][0].render_bbcode_basics(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'] .= render_bbcode_basics(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'] .= render_bbcode_basics(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'] .= render_bbcode_basics(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_art ....
     $count_art++;
 
   } // 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","$3")', $content["all"]);
 
?>


V1.2

Version: V1.2

Update 09.03.2010: Artikelstatus nun über den Tag einstellbar.

Tag: {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-article, article-status} oder {ARTICLE_MENU_ARCHIVE:-1, count-hide, count-article, article-status} für aktuelle Kategorie


Artikel-Staus:

{ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-article, article-status}

0: alle Artikel anzeigen
1: (archivieren) gesetzt UND Artikel-Begin < JETZT UND Artikel-Ende < JETZT
2: (archivieren) gesetzt UND Artikel-Begin < JETZT UND Artikel-Ende > JETZT
3: (archivieren) gesetzt UND Artikel-Begin > JETZT UND Artikel-Ende > JETZT
 
4: (archivieren) nicht gesetzt UND Artikel-Begin < JETZT UND Artikel-Ende < JETZT
5: (archivieren) nicht gesetzt UND Artikel-Begin < JETZT UND Artikel-Ende > JETZT
6: (archivieren) nicht gesetzt UND Artikel-Begin > JETZT UND Artikel-Ende > JETZT

Code

article menu archive V1.2

<?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 (the current category is selected)
   E.g.:{ARTICLE_MENU_ARCHIVE:-1}
 
16.08.09 KH Update: + counter for "How many of the first articles are to be hidden"
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide}
   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0}  (Both parameters must be set)
 
05.09.09 KH Update: + count_article for "How many of articles are to be shown" (if available)
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-articles}
   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0,4}  (All three parameters must be set)
         Automatic category-ID, no article hidden, show the first for articles
 
10.12.09 KH Update: + BBCode in titel and subtitel possible
   E.g.: [i]Title[/i]  [b]Subtitle[/b] ......
 
09.03.10 KH Update: + article status in tag (V1.2)
   {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-articles, article-status}
   E.g.:{ARTICLE_MENU_ARCHIVE:-1,0,4,1}  (All four parameters must be set)
         Automatic category-ID, no article hidden, show the first for articles,
         only if article_begin<NOW() AND article_end<NOW()
 
*************************************************************************************/
 
// ----------------------------------------------------------------
// 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 = current category))
// $leading_article_hide: How many of the first articles are to be hidden
// $count_article: How many articles are to be shown (0=all)
// $article_archive_status: Have a look to "Simulated CP paramter"
 
function my_article_menu_archive ($catid = 0, $leading_article_hide = 0, $count_article, $article_archive_status = 2, $CNT_TMP = '') {
 
 
 // Test if all paramters have integer format
if ( !(is_intval($catid)
     AND is_intval($leading_article_hide)
     AND is_intval($count_article)
     AND is_intval($article_archive_status) ) )
{
    echo '============================================ <br>';
    echo '&nbsp;<b>ERROR</b>: Wrong integer parameter in {ARTICLE_MENU_ARCHIVE:...<br>';
    echo '============================================ <br>';
    return false;
}
 
 
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       = 1;  // Show entries with activated archive status?
 
 
// How many of the first articles are to be hidden (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 current category is selected
$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;
  // Max article output ( Input <= 0   --> All articles output )
  ($count_article <= 0) ? $count_art == -1000 : $count_art = 0;
 
  foreach($result as $value) {
 
   if( $count >= $leading_article_hide ) {  // Hide first articles?
 
    if( $count_article > $count_art ) {  // Max article shown
 
 
      $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['wrap_summary'][1];
 
        }
 
      } else {
 
 
 
        $alinkmenu['sum'] = false;
 
      }
 
     // SubTitle ----------------------
      $alinkmenu['subtitle'] = (!empty($value['article_subtitle']) AND !empty($alinkmenu['subtitle_on'])) ?
      $alinkmenu['wrap_subtitle'][0].render_bbcode_basics(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'] .= render_bbcode_basics(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'] .= render_bbcode_basics(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'] .= render_bbcode_basics(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_art ....
     $count_art++;
 
   } // 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:(.*?),(.*?),(.*?),([0-6])}/e', 'my_article_menu_archive("$1","$2","$3","$4")', $content["all"]);
 
?>
deutsch/ersetzer_rts/frontend_render/article-menu-archiv/article-menu-archiv-counter.1268145634.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