Forums / Developer / Most commented

Most commented

Author Message

Ivo Lukac

Monday 27 July 2009 8:36:20 am

Does anybody has solution to implement "most commented" feature?
Some operator which can sort nodes by subnodes count maybe?

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

André R.

Monday 27 July 2009 8:49:42 am

Its a filter, but could be a starting point:
http://svn.projects.ez.no/ezcore/trunk/ezcore/classes/nodehaschildrenfilter.php

eZ Online Editor 5: http://projects.ez.no/ezoe || eZJSCore (Ajax): http://projects.ez.no/ezjscore || eZ Publish EE http://ez.no/eZPublish/eZ-Publish-Enterprise-Subscription
@: http://twitter.com/andrerom

Ivo Lukac

Monday 27 July 2009 9:01:48 am

Interesting.

Now I only need to figure out how to sort it :)

Thanks

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Ivo Lukac

Monday 27 July 2009 9:20:49 am

Here we go (if somebody else need it):

<?php
class NodeChildrenCountFilter
{
    function NodeChildrenCountFilter()
    {
    }

    function createSqlParts( $params )
    {

        return array('tables' => '', 'joins' => '', 'columns' => ', ( SELECT count(*) FROM ezcontentobject_tree ezcontentobject_tree_2  WHERE ezcontentobject_tree_2.parent_node_id = ezcontentobject_tree.node_id) AS children_count ');
    }
}
?>

Just need to put this extended filter in fetch and sort it by children_count DESC

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac