view_top_list

Summary

Fetches a list of most viewed node objects.

Usage

fetch( 'content', 'view_top_list', [ hash( 'section_id', section_id,
                                           'class_id',   class_id,
                                           'offset',     offset,
                                           'limit',      limit ) ] )

Parameters

NameTypeDescriptionRequired
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.

Returns

An array of nodes (ezcontentobjecttreenodes).

Description

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.

Examples

{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

Contents

Reference

Database diagram
Template operators
Template functions
Data fetching
    Class
    Content
       access
       bookmarks
       can_instantiate_class_list
       can_instantiate_classes
       class
       class_attribute
       class_attribute_list
       collected_info_collection
       collected_info_count
       collected_info_count_list
       contentobject_attributes
       draft_count
       draft_version_list
       keyword
       keyword_count
       list
       list_count
       locale_list
       navigation_parts
       node
       non_translation_list
       object
       object_by_attribute
       object_count_by_user_id
       pending_count
       pending_list
       recent
       same_classattribute_node
       search
       section_list
       tipafriend_top_list
       translation_list
       trash_count
       trash_object_list
       tree
       tree_count
       version
       version_count
       version_list
       view_top_list
    Collaboration
    Layout
    Notification
    Package
    Section
    Shop
    URL
    User
Modules
XML tags


Created

06/02/2004
1:16:42 pm
by Balazs Halasy

Last updated

12/02/2004
2:03:30 pm
by Wenyue Yu

Authors

Balazs Halasy
Wenyue Yu



This page is part of the Exponential documentation. The documentation is available under the GNU Free Documentation License. All contributions will be released under the terms of this license.