NAVIGATION
This shows you the differences between two versions of the page.
deutsch:ersetzer_rts:frontend_render:article-menu-archiv:article-menu-archiv-counter [2010/03/09 16:03] Knut Heermann (flip-flop) |
deutsch:ersetzer_rts:frontend_render:article-menu-archiv:article-menu-archiv-counter [2018/06/03 18:09] (current) |
||
---|---|---|---|
Line 473: | Line 473: | ||
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 | 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 | ||
+ | |||
+ | **Mögliche Varianten:** Sind keine Parameter gesetzt wird folgendes angenommen: \\ | ||
+ | - **{ARTICLE_MENU_ARCHIVE:,,,}** -> Fallback für die einzelnen Parameter: **{ARTICLE_MENU_ARCHIVE:0,0,100,2}** \\ //(Einstellbar unter "%% ===== CUSTOM INPUT === %%")//. | ||
+ | |||
---- | ---- | ||
Line 490: | Line 494: | ||
==== Code V1.2 ==== | ==== Code V1.2 ==== | ||
+ | |||
+ | **Letzte Änderung:** KH 10.03.2010-07:35: \\ | ||
+ | Parameterübergabe angepasst, nun auch einfaches {ARTICLE_MENU_ARCHIVE:category-ID} möglich. Die fehlenden Einstellungen werden dann im Script unter "%% ===== CUSTOM INPUT === %%" festgelegt. | ||
<code php |h article menu archive V1.2 |h > | <code php |h article menu archive V1.2 |h > | ||
<?php | <?php | ||
- | /************************************************************************************* | + | /** |
- | Copyright notice | + | * ************************************************************************************ |
+ | * 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! | ||
- | (c) 2002-2008 Oliver Georgi (oliver@phpwcms.de) // All rights reserved. | + | * ------------------------------------------------------------------------------------ |
+ | * 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 | ||
- | This script is part of PHPWCMS. The PHPWCMS web content management system is | + | * 10.12.09 KH Update: + BBCode in titel and subtitel possible |
- | free software; you can redistribute it and/or modify it under the terms of | + | * E.g.: [i]Title[/i] [b]Subtitle[/b] ...... |
- | 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. | + | * 09.03.10 KH Update: + article status in tag |
- | + | * {ARTICLE_MENU_ARCHIVE:category-ID, count-hide, count-articles, article-status} | |
- | The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html | + | * E.g.:{ARTICLE_MENU_ARCHIVE:-1,0,4,1} (All four parameters must be set) |
- | A copy is found in the textfile GPL.txt and important notices to the license | + | * Automatic category-ID, no article hidden, show the first for articles, |
- | from the author is found in LICENSE.txt distributed with these scripts. | + | * only if article_begin<NOW() AND article_end<NOW() |
- | + | * | |
- | 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 | + | |
- | {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() | + | |
- | + | ||
- | *************************************************************************************/ | + | |
// ---------------------------------------------------------------- | // ---------------------------------------------------------------- | ||
Line 553: | Line 562: | ||
// $article_archive_status: Have a look to "Simulated CP paramter" | // $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) | ||
- | ) ) | + | // category-ID, count-hide, count-articles, article-status |
- | { | + | function my_article_menu_archive ($parameter='', $CNT_TMP = '') { |
- | echo '============================================ <br>'; | + | |
- | echo ' <b>ERROR</b>: Wrong integer parameter in {ARTICLE_MENU_ARCHIVE:...<br>'; | + | $parameter = explode(',', $parameter); |
- | echo '============================================ <br>'; | + | |
- | return false; | + | |
- | } | + | |
- | + | // ============================================================================ | |
- | + | // ===== CUSTOM INPUT ========================================================= | |
- | global $aktion; | + | |
- | + | // Fallback parameter ----------------------- | |
+ | |||
+ | $catid = 0; // Category-ID // Kategorie-ID | ||
+ | $leading_article_hide = 0; // No. scriped articles // Anz. uebersprung. Artikel | ||
+ | $count_article = 100; // Max count articles // Anz. auszugebender Artikel | ||
+ | $article_archive_status = 2; // What article to be displayed // Welche Artikel anzeigen | ||
// ===== Simulated CP paramter ================================================ | // ===== Simulated CP paramter ================================================ | ||
- | + | ||
+ | // What article to be displayed // Welche Artikel anzeigen ---------------- | ||
// 0: all articles | // 0: all articles | ||
// 1: article_archive_status=1 AND article_begin<NOW() AND article_end<NOW() | // 1: article_archive_status=1 AND article_begin<NOW() AND article_end<NOW() | ||
Line 585: | Line 594: | ||
//$article_archive_status = 2; // Show entries with activated archive status? | //$article_archive_status = 2; // Show entries with activated archive status? | ||
- | if (empty ($article_archive_status)) $article_archive_status = 2; | ||
- | |||
Line 598: | Line 605: | ||
$alinkmenu['wrap_all'] = array('<div class="vlist">','</div>'); // Wrap around all | $alinkmenu['wrap_all'] = array('<div class="vlist">','</div>'); // Wrap around all | ||
$alinkmenu['wrap_data'] = array('',''); // Data wrap begin, end | $alinkmenu['wrap_data'] = array('',''); // Data wrap begin, end | ||
- | $alinkmenu['wrap_title'] = array('',''); // Title wrap around all begin, end | + | $alinkmenu['wrap_title'] = array('<h3>','</h3>'); // Title wrap around all begin, end |
- | $alinkmenu['wrap_subtitle'] = array('',''); // SubTitle wrap begin, end | + | $alinkmenu['wrap_subtitle'] = array('<h4>','</h4>'); // SubTitle wrap begin, end |
$alinkmenu['wrap_summary'] = array('',''); // Wrap around summary begin, end | $alinkmenu['wrap_summary'] = array('',''); // Wrap around summary begin, end | ||
$alinkmenu['class_active_link'] = 'active_link'; // Active link class | $alinkmenu['class_active_link'] = 'active_link'; // Active link class | ||
Line 609: | Line 616: | ||
/* | /* | ||
- | // CSS classes and IDs ---------------------- | + | // CSS classes and IDs example/Beispiel ---------------------- |
$alinkmenu['wrap_all'] = array('<div class="teaser_right">','</div>'); // Wrap around all | $alinkmenu['wrap_all'] = array('<div class="teaser_right">','</div>'); // Wrap around all | ||
$alinkmenu['wrap_data'] = array('',''); // Data wrap begin, end | $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_title'] = array('<div style="padding-bottom:2px; "><h3>','</h3></div>'); // Title wrap around all begin, end |
$alinkmenu['wrap_subtitle'] = array('<p style="font-size: 0.8em; ">','</p>'); // SubTitle wrap 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['wrap_summary'] = array('',''); // Wrap around summary begin, end | ||
Line 633: | Line 640: | ||
// Content part parameters ------------------ | // Content part parameters ------------------ | ||
- | $alinkmenu['headertext'] = 0; // summary text [0|1] | + | $alinkmenu['headertext'] = 1; // summary text [0|1] |
- | $alinkmenu['ul'] = 2; // 1: render as unordered list / 2: render as div / 3: render as table | + | $alinkmenu['ul'] = 2; // 1: render as unordered list / 2: render as div / 3: render as table |
- | $alinkmenu['class'] = ''; // wrapped class | + | $alinkmenu['class'] = ''; // wrapped class |
- | $alinkmenu['maxchar'] = 0; // maxchars summary | + | $alinkmenu['maxchar'] = 100; // maxchars summary |
- | $alinkmenu['morelink'] = ' »'; // more link text | + | $alinkmenu['morelink'] = ' …'; // more link text |
- | $alinkmenu['hideactive'] = 0; // hide active article in article menu | + | $alinkmenu['morelink_title'] = ' »'; // more link text for title |
+ | $alinkmenu['hideactive'] = 0; // hide active article in article menu | ||
Line 661: | Line 669: | ||
// Sorting order ---------------------------- | // Sorting order ---------------------------- | ||
- | $ao['2'] = ' article_priorize DESC,'; // Don´t change | + | $ao['2'] = ' article_priorize DESC,'; // Don´t change // Nicht aendern!! |
- | $ao['2'] .= ' article_sort ASC'; // second entry | + | $ao['2'] .= ' article_sort ASC'; // second entry // Zweiter Eintrag |
// ===== END defination ======================================================= | // ===== END defination ======================================================= | ||
+ | // ============================================================================ | ||
+ | |||
+ | |||
+ | |||
+ | // Tag input parameter | ||
+ | if (!empty($parameter[0])) $catid = intval($parameter[0]); // Tag input: Category-ID | ||
+ | if (!empty($parameter[1])) $leading_article_hide = intval($parameter[1]); // Tag input: No. scriped articles | ||
+ | if (!empty($parameter[2])) $count_article = intval($parameter[2]); // Tag input: Max count articles | ||
+ | if (!empty($parameter[3])) { | ||
+ | $article_archive_status = intval($parameter[3]); // Tag input: [0-6] | ||
+ | if ($article_archive_status < 0 AND | ||
+ | $article_archive_status > 6) // Fallback if out of range range | ||
+ | $article_archive_status = 2; | ||
+ | } | ||
+ | |||
+ | |||
+ | global $aktion; | ||
// catid = -1: The current category is selected | // catid = -1: The current category is selected | ||
Line 751: | Line 776: | ||
$alinkmenu['sum'] = preg_replace('/\s{2,}/i', ' ', $alinkmenu['sum']); | $alinkmenu['sum'] = preg_replace('/\s{2,}/i', ' ', $alinkmenu['sum']); | ||
$alinkmenu['sum'] = trim(decode_entities($alinkmenu['sum'])); | $alinkmenu['sum'] = trim(decode_entities($alinkmenu['sum'])); | ||
- | $alinkmenu['sum'] = wordwrap($alinkmenu['sum'], $alinkmenu['maxchar'], "\n"); | + | $alinkmenu['sum'] = wordwrap($alinkmenu['sum'], $alinkmenu['maxchar'], "\n"); |
list($alinkmenu['sum']) = explode("\n", $alinkmenu['sum']); | list($alinkmenu['sum']) = explode("\n", $alinkmenu['sum']); | ||
$alinkmenu['sum'] = trim($alinkmenu['sum']); | $alinkmenu['sum'] = trim($alinkmenu['sum']); | ||
Line 785: | Line 810: | ||
// set link or link with active link class -------------------- | // set link or link with active link class -------------------- | ||
- | + | // Title link --------------- | |
$alinkmenu['link_wrap'] = '<a href="index.php?aid='.$value['article_id'].'">'; | $alinkmenu['link_wrap'] = '<a href="index.php?aid='.$value['article_id'].'">'; | ||
Line 801: | Line 826: | ||
$alinkmenu['link'] .= $alinkmenu['link_wrap']; | $alinkmenu['link'] .= $alinkmenu['link_wrap']; | ||
$alinkmenu['link'] .= render_bbcode_basics(html_specialchars($value['article_title'])); | $alinkmenu['link'] .= render_bbcode_basics(html_specialchars($value['article_title'])); | ||
- | $alinkmenu['link'] .= $alinkmenu['morelink'].'</a>'.$alinkmenu['wrap_title'][1]; | + | $alinkmenu['link'] .= $alinkmenu['morelink_title'].'</a>'.$alinkmenu['wrap_title'][1]; |
$alinkmenu['link'] .= $alinkmenu['subtitle']; | $alinkmenu['link'] .= $alinkmenu['subtitle']; | ||
Line 816: | Line 841: | ||
$alinkmenu['link'] .= $alinkmenu['link_wrap']; | $alinkmenu['link'] .= $alinkmenu['link_wrap']; | ||
$alinkmenu['link'] .= render_bbcode_basics(html_specialchars($value['article_title'])); | $alinkmenu['link'] .= render_bbcode_basics(html_specialchars($value['article_title'])); | ||
- | $alinkmenu['link'] .= $alinkmenu['morelink'].'</a>'.$alinkmenu['wrap_title'][1]; | + | $alinkmenu['link'] .= $alinkmenu['morelink_title'].'</a>'.$alinkmenu['wrap_title'][1]; |
$alinkmenu['link'] .= $alinkmenu['subtitle']; | $alinkmenu['link'] .= $alinkmenu['subtitle']; | ||
Line 843: | Line 868: | ||
$alinkmenu['link'] .= '<td>'.$alinkmenu['wrap_title'][0].$alinkmenu['link_wrap']; | $alinkmenu['link'] .= '<td>'.$alinkmenu['wrap_title'][0].$alinkmenu['link_wrap']; | ||
// $alinkmenu['link'] .= get_class_attrib($template_default["article"]["link_article_class"]).">"; | // $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'] .= render_bbcode_basics(html_specialchars($value['article_title'])).$alinkmenu['morelink_title'].'</a>'.$alinkmenu['wrap_title'][1]."</td>\n</tr>\n"; |
$alinkmenu['link'] .= $alinkmenu['subtitle']; | $alinkmenu['link'] .= $alinkmenu['subtitle']; | ||
$alinkmenu['link'] .= $alinkmenu['sum']; | $alinkmenu['link'] .= $alinkmenu['sum']; | ||
Line 897: | Line 922: | ||
} | } | ||
- | // $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")', $content["all"]); |
- | + | ||
- | $content["all"] = preg_replace('/{ARTICLE_MENU_ARCHIVE:(.*?),(.*?),(.*?),([0-6]?)}/e', 'my_article_menu_archive("$1","$2","$3","$4")', $content["all"]); | + | |
?> | ?> | ||
</code> | </code> |