2011/10/19 Gilles VINCENT <gilles.vincent@gmail.com>
Hi,
can you give us an extract from your code that reproduces your problem ?
This is curious because #TRI and {tri} seems to correspond to your needs
Here is a code that works for me :
#CACHE{0}
<B_>
#PAGINATION
Yes. Your solution works. But What if I want to change sort order via clicking ID. For example first click will give me articles with IDs 1,2,3…, second click will give 10, 9, 8…, third again 1,2,3… and so forth.
My current (may be not ideal) solution is:
[(#SET{defaut_tri,#ARRAY{
id_article,#ENV{sort_order,1},
titre,#ENV{sort_order,-1}
}})
<B_>
#PAGINATION
[(#ENV{sort_order}|=={1}|?{#SET{sort_order,-1},#SET{sort_order,1}})]
[(#TRI{id_article,ID,'',**#GET{sort_order}**})] |
[(#TRI{titre,TITLE,'',**#GET{sort_order}**})] |
#ID_ARTICLE | #TITRE |
I added 4-th parameter to #TRI tag - sort order. I change it according to current sort_order.
In function balise_TRI_dist I added this code:
$_on = « false »;
$sort_order = interprete_argument_balise(4,$p);
if (!isset($sort_order)) $sort_order = « ‹ › »;
$_url = « parametre_url(parametre_url(self(),$_variable,$s?$_sens:$_champ), sort_order, $sort_order) »;
bofore string $p->code = « lien_ou_expose($_url,$_libelle,$_on ».($_class?« ,$_class »:« »).« ) »;
Actually I reloaded this function within my plugin through creating function balise_TRI function without _dist.
What do you think about this? Am I on rigth way, or reinvent the wheel?
Thanks.