Sort data from db in plugin

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
Chris
Forum Members
Forum Members
Posts: 49
Joined: Tue Mar 22, 2005 6:59 pm

Sort data from db in plugin

Post by Chris »

Dear all,

I have made this plugin which fatches all data from a db. It is displayed descending one row. I would like to give the user the ability to change this by clicking on a link. Here comes my question, how do I pass through the sort variable ? I can't just use blabla.php?sort=asc, or can I, and how ????

Thanks in advance,

Chris
Chris
Forum Members
Forum Members
Posts: 49
Joined: Tue Mar 22, 2005 6:59 pm

Re: Sort data from db in plugin

Post by Chris »

Is the description fuzzy or doesn't anyone know the sollution ?
Ted
Power Poster
Power Poster
Posts: 3329
Joined: Fri Jun 11, 2004 6:58 pm

Re: Sort data from db in plugin

Post by Ted »

Well, the easiest solution to do it with a plugin is have the URL constructed with something like (assuming mod_rewrite isn't in effect):

Code: Select all

$url = $_SERVER['PHP_SELF'] . '&sort=asc';
and then have the plugin check for that

Code: Select all

$sort = 'asc';
if (isset($_GET['sort']))
{
$sort = $_GET['sort'];
}
However, it's probably easier to write a module to do these things, since the navigation stuff "just works".
Post Reply

Return to “CMSMS Core”