NLU_FF_AC_QD [update v.1.1]

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.

NLU_FF_AC_QD [update v.1.1]

Postby Jensensen on Sun Sep 28, 2008 21:22

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.


This is the quick and dirty solution!
This is the original NAV_LIST_UL of flip-flop that was incorporateed by OG but extended by
--> easily add the number of articles within a certain site structure level.

The script works exactly like NAV_LIST_UL. So, you can use it with the same prominent parameters, features as usual.

Example of the menu:
Company (4)
Products (37)
Staff (12)

On the other hand it needs its own quick'n-dirty replacement tag
NLU_FF_AC_QD



You're able to edit the output of the source code to your needs:
(12) or [12] or -12 or what

Just edit
// Article Count Wrapper

$acw_before = " <span>(";
$acw_after = ")</span>";


Usage:
Code: Select all
{NLU_FF_AC_QD:F,5,,count_articles,active}

Parent lift
Code: Select all
{NLU_FF_AC_QD:FP,4,2,count_articles,active}


Inline PHP
Code: Select all
[PHP]
if(isset($GLOBALS['LEVEL_ID'][1])) {
   $level_id = $GLOBALS['LEVEL_ID'][1];
   echo '{NLU_FF_AC_QD:,'.$level_id.',1,count_articles,active}';
}
[/PHP]
Last edited by Jensensen on Mon Feb 23, 2009 23:27, edited 1 time in total.
Halte ein Päckchen Reis, genauso Dill, niemals verkehrt herum, wenn Du Dir nicht sicher bist und Dir kein A gesagt hat, dass es bereits geöffnet war!
User avatar
Jensensen
 
Posts: 2571
Joined: Tue Oct 17, 2006 19:11
Location: outer deep space, 1/2 impulse drive, checking

NLU_FF_AC_QD [update v.1.1]

Postby Jensensen on Mon Feb 23, 2009 21:48

New for v1.4.1 (but should work with older versions as well / at least v1.3.x i would say).

v1.1 Improvements:
--> Now it works perfect also with unfolded menus.
--> minor errors fixed.


Keep in mind, that this script can be used the same way like using the original --> NAV_LIST_UL (based on the same function).
Just use this RT = replacement tag: 'NLU_FF_AC_QD'.

For those who are interested why I chose this name:
NLU = NAV_LIST_UL
FF = flip-flop
AC = article count
QD = quick and dirty

Needs a little bit of CSS as usual. :wink:

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)!

Example:
Products (1 article)
-- Product_A (17 articles)
-- Product_B (3 articles)

Output:
Products (1)
Product_A (17)
Product_B (3)

YOU WON'T GET:
Products (21)
[know what i mean?]

Any FEEDBACK appreciated. Thank you!
You do not have the required permissions to view the files attached to this post.
Halte ein Päckchen Reis, genauso Dill, niemals verkehrt herum, wenn Du Dir nicht sicher bist und Dir kein A gesagt hat, dass es bereits geöffnet war!
User avatar
Jensensen
 
Posts: 2571
Joined: Tue Oct 17, 2006 19:11
Location: outer deep space, 1/2 impulse drive, checking


Return to hacks & enhancements

Who is online

Users browsing this forum: Alexa [Bot] and 0 guests