1 Functionality description
Saves every URL the user surfs to automatically in volatile memory (memcache). To find a user’s history items from memcache we’ll use the unique ID in the user’s cookie (same as for “Remember pages”).
A widget will display the last pages either as a box for sidebars or as a full page list. The widget settings provide a variable to determine the number of history items to display for each user.
2 LastVisitedPages widget
This widget shows box with last visited pages:
- collection_id – Collection id for filtering pages
- count – Amount of displaying items
Example of usage:
<?php $this->widget('history.widgets.LastVisitedPages', array('count' => 6)) ?>
3 save() method
This method is used to save current page into user history
Example of usage:
<?php Yii::app()->getModule('history')->save('/current/url', 'Current Page Title', 'pageId'); ?>
4 Auto saving method
It is possible to use auto saving method. This means that every visitet page will be saved into user history automatically. In this case page id and page title will be empty.
To enable this option set in config:
'modules' => array( 'history' => array( 'autoSave' => true )