Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums Help & Support 4.0.2 Order by stopdate or archivedate
Roepertje
Posted on 20 Jul 2011, 16:26:15

Access: Member
Total Posts: 4
Joined: 2011-07-20

I have an eventslist.
How can I order this list with the stopdate or archivedate.
It is now ordered by timestamp (the date when news is added).

So in my list the event which comes first should be on top.
After the event has taken place this newsitem is archived. (for example: eventdate + 1 day)

Is there a simple hack to manage this?
#3513
Roepertje
Posted on 20 Jul 2011, 19:43:08

Access: Member
Total Posts: 4
Joined: 2011-07-20

Well, I've found it out myself, but maybe I've overlooked something or coding isn't very well.

functions.php
find around rule 1612
Code:

$order = $_SESSION['order'];
}else{
$sortby = NEWS_ARTICLES . '.timestamp';

change to
Code:

$order = $_SESSION['order'];
}else{
$sortby = NEWS_ARTICLES . '.timestamp';
$sortby = NEWS_ARTICLES . '.archivedate';

find around rule 1774
Code:

echo "<option value=\"" . NEWS_ARTICLES . ".timestamp\""; if($sort == NEWS_ARTICLES . ".timestamp"){ echo " selected=\"selected\""; } echo ">".$langmsg['selectfield'][11]."</option>";

change to
Code:

echo "<option value=\"" . NEWS_ARTICLES . ".timestamp\""; if($sort == NEWS_ARTICLES . ".timestamp"){ echo " selected=\"selected\""; } echo ">".$langmsg['selectfield'][11]."</option>";
echo "<option value=\"" . NEWS_ARTICLES . ".archivedate\""; if($sort == NEWS_ARTICLES . ".archivedate"){ echo " selected=\"selected\""; } echo ">".$langmsg['selectfield'][11]."</option>";


Index.php
find around rule 461
Code:
$orderby = (empty($orderby)) ? '' : $orderby;
if(!$orderby){
$orderby = 'timestamp';

change to
Code:
$orderby = (empty($orderby)) ? '' : $orderby;
if(!$orderby){
$orderby = 'timestamp';
}elseif($orderby == "archivedate"){
$orderby = 'archivedate';


and to include it in my page:

Code:
<?php 

$archives 
= '0'; 
$orderby = 'archivedate'; #sort by archivedate
$newsorder = 'ASC';
include 
'news/index.php';

?>


I don't know what to do with timestamp in rule 522 and 667, so I didn't change that

#3514
Network-13.com © 2013