article counter near category name (menu) in visitor page
article counter near category name (menu) in visitor page
hi, I have a question
in this moment I have a web page, based on phpwcms, like a product catalog, but not a eShop, only catalog..
in page articles look like:
question:
how to made, that in visitors page category show article count in category, near category.. like "Variklis (5)" and it should be near every category ?
p.s.
i'm very sorry for my english
in this moment I have a web page, based on phpwcms, like a product catalog, but not a eShop, only catalog..
in page articles look like:
question:
how to made, that in visitors page category show article count in category, near category.. like "Variklis (5)" and it should be near every category ?
p.s.
i'm very sorry for my english
Re: article counter near category name (menu) in visitor page
I understand what StasMark had in mind. He wants to show number of articles placed in particular category.
It should look like this in menu: Category (5) (Category name (number of 5 articles placed in this category))
Unfortunately I have no answer to his question.
May be others have any suggestion.
Flip-flop is guru of menus
Flip-flop???
It should look like this in menu: Category (5) (Category name (number of 5 articles placed in this category))
Unfortunately I have no answer to his question.
May be others have any suggestion.
Flip-flop is guru of menus
Flip-flop???
٩(͡๏̯͡๏)۶
Re: article counter near category name (menu) in visitor page
Hi StasMark,
it is not possible at the moment by the existing Navi-RT's. You need to program this feature by yourself.
But I think it is not soooo hard to do.
Good luck, Heiko...
it is not possible at the moment by the existing Navi-RT's. You need to program this feature by yourself.
But I think it is not soooo hard to do.
Good luck, Heiko...
Re: article counter near category name (menu) in visitor page
[x]
Last edited by Jensensen on Sat 20. Sep 2008, 03:41, edited 1 time in total.
Re: article counter near category name (menu) in visitor page
Hi,
there is a small RT counting the articles of the active category.
Put into /template/inc_script/frontend_render/rt_article_count.php.
Tag: {ARTICLECOUNT}
[EDIT] The old one, please see below[/EDIT]
[EDIT] NEW: Reduced this snippet to the minimum.
[/EDIT 24.04.08]
Knut
there is a small RT counting the articles of the active category.
Put into /template/inc_script/frontend_render/rt_article_count.php.
Tag: {ARTICLECOUNT}
[EDIT] The old one, please see below[/EDIT]
Code: Select all
<?php
// ================================================================
// Show the count of articles in active category
// 02.03.08 K.H. flip-flop
//
// Thanks to Jensensen for the inspiration
// http://forum.phpwcms.org/viewtopic.php?p=100208#p100208
// Input : {ARTICLECOUNT}
// Output .e.g.: 17
// File: /template/inc_script/frontend_render/rt_article_count.php
// Config: $phpwcms['allow_ext_render'] = 1;
//
// =================================================================
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
function my_article_count () {
$my_cat_id = $GLOBALS['content']['cat_id'];
$sql = "SELECT * FROM ".DB_PREPEND."phpwcms_article WHERE article_cid=$my_cat_id ";
$sql .= "AND article_public=1 AND article_aktiv=1";
$result = mysql_query($sql);
$num_rows = mysql_num_rows($result);
return $num_rows;
}
// ARTICLECOUNT replacement
if( ! (strpos($content["all"],'{ARTICLECOUNT}')===false)) {
$content["all"] = str_replace('{ARTICLECOUNT}', my_article_count(), $content["all"]);
}
?>
Code: Select all
<?php
// ================================================================
// Show the count of articles in the active category (V1.1)
// 02.03.08 K.H. flip-flop
// 25.04.08 K.H. Edit V1.1
//
// Thanks to Jensensen for the inspiration
// http://forum.phpwcms.org/viewtopic.php?p=100208#p100208
// Input : {ARTICLECOUNT}
// Output .e.g.: 17
// File: /template/inc_script/frontend_render/rt_article_count.php
// Config: $phpwcms['allow_ext_render'] = 1;
// =================================================================
// ----------------------------------------------------------------
// obligate check for phpwcms constants
if (!defined('PHPWCMS_ROOT')) {
die("You Cannot Access This Script Directly, Have a Nice Day.");
}
// ----------------------------------------------------------------
if( ! (strpos($content["all"],'{ARTICLECOUNT}')===false)) {
$content["all"] = str_replace('{ARTICLECOUNT}', count($GLOBALS['content']["articles"]), $content["all"]);
}
?>
Knut
Last edited by flip-flop on Fri 25. Apr 2008, 10:01, edited 1 time in total.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Re: article counter near category name (menu) in visitor page
flip-flop, not worked..
i make a video to show it:
turn off sound
http://www.youtube.com/watch?v=bkIxRKGGYeM
and video file can find on normal resolution can find:
http://rapidshare.com/files/97672632/arc_count.avi.html
or
http://customvirus.lt/arcount.rar
i make a video to show it:
turn off sound
http://www.youtube.com/watch?v=bkIxRKGGYeM
and video file can find on normal resolution can find:
http://rapidshare.com/files/97672632/arc_count.avi.html
or
http://customvirus.lt/arcount.rar
Re: article counter near category name (menu) in visitor page
didn't checked FE render by flip-flop {should work as well}
but the hack! as posted above
was tested and works fine...
btw.: thank you for smashing our ears....
but the hack! as posted above
was tested and works fine...
btw.: thank you for smashing our ears....
Re: article counter near category name (menu) in visitor page
[x]
Last edited by Jensensen on Sat 20. Sep 2008, 00:03, edited 1 time in total.
Re: article counter near category name (menu) in visitor page
Without a hack it is only possible with a new NAV_LIST_UL in frontend_render.
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Re: article counter near category name (menu) in visitor page
Here is a variation of the hack that Jensensen documented
I had the problem of not getting article count to match line
so here is a slightly different modification to function buildCascadingMenu( )
inside front.func.inc.php. It outputs article count inside <a href> </a>- more predictable
and
just a slight modification
I had the problem of not getting article count to match line
so here is a slightly different modification to function buildCascadingMenu( )
inside front.func.inc.php. It outputs article count inside <a href> </a>- more predictable
Code: Select all
foreach($GLOBALS['content']['struct'] as $key => $value) {
// NEW CODE line 2881 approx.
$temp_sql = "SELECT * FROM ".DB_PREPEND."phpwcms_article WHERE article_cid=$key ";
$temp_sql .= "AND article_public=1 AND article_aktiv=1";
$temp_result = mysql_query($temp_sql);
$temp_num_rows = mysql_num_rows($temp_result);
and
Code: Select all
// ORIGINAL CODE line 2925 approx.
// $li .= '>' . $li_a . '</a>';
$li .= '>' . $li_a . ' ('.$temp_num_rows.')</a>'; // NEW CODE
$li .= $li_ul.'</li>'.LF; // remove $li_ul from this line of code if $ie_patch is used
$x++;
}
mysql_free_result($temp_result); // NEW CODE
}
Re: article counter near category name (menu) in visitor page
[x]
(ready)
ask
(ready)
ask
Last edited by Jensensen on Fri 19. Sep 2008, 23:52, edited 1 time in total.
Re: article counter near category name (menu) in visitor page
-> $temp_num_rows = _dbCount($temp_sql);$temp_result = mysql_query($temp_sql);
$temp_num_rows = mysql_num_rows($temp_result);
But I think a hack isn´t a good solution.
Yesterday Jens and me have been think about this problem.
A better solution is a enhanced {MY_NAV_LIST_UL:C,......., ID1, ID2, ID3....} or {MY_NAV_LIST_UL:C,........} for all levels. (in frontend_render).
At this time I think the best solution is a replacer in frontend_render. By triggering the Ids produced with NAV_LIST_UL
e.g. <li id="li_article_level_13" class="sub_no"><a href="index.php?ebene06"><span>Ebene06</span></a></li>
Tag: {ARTICLE_COUNT: ID1, ID2, ID3.....} or {ARTICLE_COUNT:0} for all levels.
Found in line li_article_level_XX -> trigger XX -> call the db for article count -> inject the article count before </a> .
This is the most cleanest solution for me, no hack, no second navigation, only a frontend_render script.
Knut
>> HowTo | DOCU | FAQ | TEMPLATES/DOCS << ( SITE )
Re: article counter near category name (menu) in visitor page
cheers guys - will follow this thread....
Re: article counter near category name (menu) in visitor page
I'm trying another solution that can be found here: http://forum.phpwcms.org/viewtopic.php?f=8&t=17891