Page 1 of 2

NLU_FF_AC_QD [update v.1.9.5]

Posted: Sun 28. Sep 2008, 23:22
by Jensensen
new version, new code, new stuff.

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 incorporated by OG and now has been extended with
--> easily add the number of articles within a certain site structure level. ... cc1dbfbebe
The script works exactly like NAV_LIST_UL [read more about basics]. You can use it with the same prominent parameters and 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

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>";


Code: Select all

Parent lift

Code: Select all

new NAV_LIST_UL (since app_v1.4.4 r387 and higher)

Code: Select all

Inline PHP

Code: Select all

if(isset($GLOBALS['LEVEL_ID'][1])) {
	$level_id = $GLOBALS['LEVEL_ID'][1];
	echo '<div class="my_navi_with_the_number_of_articles_in_the_site_structure_level">';
	echo '{NLU_FF_AC_QD:FA,'.$level_id.',1,act_path,active}';
	echo '</div>';

These days Oliver prepared fresh and new updates concerning NAV_LIST_UL, regarding both branches

master ... 7b9e4d71e9


v1.9-dev ... ffb32f880d

So it was necessary to renew this script.
It's backward compatible. You can use it with older versions of phpwcms anyway.

Enjoy and have fun with it. Thanks for reply.

More information and Download:

NLU_FF_AC_QD [update v.1.1]

Posted: Mon 23. Feb 2009, 22:48
by Jensensen
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:
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)!

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

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

Products (21)
[know what i mean?]

Any FEEDBACK appreciated. Thank you!

Re: NLU_FF_AC_QD [update v.1.1]

Posted: Thu 18. Jun 2009, 15:33
by yorkshire_boy1
Hi Jensensen, great hack - many thanks for this.

I am currently building a site which uses the News Article feature, creating a series of news feeds based on tags that i add to the news articles. I am doing this so that i can add content once and it will appear in various places on the site depending on the tag. (I would prefer a tag system for normal articles of course, but this does not exist (yet!))

I have hacked your hack to allow me to count the number of news articles instead of regular articles. You name the page category the same as the news article tag you want to count.

Products (15 news article with tag Products)
ProductType1 (3 news articles with tag ProductType1)
ProductType2 (12 news articles with tag ProductType2)

Products (15)
--ProductType1 (3)
--ProductType2 (12)

When you click on a menu item, you just take the user to a news feed based on that tag.

I swapped your (or Flip Flops?) code which is here:

Code: Select all

// 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";
with this new code:

Code: Select all

//count number of news articles which have a tag assigned equal to each category name

$sql = "SELECT ".DB_PREPEND."phpwcms_content.cnt_id, ".DB_PREPEND."phpwcms_categories.cat_pid ";
$sql .= "FROM ".DB_PREPEND."phpwcms_content JOIN ".DB_PREPEND."phpwcms_categories ";
$sql .= "ON ".DB_PREPEND."phpwcms_content.cnt_id = ".DB_PREPEND."phpwcms_categories.cat_pid ";
$sql .= "WHERE ".DB_PREPEND."phpwcms_content.cnt_status=1 ";
$sql .= "AND ".DB_PREPEND."phpwcms_categories.cat_name=(SELECT ".DB_PREPEND."phpwcms_articlecat.acat_name FROM ".DB_PREPEND."phpwcms_articlecat WHERE ".DB_PREPEND."phpwcms_articlecat.acat_id=$key)";
Maybe this will be useful to someone else.

Re: NLU_FF_AC_QD [update v.1.1]

Posted: Sat 20. Jun 2009, 23:48
by Oliver Georgi
Habe mal flink geschaut.

Es fehlen einige wesentliche Gültigkeitsabfragen für die zu zählenden Artikel.

Code: Select all

		// count number of articles in each category level
		$sql  = 'SELECT COUNT(*) FROM '.DB_PREPEND.'phpwcms_article ';
		$sql .= 'WHERE article_cid=' . $key . ' AND article_deleted=0 AND article_public=1 ';
		$sql .= 'AND article_aktiv=1 AND article_begin<NOW() AND ';
		$sql .= 'IF(article_archive_status=1, 1, article_end>NOW())';

NLU_FF_AC_QD [update v.1.2]

Posted: Fri 20. Nov 2009, 00:31
by Jensensen
habe mal ebenso flink nachgebessert
:== murks

Re: NLU_FF_AC_QD [update v.1.3]

Posted: Sun 6. Dec 2009, 04:04
by Jensensen
The new version of phpwcms 1.4.4 r387 contains also a NEW Version of NAV_LIST_UL what requires an update of this very popular RT.

@OG: thank you!
btw a nice and new article menu navigation.

@flip-flop: sorry, i didn't want break off some links of the wiki.

Your code works perfect.
The idea of analyzing/counting of tags and using it as a base is really great!
Unfortunatly, the "tag system" works only with NEWS, as you said.
[could be a semantic approach, some kind of trigger, side-wide.]
It's an unbelievable feature - very cool - that was introduced by OG but also not considered in other ways. "(yet!)"

As far as I can see your SQL code does work with NEWS only.
It's really a perfect COUNTER for NEWS (and a great example for accessing NEWS in the database!).
What kind of RT did you use?

new version, new code, new stuff:
As well, this RT is fully compatiblel with the new NAV_LIST_UL.
For example, if you use 'FA', you'll get a list of site levels AND its articles (below).
Only site structure levels have (article_count) - that makes sense.

NLU_FF_AC_QD [update v.1.4]

Posted: Fri 22. Jan 2010, 00:09
by Jensensen
Once again, the new version of phpwcms 1.4.5 r397 contains a NEW Version of NAV_LIST_UL (func). That's why this very popular RT needs yet another update.
It's already for download {for friends, but not for greedy jiepers}

As always, you can use this RT the same way like you do with the well known NAV_LIST_UL.
[highly recommended] Use this script with phpwcms 1.4.5 and above.

Re: NLU_FF_AC_QD [update v.1.4]

Posted: Fri 22. Jan 2010, 06:34
by Oliver Georgi
Jensensen wrote:... contains a NEW Version of NAV_LIST_UL (func).
:wink: Not really new, a very little change.

NLU_FF_AC_QD [update v.1.5]

Posted: Sun 28. Nov 2010, 02:53
by Jensensen
Once again, the new version of phpwcms 1.4.7 403 contains a NEW Version of NAV_LIST_UL (func). For example, now, custom CSS classes can be applied for each site level.
That's why this very popular RT needs yet another update.
This download is for friends only.

Use this RT the same way like the well known NAV_LIST_UL.
[recommended] Use this script with phpwcms 1.4.7 and above.

Re: NLU_FF_AC_QD [update v.1.5]

Posted: Sun 28. Nov 2010, 07:23
by Oliver Georgi
remember, the newer NAV_LIST_UL can use articles as menu item too: try FA, PA, FPA

NLU_FF_AC_QD [update v.1.51]

Posted: Mon 25. Apr 2011, 02:19
by Jensensen
latest enhancements by: flip-flop {thank-you}
latest version: 1.51

[de] ... icle-count
[en] ... icle-count

Re: NLU_FF_AC_QD [update v.1.5]

Posted: Tue 26. Apr 2011, 17:55
by update
HE is really back!

Re: NLU_FF_AC_QD [update v.1.5]

Posted: Thu 5. May 2011, 09:21
by baklavoni
Welcome back Jensensen!

btw, nice RT!

NLU_FF_AC_QD [update v.1.6]

Posted: Tue 5. Feb 2013, 05:32
by Jensensen
NAV_LIST_UL, in my opinion, has been massively changed on April 7th, 2012 [r460 v1.5x+].

Due to perfect programming, old versions of the script works well even with newer versions of phpwcms.
Because of structural changes of NAV_LIST_UL in /include/inc_front/ the script needs an update.

Have a look at: ... 2017febc9c ...

More information and Download:

Re: NLU_FF_AC_QD [update v.1.6]

Posted: Tue 5. Feb 2013, 09:47
by update
It's always nice to read you :)