ez.no / exponential / documentation / reference / data fetching / content / view_top_list
fetch( 'content', 'view_top_list', [ hash( 'section_id', section_id,
'class_id', class_id,
'offset', offset,
'limit', limit ) ] )
| Name | Type | Description | Required |
|---|---|---|---|
| section_id | integer | Section ID. | No. |
| class_id | integer | Class ID. | No. |
| offset | integer | Start at this offset. | No. |
| limit | integer | Max number of returned nodes. | No. |
An array of nodes (ezcontentobjecttreenodes).
This function can be used to fetch the most popular (most viewed) nodes. The function returns an array of content nodes (ezcontentobjecttreenodes).
Note that to use this function, you should eable cronjob to updata view counter. Add the following line to settings/cronjob.ini:
Scripts[]=updateviewcount.php
This cronjob will analyse the apache log and update corresponding tables in database. Configure settings/logfile.ini and let the system find your apache log.
This fetch function was added in Exponential 3.3.1.
{let view_list=fetch( 'content', 'view_top_list', hash( 'class_id', 2, 'limit', 10, 'offset', 0 ) ) } {section var=ViewList loop=$view_list} <a href={concat( "/content/view/full/", $ViewList:item.node_id )|ezurl}> {$ViewList.name} </a><br /> {/section} {/let}
Fetches the 10 most popular articles ( class id 2 ).
Comments