NLU_FF_AC_QD [update v.1.9.5]

Post custom hacks and enhancements for phpwcms here only. Maybe some of these things will be included in official release later.
User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.9.5]

Post by Jensensen » Sun 28. Sep 2008, 23:22

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.
https://github.com/slackero/phpwcms/com ... 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
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:FA,5,,count_articles,active}
Parent lift

Code: Select all

{NLU_FF_AC_QD:FPA,4,2,act_path,active}
new NAV_LIST_UL (since app_v1.4.4 r387 and higher)

Code: Select all

{NLU_FF_AC_QD:FA,3,10,act_path,active,,,,,.......}
Inline PHP

Code: Select all

[PHP] 
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>';
}
[/PHP]

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

master
https://github.com/slackero/phpwcms/com ... 7b9e4d71e9

and

v1.9-dev
https://github.com/slackero/phpwcms/com ... 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:

https://github.com/jensensen/NLU_FF_AC_QD
Last edited by Jensensen on Wed 21. Aug 2019, 02:36, edited 16 times in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.1]

Post by Jensensen » Mon 23. Feb 2009, 22: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!
Last edited by Jensensen on Fri 20. Nov 2009, 00:23, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
yorkshire_boy1
Posts: 17
Joined: Tue 26. Sep 2006, 13:35
Location: UK

Re: NLU_FF_AC_QD [update v.1.1]

Post by yorkshire_boy1 » Thu 18. Jun 2009, 15:33

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.

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

Output:
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.

User avatar
Oliver Georgi
Site Admin
Posts: 9568
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Re: NLU_FF_AC_QD [update v.1.1]

Post by Oliver Georgi » Sat 20. Jun 2009, 23:48

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())';
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.2]

Post by Jensensen » Fri 20. Nov 2009, 00:31

habe mal ebenso flink nachgebessert
:== murks
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

Re: NLU_FF_AC_QD [update v.1.3]

Post by Jensensen » Sun 6. Dec 2009, 04:04

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.

@yorkshire_boy1:
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.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.4]

Post by Jensensen » Fri 22. Jan 2010, 00:09

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.
Last edited by Jensensen on Tue 5. Feb 2013, 05:05, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
Oliver Georgi
Site Admin
Posts: 9568
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Re: NLU_FF_AC_QD [update v.1.4]

Post by Oliver Georgi » Fri 22. Jan 2010, 06:34

Jensensen wrote:... contains a NEW Version of NAV_LIST_UL (func).
:wink: Not really new, a very little change.
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.5]

Post by Jensensen » Sun 28. Nov 2010, 02:53

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.
Last edited by Jensensen on Tue 5. Feb 2013, 05:06, edited 1 time in total.
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
Oliver Georgi
Site Admin
Posts: 9568
Joined: Fri 3. Oct 2003, 22:22
Location: Moscow, Russia
Contact:

Re: NLU_FF_AC_QD [update v.1.5]

Post by Oliver Georgi » Sun 28. Nov 2010, 07:23

remember, the newer NAV_LIST_UL can use articles as menu item too: try FA, PA, FPA
Oliver Georgi | phpwcms Developer | GitHub | LinkedIn | Систрон

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.51]

Post by Jensensen » Mon 25. Apr 2011, 02:19

latest enhancements by: flip-flop {thank-you}
latest version: 1.51

cont'd:
[de] http://www.phpwcms-howto.de/wiki/doku.p ... icle-count
[en] http://www.phpwcms-howto.de/wiki/doku.p ... icle-count
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
update
Moderator
Posts: 6394
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: NLU_FF_AC_QD [update v.1.5]

Post by update » Tue 26. Apr 2011, 17:55

HE is really back!
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

User avatar
baklavoni
Posts: 170
Joined: Mon 23. Oct 2006, 00:48
Location: Bosnia and Herzegovina

Re: NLU_FF_AC_QD [update v.1.5]

Post by baklavoni » Thu 5. May 2011, 09:21

Welcome back Jensensen!
:wink:

btw, nice RT!
There is no page like home page...

User avatar
Jensensen
Posts: 2995
Joined: Tue 17. Oct 2006, 21:11
Location: auf der mlauer

NLU_FF_AC_QD [update v.1.6]

Post by Jensensen » Tue 5. Feb 2013, 05:32

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/front.func.inc.php the script needs an update.

Have a look at:
https://github.com/slackero/phpwcms/com ... 2017febc9c
https://github.com/slackero/phpwcms/tre ... nc.inc.php

More information and Download:

https://github.com/jensensen/NLU_FF_AC_QD
{so_much} | Knick-Knack. | GitHub
Umlaute im URL sind meistens immer Kacke.

User avatar
update
Moderator
Posts: 6394
Joined: Mon 10. Jan 2005, 17:29
Location: germany / outdoor

Re: NLU_FF_AC_QD [update v.1.6]

Post by update » Tue 5. Feb 2013, 09:47

It's always nice to read you :)
It's mostly all about webdesign, logo design, new and old pages refresh, print BUT slowly switching to be supporter for the band Mykket Morton. Visit Mykket Morton on FB. Listen Mykket Morton and live videos on youtube.

Post Reply