Page 1 of 1

Cataloger : sorting

Posted: Thu Jun 15, 2006 5:13 pm
by chris..
Does anyone know if there is a way to sort $items[].attrname (ascending or descending) ?

I've modified the Category-Table-based template with some attrname for each item's properties, and it must be a smarty code to do sorting when clicking on it (there's already a Cataloger function to sort by name or by navigation order).

Thanx to share if someone have done that.

Re: Cataloger : sorting : Got iT !!

Posted: Thu Jun 22, 2006 9:41 pm
by chris..
Lil' bit hard to explain in foreign language (I'm still Belgian & PHP nOOb & full of wine - I know, again ;D), but I think it's missing to every data base driven CMS.

There's a smarty plugin to download with some dependencies : http://www.actindo.de/contenido/cms/fro ... p?idcat=78
then put 'em all (block.datatable & smarty.plugins) in your root/lib/smarty/plugins directory.

Your Cataloger Category template has now to look like this :

Code: Select all

<div>
{datatable data=$items sortable=1 searchable=1 cycle=1 mouseover=1 width="100%" row_onClick="row_name('\$link')"}

 {column id="title" name="Title" width="50%" sorttype="Alpha"}
 {column id="attrname_1" name="title_attrname_1" width="25%" sorttype="Alpha"}
 {column id="attrname_2" name="title_attrname_2" width="25%" sorttype="Alpha"}

{/datatable}
</div>

{literal}
<__script__ type="text/JavaScript">
function row_name( link )
{
  window.location.href = link; 
}
</__script>
{/literal}
Everything's explain in the source code (available here : http://smarty.incutio.com/?page=datatable ).

Do not forget to add style.css and functions.js (given with datatable's sources) in a way that CMSMS could understand it (stylesheet editing or global_content or whatever you want).

Not perfect at all - well, it works,
but...it is just the begining.

P.S :
When I said all files, I didn't mean example files : example0.tpl, example1.tpl, example2.tpl, example.php, index.html.

Re: Cataloger : sorting

Posted: Fri Jun 23, 2006 4:54 am
by cyberman
Thanks for your hint - perhaps you wanna share this here  ;)

http://wiki.cmsmadesimple.org/index.php ... _tags_here

Re: Cataloger : sorting

Posted: Fri Jun 23, 2006 7:48 am
by chris..
More a hack than a tag. ;)

I've only tried with Cataloger module, but it can be usefull for other modules templates.
If you're still thinking that's the right place, then I'll put it there.