Welcome, Guest. Please login or register.
Did you miss your activation email?
February 11, 2012, 07:59:46 PM

Login with username, password and session length
Search:     Advanced search
Interested in joining the WebsiteBaker team?
For more Information read here or on our new website.
149573 Posts in 21093 Topics by 7536 Members
Latest Member: SpokaneDude
* Home Help Search Login Register
Pages: [1]   Go Down
Print
Author Topic: News 3.5 Module: How to re-order the posts by date?  (Read 494 times)
marcusalee

Offline Offline

Posts: 7


« on: May 07, 2011, 07:01:39 PM »

I have the following problem. When I enter a number of my posts with different date at backend, the posts are not shown in order by date at frontend. Do anyone know how to set orderiing by DATE?
I will be graveful if anybody can help.
Logged
Bug

Offline Offline

Posts: 180


« Reply #1 on: May 07, 2011, 08:15:16 PM »

Look into the view.php of the newsmodule and search for a line that says order by position, change that into order by date.
Logged
marcusalee

Offline Offline

Posts: 7


« Reply #2 on: May 08, 2011, 05:27:03 AM »

hello bug,

thank so much for your great help. I had found the line, but dont know how to change the ORDER by DATE.
it is much appreciated if you could help me with the script.
i start learning PHP script. WB PHP-CMS is found to be so wonderful.
       
Logged
Bug

Offline Offline

Posts: 180


« Reply #3 on: May 08, 2011, 10:55:07 AM »

Give me day, I will post you the new line
Logged
DarkViper
Development Team
*****
Offline Offline

Posts: 1049


« Reply #4 on: May 08, 2011, 11:05:50 AM »

this should solve your problem:

replace this code (about line 135 in /modules/news/view.php)
Code: (old)
<?php

// Query posts (for this page)
$query_posts $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
WHERE section_id = '
$section_id' AND active = '1' AND title != ''$query_extra
AND (published_when = '0' OR published_when <= 
$t) AND (published_until = 0 OR published_until >= $t)
ORDER BY position DESC"
.$limit_sql);

?>

with the code below:

Code: (new)
<?php

// Query posts (for this page)
$query_posts $database->query("SELECT * FROM ".TABLE_PREFIX."mod_news_posts
WHERE section_id = '
$section_id' AND active = '1' AND title != ''$query_extra
AND (published_when = '0' OR published_when <= 
$t) AND (published_until = 0 OR published_until >= $t)
ORDER BY posted_when DESC"
.$limit_sql);

?>

Logged

Anleitungen lesen und selber nachdenken ist anstrengend...  Da lass ich doch lieber andere für mich denken...

In 1984:  Nineteen Eighty-Four is a unrealistic utopia!!
In 2012:  Nineteen Eighty-Four is a little piece only of our reality!!
Bug

Offline Offline

Posts: 180


« Reply #5 on: May 08, 2011, 11:08:21 AM »

There is version of the newsmodule with some more settings, in that version you can set the way to display in the backend settings. This means you can have several pages containing a news module all with different settings.

http://www.websitebaker2.org/forum/index.php/topic,20760.msg141627.html#msg141627
Logged
marcusalee

Offline Offline

Posts: 7


« Reply #6 on: May 08, 2011, 04:43:33 PM »

hello darkviper and buq,

i have tried it and it works successfully
thankyou very much.
Logged
Pages: [1]   Go Up
Print
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.16 | SMF © 2011, Simple Machines Valid XHTML 1.0! Valid CSS!