Topic: How can I count the news in different categories?
How can I count the news in different categories? When I use the old hacks they doesn't work in Cute News 2.00
Dear CuteNews Users! Please feel free to contact us via our new Feedback Form and please send information about bugs to our bug tracker.
You are not logged in. Please login or register.
CutePHP Forums → Problem Solving / Help & Support → How can I count the news in different categories?
How can I count the news in different categories? When I use the old hacks they doesn't work in Cute News 2.00
The number of news items is counted automatically in CuteNews to form pagination. Or you can use the cn_get_news($opts); function to directly read data in the cdata/news/cat.idx I dex file.
The number of news items is counted automatically in CuteNews to form pagination. Or you can use the cn_get_news($opts); function to directly read data in the cdata/news/cat.idx I dex file.
In CN 1.5.3 I used this code
<?php
$active_news = file('cdata/news.txt');
$counts = array();
foreach ($active_news as $newsRaw) {
$newsProperties = explode('|', $newsRaw);
$counts[$newsProperties[6]] += 1;
}
echo '('.$counts[2].''; if ($counts[2]<=1) { echo ' публикациÑ)';}
else {echo ' публикации)';}
?>
but now in cn 2.00 I couldn't understand how to change it
To count news items please use the following code:
$counts = array();
$active_news = file('cdata/news/cat.idx');
foreach ($active_news as $newsRaw) {
list($cat_id, $nids) = explode('|', $newsRaw);
$counts[$cat_id] = count(explode(',', $nids));
Please don't forget to make news migration: https://cutephp.com/forum/index.php?showtopic=44045
To count news items please use the following code:
$counts = array();
$active_news = file('cdata/news/cat.idx');foreach ($active_news as $newsRaw) {
list($cat_id, $nids) = explode('|', $newsRaw);
$counts[$cat_id] = count(explode(',', $nids));Please don't forget to make news migration: https://cutephp.com/forum/index.php?showtopic=44045
I don't have cdata/news/cat.idx
What is the problem?
I already migrate to cn 2.00
I don't have cdata/news/cat.idx
What is the problem?
I already migrate to cn 2.00
Hello,
cdata/news/cat.idx will appear in your file manager (easily viewable if you are using cPanel or FTP) if you have uploaded CuteNews to your web host. I have this particular file inside my web host.
What Support_Team means is not for you to migrate from 1.53 to 2.0 again. Please check out the link he provided for you, he meant to tell you that if you are updating CuteNews via GitHub, you will need to use the news migration script to bring your old news over.
Hello,
cdata/news/cat.idx will appear in your file manager (easily viewable if you are using cPanel or FTP) if you have uploaded CuteNews to your web host. I have this particular file inside my web host.
What Support_Team means is not for you to migrate from 1.53 to 2.0 again. Please check out the link he provided for you, he meant to tell you that if you are updating CuteNews via GitHub, you will need to use the news migration script to bring your old news over.
No, I can't find this file. I updated my CN from zip file. I haven't used GitHub. My old news, users and templates are in the new version, but I can't find ths file anywhere.
I install CN 2.0 to local php server
I already seen cat.idx file. In cdata/news there are many files cat.idx.xxx where xxx is a number.
But this script:
$counts = array();
$active_news = file('cdata/news/cat.idx');
foreach ($active_news as $newsRaw) {
list($cat_id, $nids) = explode('|', $newsRaw);
$counts[$cat_id] = count(explode(',', $nids));
doesn't work
I saw that cat.idx has a size 0b
others file are with diferent size but they aren't empty
What's wrong?
CutePHP Forums → Problem Solving / Help & Support → How can I count the news in different categories?
Powered by PunBB, supported by Informer Technologies, Inc.
The pun_antispam official extension is installed. Copyright © 2003–2009 PunBB.