boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ascending/descending code

 
Post new topic   Reply to topic    boardom Forum Index -> PHP help
View previous topic :: View next topic  
Author Message
Cyberian75



Joined: 26 Sep 2002
Posts: 1054
Location: Oregon

PostPosted: Wed Jan 08, 2003 2:49 am    Post subject: ascending/descending code Reply with quote

I'm trying to implement an ascending/descending feature which users can use to change the order of date of blogs. This doesn't have to remember its value, but I would like it to be functional when $cat and/or $m variables are defined. So far, I have the following:

Code:

$cq = $HTTP_SERVER_VARS['QUERY_STRING'];
echo '<a href="?'.$cq.'order=ASC">ASC</a>';
echo ' | ';
echo '<a href="?'.$cq.'order=DESC">DESC</a>';


This works okay, but the problem is that it keeps adding to the existing variables in the URL. To resolve this, I think I should use preg_replace function, but I'm utterly lost with it.

Also, it should be able to take in variables if they are already defined in the URL, something like what next_posts function does.

Could someone please help me with this? Thanks in advance. Smile
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
alex_t_king



Joined: 09 Oct 2002
Posts: 194

PostPosted: Wed Jan 08, 2003 4:39 am    Post subject: Reply with quote

on a per session level (let each visitor set their preferred order?) or on a system level (a setting for the site which controls ascending/descending?)?

If it isn't on a per session/visitor, there is no reason not to just add a var into the config file and reference that - no need to put it in the URL at all.
_________________
Yahoo! Messenger ID: alex_t_king
Back to top
View user's profile Send private message Send e-mail Visit poster's website Yahoo Messenger
Cyberian75



Joined: 26 Sep 2002
Posts: 1054
Location: Oregon

PostPosted: Wed Jan 08, 2003 4:46 am    Post subject: Reply with quote

I meant on a session level. What I'm trying to do is let the user switch back and forth between ascending and descending orders.

Am I missing something here?

Thanks for replying by the way. Smile
_________________
Michael P.
Back to top
View user's profile Send private message Visit poster's website AIM Address
initself



Joined: 09 Apr 2003
Posts: 12

PostPosted: Wed Jul 16, 2003 1:54 am    Post subject: Ascending/Descending on a Global Level Reply with quote

Michael,

I can't even figure out how to set ascending and descending on a global level. I post to show from oldest to newest, not the other way around. How would you do that?

mb
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> PHP help All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group