Cataloger : sorting

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
chris..
Forum Members
Forum Members
Posts: 62
Joined: Thu Jun 01, 2006 8:03 pm

Cataloger : sorting

Post 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.
chris..
Forum Members
Forum Members
Posts: 62
Joined: Thu Jun 01, 2006 8:03 pm

Re: Cataloger : sorting : Got iT !!

Post 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.
Last edited by chris.. on Fri Jun 23, 2006 8:16 pm, edited 1 time in total.
cyberman

Re: Cataloger : sorting

Post by cyberman »

Thanks for your hint - perhaps you wanna share this here  ;)

http://wiki.cmsmadesimple.org/index.php ... _tags_here
chris..
Forum Members
Forum Members
Posts: 62
Joined: Thu Jun 01, 2006 8:03 pm

Re: Cataloger : sorting

Post 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.
Last edited by chris.. on Fri Jun 23, 2006 4:05 pm, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”