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 $orderby bug?
chinkychica
Posted on 27 Feb 2012, 19:18:02

Access: Member
Total Posts: 7
Joined: 2012-02-24

I have been messing around with the $orderby tag, and the only values that seem to work are "title" and "timestamp". "viewcount", "commentcount", and "rating" have no effect. Anyone else have this problem / is this a bug? Or am I doing something wrong?

side note (didn't want to make a new post) - I used http://network-13.com/thread/1338-News-filter-by-category#1341 and switched $cat[] to $orderby to create links that allow users to sort by different variables. The default newsorder is DESC, however, so if you sort by title (or in theory viewcount, commentcount or rating) it shows the last (lowest) first. I would like to switch the newsorder to ASC when viewing title, viewcount, commentcount or rating, but I'm not sure how to create a link that changes both $orderby and $newsorder. Could you explain how to do this?

#3763
Last edited by chinkychica at 2012-02-29 05:13:49 Reason: added side note
Chris
Posted on 28 Feb 2012, 04:02:54

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Ah you've found a bug in the documentation. On the Integration page, it said the following

<?php
$orderby = 'timestamp'; 
include 'news/index.php';
?>

The order your news will be displayed, default is timestamp, possible options are rating, viewcount, title & commentcount

What that should have said is

The order your news will be displayed, default is timestamp, possible options are rating, views, title & comments

I suspect this is the problem you were having. Try using views & comments to see if that works.

#3766
Last edited by Chris at 2012-02-28 04:04:25 Reason: typo
chinkychica
Posted on 28 Feb 2012, 04:16:43

Access: Member
Total Posts: 7
Joined: 2012-02-24

Ah, that works! Haha, thanks, what a silly mix up :P

Well, I've just realized that the links I'm using to set $orderby don't stick if you go to the next page. Is there any way to fix that, so that clicking to page 2 shows the next news in the order selected, instead of reverting to displaying the second page of $orderby = timestamp?

#3767
Last edited by chinkychica at 2012-02-28 04:43:32 Reason: still needed help
Chris
Posted on 28 Feb 2012, 04:53:43

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

<?php
$linkprefix = 'variable=value&';
?>

This will be added to the beginning of all hyperlinks to help users who are incorporating the script into another system

This is what you're looking for. You could do something like this

<?php
$linkprefix = 'order=' . $_GET['order'] . '&';
include 'news/index.php';
?>

Now the pagintation links should have order=something added to each URL.

#3768
chinkychica
Posted on 29 Feb 2012, 05:13:49

Access: Member
Total Posts: 7
Joined: 2012-02-24

Ah! Thank you so much! :D

#3770
Network-13.com © 2013