Differences

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

deutsch:ersetzer_rts:frontend_render:nav_list_ul-article-count [2009/06/15 07:57]
Knut Heermann (flip-flop) created
deutsch:ersetzer_rts:frontend_render:nav_list_ul-article-count [2018/06/03 18:09] (current)
Line 3: Line 3:
====== NAV_LIST_UL & Artikelzähler ====== ====== NAV_LIST_UL & Artikelzähler ======
-**RT Whenever you need/want to display the number of articles of any site structure level next to the name of the category, the script does it.**+**RT Wenn die Ausgabe der Artikelanzahl jeder Strukturebene hinter dem jeweiligen Linknamen gewünscht ist, kann dieser Tag verwendet werden.**
-This is the quick and dirty solution! \\ +Einfache Variante: [[deutsch/ersetzer_rts/frontend_render/artikelzaehler|Artikelzähler]] \\ 
-This is the original NAV_LIST_UL of flip-flop that was incorporated by OG and now extended by --> **easily add the number of articles within a certain site structure level**.+Dies ist die originale  NAV_LIST_UL von OG (CSS by flip-flop) erweitert mit --> **Ausgabe Anzahl der Artikel der jeweiligen Strukturebene**.
-**The script works exactly like NAV_LIST_UL**. So, you can use it with the same prominent parameters, features as usual.+**Das Skript arbeitet exakt wie [[deutsch/navigationen/nav_list_ul|NAV_LIST_UL]]**. Es werden also die selben [[deutsch/navigationen/nav_list_ul_parameter|Parameter]] verwendet.
-**Example of the menu:** \\ +==== Beispiel ====
-Company **(4)** \\  +
-Products **(37)** \\ +
-Staff **(12)**+
-On the other hand it needs its own quick'n-dirty **replacement tag** \\+ 
 +**Beispielmenü:** \\ 
 +Firma **(4)** \\  
 +Produkte **(37)** \\ 
 +Personal **(12)** 
 + 
 +Dies bedarf eines speziellen Ersetzers **replacement tag** \\
NLU_FF_AC_QD NLU_FF_AC_QD
-**You're able to edit the output of the source code to your needs:** \\ +**Das Ausgabeformat kann an die eigenen Wünsche angepasst werden:** \\ 
-(12) or [12] or -12 or what+(12) or [12] or -12 .....
\\ \\
-**Just edit**+**Dann editiere**
<code php> <code php>
// Article Count Wrapper // Article Count Wrapper
Line 31: Line 34:
\\ \\
-**Usage:**+**Verwendung:**
<code html> <code html>
{NLU_FF_AC_QD:F,5,,count_articles,active} {NLU_FF_AC_QD:F,5,,count_articles,active}
Line 37: Line 40:
\\ \\
-**Parent lift:**+**Elternelementausgabe:**
<code html> <code html>
{NLU_FF_AC_QD:FP,4,2,act_path,active} {NLU_FF_AC_QD:FP,4,2,act_path,active}
Line 56: Line 59:
\\ \\
-For those who are interested why I chose this name: \\+FÜr alle die es interessiert, wie sich der Name zusammensetzt: \\
- NLU = NAV_LIST_UL  \\ - NLU = NAV_LIST_UL  \\
- FF = flip-flop  \\ - FF = flip-flop  \\
- AC = article count \\ - AC = article count \\
- QD = quick and dirty - QD = quick and dirty
 +\\
 +==== Limitierung ====
<note> <note>
-**Limitations:** There's one limitation only. The script only counts the number of articles which are in exactly **the same site structure level that appears in the menu.** //There's **no summation (unfolded)** over all.// Articles in sub-categories are ignored (in that way)!+**Limitierung:** Es gibt eine Einschränkung. Das Skript zählt nur die Artikel die in **der eigenen einen Strukturebene liegen.** //Es gibt **keine Summierung** über die Strukturebenen hinweg.// Artikel in Unterkategorien werden also in der darüber liegenden Ebene nicht mitgezählt)!
</note> </note>
-**Example:** +**Beispiel:** 
-Products (1 article+Produkte (1 Artikel
-  * Product_A (17 articles+  * Produkt_A (17 Artikel
-  * Product_B (3 articles)+  * Produkt_B (3 Artikel)
-**Output:** \\ +**Ausgabe:** \\ 
-Products (1) \\ +Produkt (1) \\ 
-Product_A (17) \\ +Produkt_A (17) \\ 
-Product_B (3) \\+Produkt_B (3) \\
-**YOU WON'T GET:** \\ + 
-  * Products (21) //(know what i mean?)//+**Es wird also nicht ausgegeben:** \\ 
 +  * Produkt (21) //(Verstehen Sie was ich meine?)//
\\ \\
Line 84: Line 90:
---- ----
\\ \\
-**rt_NLU_FF_AC_QD_1.1** V1.0  2008/09/08   
-Docu: -- \\ +==== Versionen ====
-Forum: [[http://forum.phpwcms.org/viewtopic.php?p=100208#p100208|article counter near category name (menu) in visitor page]]  +
-[[http://forum.phpwcms.org/viewtopic.php?f=8&t=17891|NLU_FF_AC_QD (update v.1.1)]]+
 +{{indexmenu>deutsch:ersetzer_rts/frontend_render/nav_list_ul-article-count|js#doku navbar msort nsort nocookie notoc}}
-**Autor:**  Jensensen  \\ +\\
-**CMS Version:** >= 1.3 \\  +
-**Version:** V1.0 \\ +
-**Update:** V1.1 2009/02/23 \\ +
- +
-  +
- +
-Tag: {NLU_FF_AC_QD:F,0....} \\ +
- +
-Dateiname: **rt_NLU_FF_AC_QD_1.1.php**  +
- +
-Verzeichnis:  ** template/inc_script/frontend_render/ **  +
- +
-**Bedingung:** -> [[http://www.phpwcms-docu.de/config_dateien.phtml|/config/phpwcms/conf.inc.php]] \\ +
- +
-  * ##$phpwcms['allow_ext_render'] = 1;##  +
- +
- +
----- +
----- +
- +
- +
-<code php |h rt_NLU_FF_AC_QD_1.1 |h > +
-<?php +
-/****************************************************************** +
-* NLU_FF_AC_QD for phpwcms --> v1.3+ +
-+
-* Date: Feb. 23, 2009 by Jensensen +
-+
-* Works like NAV_LIST_UL but displays the number of articles +
-* --> of each site level, example ==> Products (17) +
-+
-* AUTHOR: Jensensen +
-* inspired by flip-flop || function by OG. +
-+
-* http://forum.phpwcms.org/viewtopic.php?p=100208#p100208 +
-* http://forum.phpwcms.org/viewtopic.php?f=8&t=17891 +
-+
-* TAG: {NLU_FF_AC_QD:F,0....} +
-* Copy to your templates / CPs +
-+
-* Version: 1.1 +
-* Condition: free +
-* Location: /template/inc_script/frontend_render/rt_NLU_FF_AC_QD_1.1.php +
-* Requirement: $phpwcms['allow_ext_render']  = 1; in conf.inc.php +
-+
-* ****************************************************************/ +
-// obligate check for phpwcms constants +
-if (!defined('PHPWCMS_ROOT')) { +
-   die("You Cannot Access This Script Directly, Have a Nice Day."); +
-+
-// ---------------------------------------------------------------- +
- +
-/***************************************************************** +
-* ### PARAMETER SET UP ### !!!!!!!!!!!!!!!!!!!!!!!!!           ### +
-*****************************************************************/ +
-// Article Count Wrapper +
-$acw_before = " <span>("; +
-$acw_after = ")</span>"; +
- +
-/***************************************************************** +
-* ### !!!!!!!!!!! ### NO NEED TO EDIT BELOW ### !!!!!!!!!!!!!! ### +
-*****************************************************************/ +
- +
-function buildMenuCountArticles($parameter='', $counter=0, $param='string') { +
- +
- // @string $parameter = "menu_type, start_id, max_level_depth, class_path, class_active, +
- // ul_id_name, wrap_ul_div(0 = off, 1 = <div>, 2 = <div id="">, 3 = <div class="navLevel-0">), +
- // wrap_link_text(<em>|</em>, articlemenu_start_id)" +
- +
- if($param == 'string') { +
- +
- $parameter = explode(',', $parameter); +
- $menu_type = empty($parameter[0]) ? '' : strtoupper(trim($parameter[0])); +
- +
- $unfold = 'all'; +
- $ie_patch = false; // unused at the moment +
- $create_css = false; +
- $parent = false; // do not show parent link +
- $articlemenu = false; // do not show category's article titles as menu entry +
- +
- switch($menu_type) { +
- +
- // show parent level too +
- case 'PA': $articlemenu = true; +
- case 'P': $parent = true; +
- break; +
- +
- // vertical, active path unfolded +
- case 'FPA': $articlemenu = true; +
- case 'FP': $parent = true; +
- case 'F': $unfold = 'active_path'; +
- break; +
-  +
- case 'FA': $articlemenu = true; +
- $unfold = 'active_path'; +
- break; +
-  +
- // horizontal, all levels unfolded, add special code for horizontal flyout menu +
- case 'HCSSP': $parent = true; +
- case 'HCSS': $create_css = true; +
- break; +
- +
- // horizontal, all levels unfolded, add special code for vertical flyout menu +
- case 'VCSSP': $parent = true; +
- case 'VCSS': $create_css = true; +
- break; +
- +
-+
- +
- $start_id = empty($parameter[1]) ? 0  : intval($parameter[1]); +
- $max_depth = empty($parameter[2]) ? 0  : intval($parameter[2]); +
- $path_class = empty($parameter[3]) ? '' : trim($parameter[3]); +
- $active_class = empty($parameter[4]) ? '' : trim($parameter[4]); +
- $level_id_name = empty($parameter[5]) ? '' : trim($parameter[5]); +
- $wrap_ul_div = empty($parameter[6]) ? 0  : intval($parameter[6]); +
- if($wrap_ul_div > 3) { +
- $wrap_ul_div = 2; +
- } elseif($wrap_ul_div < 0) { +
- $wrap_ul_div = 0; +
-+
- $wrap_link_text = empty($parameter[7]) ? array(0 => '', 1 => '') : explode('|', $parameter[7]); +
- if(empty($wrap_link_text[1])) { +
- $wrap_link_text[1] = ''; +
-+
- $amenu_start_id = empty($parameter[8]) ? 0 : intval($parameter[8]); +
- +
- $parameter = array( 0 => $menu_type, 1 => $start_id, 2 => $max_depth, +
- 3 => $path_class, 4 => $active_class, 5 => $level_id_name, +
- 6 => $wrap_ul_div, 7 => $wrap_link_text, 8 => $unfold, +
- 9 => $ie_patch, 10 => $create_css, 11 => $amenu_start_id ); +
- } else { +
- +
- $menu_type = $parameter[0]; +
- $start_id = $parameter[1]; +
- $max_depth = $parameter[2]; +
- $path_class = $parameter[3]; +
- $active_class = $parameter[4]; +
- $level_id_name = $parameter[5]; +
- $wrap_ul_div = $parameter[6]; +
- $wrap_link_text = $parameter[7]; +
- $unfold = $parameter[8]; +
- $ie_patch = $parameter[9]; +
- $create_css = $parameter[10]; +
- $amenu_start_id = $parameter[11]; +
-  +
- $parent = false; // do not show parent link +
- +
-+
- +
- $li = ''; +
- $ul = ''; +
- $TAB = str_repeat(' ', $counter); +
- $_menu_type = strtolower($menu_type); +
- $max_depth = ($max_depth == 0 || $max_depth-1 > $counter) ? true : false; +
- $x = 0; +
- +
- foreach($GLOBALS['content']['struct'] as $key => $value) { +
- +
- // count number of articles in each category level +
- $sql = "SELECT * "; +
- $sql .= "FROM ".DB_PREPEND."phpwcms_article "; +
- $sql .= "WHERE article_cid=$key "; +
- $sql .= "AND article_public=1 AND article_aktiv=1"; +
- +
- // thank you flip-flop +
- $how_many_articles = _dbCount($sql); +
- +
- +
- //if($GLOBALS['content']['struct'][$key]['acat_struct'] == $start_id && $key && (!$GLOBALS['content']['struct'][$key]['acat_hidden'] || ($GLOBALS['content']['struct'][$key]["acat_hidden"] == 2 && isset($GLOBALS['LEVEL_KEY'][$key])))) { +
- if( _getStructureLevelDisplayStatus($key, $start_id) ) { +
- +
- $li_ul = ''; +
- $li_class = ''; +
- $li_ie = ''; +
- +
- $li_a  = get_level_ahref($key); +
- $li_a .= $wrap_link_text[0]; +
- $li_a .= html_specialchars($GLOBALS['content']['struct'][$key]['acat_name']); +
- $li_a .= $wrap_link_text[1]; +
- +
- if($max_depth && ($unfold == 'all' || ($unfold == 'active_path' && isset($GLOBALS['LEVEL_KEY'][$key]))) ) { +
- $parameter[1] = $key; +
-// $li_ul = buildCascadingMenu($parameter, $counter+1, 'param_is_array'); +
- $li_ul = buildMenuCountArticles($parameter, $counter+1, 'param_is_array'); +
-+
- +
- $li .= $TAB.' <li'; +
- +
- if($level_id_name) { +
- $li .= ' id="li_'.$level_id_name.'_'.$key.'"'; +
-+
- if($li_ul) { +
- $li_class = 'sub_ul'; +
- } else { +
- $li_class = getHasSubStructureStatus($key) ? 'sub_no sub_ul_true' : 'sub_no'; +
-+
- if($path_class != '' && isset($GLOBALS['LEVEL_KEY'][$key])) { +
- $li_class .= ' '.$path_class; +
- $li_class  = trim($li_class); +
-+
- if($active_class != '' && $key == $GLOBALS['aktion'][0]) { +
- $li_class = trim($li_class.' '.$active_class); +
-+
- +
- $li .= ' class="' . $li_class . ( $x==0 ? ' sub_first' : '' ) .'"'; +
- +
-// $li .= '>' . $li_a . '</a>'; +
- $li .= '>' . $li_a . $GLOBALS['acw_before'].$how_many_articles.$GLOBALS['acw_after'] . '</a>'; +
- +
- $li .= $li_ul.'</li>'.LF; // remove $li_ul from this line of code if $ie_patch is used +
-  +
- $x++; +
-+
-+
- // also check if $parent +
- if($li || ($parent && isset($GLOBALS['content']['struct'][$start_id]))) { +
- +
- switch($wrap_ul_div) { +
- case 1: $ul = LF.$TAB.'<div>'; +
- $close_wrap_ul = '</div>'.LF.$TAB; +
- break; +
- case 2: $ul = LF.$TAB.'<div id="ul_div_'.$start_id.'">'; +
- $close_wrap_ul = '</div>'.LF.$TAB; +
- break; +
- case 3: $ul = LF.$TAB.'<div class="navLevel-'.$counter.'">'; +
- $close_wrap_ul = '</div>'.LF.$TAB; +
- break; +
- default: $ul = ''; +
- $close_wrap_ul = ''; +
-+
- $ul .= LF.$TAB.'<ul'; +
- if($level_id_name) { +
- $ul .= ' id="'.$level_id_name.'_'.$start_id.'"'; +
-+
- if(isset($GLOBALS['LEVEL_KEY'][$start_id]) && $path_class) { +
- $ul .= ' class="'.$path_class.'"'; +
-+
- $ul .= '>'.LF; +
-  +
- if($parent && isset($GLOBALS['content']['struct'][$start_id])) { +
-  +
- $ul .= LF; +
- $ul .= $TAB.' <li'; +
- if($level_id_name) { +
- $ul .= ' id="li_'.$level_id_name.'_'.$start_id.'"'; +
-+
- $li_class = 'sub_parent'; +
- if($path_class != '' && isset($GLOBALS['LEVEL_KEY'][$start_id])) { +
- $li_class .= ' '.$path_class; +
- $li_class  = trim($li_class); +
-+
- if($active_class != '' && $start_id == $GLOBALS['aktion'][0]) { +
- $li_class = trim($li_class.' '.$active_class); +
-+
- $ul .= ' class="'.$li_class.'">'; +
- $ul .= get_level_ahref($start_id); +
- $ul .= $wrap_link_text[0]; +
- $ul .= html_specialchars($GLOBALS['content']['struct'][$start_id]['acat_name']); +
- $ul .= $wrap_link_text[1]; +
- $ul .= '</a></li>'.LF; +
-  +
-+
-  +
- $ul .= $li; +
- $ul .= $TAB . '</ul>' . LF . $TAB . $close_wrap_ul; +
- +
- if($create_css && empty($GLOBALS['block']['custom_htmlhead'][$menu_type][$counter])) { +
- +
- if($counter) { +
- +
- $tmp_css  = '    .'.$_menu_type.'_menu ul li:hover '.str_repeat('ul ', $counter) .'ul { display: none; }'.LF; +
- $tmp_css .= '    .'.$_menu_type.'_menu ul '.str_repeat('ul ', $counter) .'li:hover ul { display: block; }'; +
- $GLOBALS['block']['custom_htmlhead'][$menu_type][$counter] = $tmp_css; +
- +
- } else {  //if($counter == 0) { +
- +
- $GLOBALS['block']['custom_htmlhead'][$menu_type][-9]  = LF.'  <style type="text/css">'.LF.SCRIPT_CDATA_START; +
- $GLOBALS['block']['custom_htmlhead'][$menu_type][-8]  = '    @import url("'.TEMPLATE_PATH.'inc_css/specific/nav_list_ul_'.$_menu_type.'.css");'; +
- +
- $GLOBALS['block']['custom_htmlhead'][$menu_type][-5]  = '    .'.$_menu_type.'_menu ul ul { display: none; }'; +
- $GLOBALS['block']['custom_htmlhead'][$menu_type][-4]  = '    .'.$_menu_type.'_menu ul li:hover ul { display: block; }'; +
- +
- ksort($GLOBALS['block']['custom_htmlhead'][$menu_type]); +
- $GLOBALS['block']['custom_htmlhead'][$menu_type][]   = SCRIPT_CDATA_END.LF.'  </style>'; +
- $GLOBALS['block']['custom_htmlhead'][$menu_type]   = implode(LF, $GLOBALS['block']['custom_htmlhead'][$menu_type]); +
- +
- $ul = '<div class="'.$_menu_type.'_menu">'.$ul.'</div>'; +
- +
-+
- +
-+
- +
-+
- +
- return $ul; +
-+
- +
- +
-if(!empty($content["all"]) && !(strpos($content["all"],'{NLU_FF_AC_QD:')===false)) { +
- $content["all"] = preg_replace('/\{NLU_FF_AC_QD:(.*?)\}/e', 'buildMenuCountArticles("$1");', $content["all"]);   +
-+
-?> +
-</code>+
deutsch/ersetzer_rts/frontend_render/nav_list_ul-article-count.1245045459.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