Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

HomePage - most read news

Asked Modified Viewed 2,628 times
K
Kvido
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions
asked
Senior Member

Hi everyone!

Has anyone tried to sort Homepage News and the bay all day ranked by most read news?

Thus, the number of reading.

In news.php:
$result = dbquery(
         "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
         FROM ".DB_NEWS." tn
         LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
         LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
         WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
            AND (news_end='0'||news_end>=".time().") AND news_draft='0'
         GROUP BY news_id
         ORDER BY news_sticky DESC, news_datestamp DESC LIMIT ".$_GET['rowstart'].",".$items_per_page
         
      );
0 replies

10 posts

C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Hi,

news_reads is what you need, like so...

    $result = dbquery(
             "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
             FROM ".DB_NEWS." tn
             LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
             LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
             WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
                AND (news_end='0'||news_end>=".time().") AND news_draft='0'
             GROUP BY news_id
             ORDER BY news_sticky DESC, news_reads DESC LIMIT ".$_GET['rowstart'].",".$items_per_page
             
          );


Regards
0 replies
K
Kvido
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions
answered
Senior Member

Yes, it works. Thank you ...

but ... is it all OK:

1/ Just The novelty day. They need a list of all the latest innovations, ranked by reads.

2 / Other News (other days), if possible, according reads.

Maybe it should be:

news_reads DESC LIMIT 6


...but it does not work. (?)
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Hey,

Not sure I understand. What do you mean?

Regards
0 replies
K
Kvido
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions
answered
Senior Member

By this I mean that a change in the code must be larger.
To lined up every day news himself from the most revered. Not according to the order in which were included by Admin.

This code:

$result = dbquery(
   "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
   FROM ".DB_NEWS." tn
   LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
   LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
   WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
   AND (news_end='0'||news_end>=".time().") AND news_draft='0'
   GROUP BY news_id
   ORDER BY news_sticky DESC, news_datestamp DESC LIMIT ".$_GET['rowstart'].",".$items_per_page
      );


I want to change this:

//Modification Craig - Kvido, 20.06.2014

$result = dbquery(
             "SELECT tn.*, tc.*, tu.user_id, tu.user_name, tu.user_status
             FROM ".DB_NEWS." tn
             LEFT JOIN ".DB_USERS." tu ON tn.news_name=tu.user_id
             LEFT JOIN ".DB_NEWS_CATS." tc ON tn.news_cat=tc.news_cat_id
             WHERE ".groupaccess('news_visibility')." AND (news_start='0'||news_start<=".time().")
  AND (news_end='0'||news_end>=".time().") AND news_datestamp <= ".(time()-86400)." AND news_draft='0'
             GROUP BY news_id
  ORDER BY news_sticky DESC, news_reads DESC LIMIT 6".$_GET['rowstart'].",".$items_per_page
             );


Now I'm going to try to localhost.
Craig, please check out whether the code can be. Diak,. much!!
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Hi,

The code in post #2 does not do that?
Maybe I do not understand!

Regards
0 replies
K
Kvido
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions
answered
Senior Member

I'm sorry too!! That I understand that this code only partially!!! Instead reads I've had in my rewriting the code wrong "reades" .... So it did not work completely.

Now is your recommendation is OK!!

Localhost no longer works, viz. Image.
News are sorted in the current / actual day of the most widely read news to at least read news.
It's great.
I'll see what happens on stark site
Kvido attached the following file:
news_reads1_ok.png [No information available / 59 Downloads]
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Hi,

You sorted? I mean solved?

Regards
0 replies
K
Kvido
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions
answered
Senior Member

So stark site it shows only one of the most widely read current news current day (although there is an additional 5 news).

Below that are then sorted widely read news on the remaining period in the last six years.

Both versions are on the platform PHP v.7.02.07.
Do it on something sharp site influences.
It's not that sharp on the site have your theme on localhost Modis and Gillette. But it goes on Phos and others. Modish is a "function render_article" along with news, if I'm not mistaken: / themes / Modish / includes / render_news_articles
So, I'm thinking ...
Edited by Kvido on 21-06-2014 14:15,
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Yes only news.php needs modded. Not any theme files.
0 replies
K
Kvido
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions
answered
Senior Member

I see.
I'll give the same theme localhost Modsish what it does and then compared to the sharp website http://www.pc-politika.cz

Merged on Jun 21 2014 at 15:34:42:
Modish and lined up on localhost / radio news correctly. OK cool!!
Thus, from the largest number of visitors to the smallest Views.

Why it does not work this way on the sharp website.? Mystery ....
Checking now news.php of sharp site ...
Edited by Kvido on 21-06-2014 14:37,
0 replies

Labels

None yet

Statistics

  • Views 0 views
  • Posts 10 posts
  • Votes 0 votes
  • Topic users 2 members

2 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
K
K
Kvido 10
Linux-Ubuntu 09.03.60, Linux/Ubuntu, PHP5, HTML5, Mozilla-Firefox 3.6.3, Opera 10.51, IE 8.0.6
https://www.nekecamweb.cz
  • Senior Member, joined since
  • Contributed 524 posts on the community forums.
  • Started 108 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet