UAP 3 Documentation - Views

Welcome to UAP Docs - Views

PageViews Helper


PageViews Helper is used to display total unique views.

This helper can be used within Controllers.

use Helpers\PageViews;

public function items($id){
	// Update and Get Views Data
	$data['PageViews'] = PageViews::views('true', $id, 'Items', $u_id);
}

Then use View to display PageViews data.

// Display Views Count
echo "<div class='btn btn-xs btn-info'>Views <span class='badge'>".$data['PageViews']."</span></div>";

To only display the PageViews Count without adding more PageViews, use the following in the View

use Helpers\PageViews;

// Display total views without updating db
echo "<div class='btn btn-info btn-xs' style='margin-top: 3px'> Views <span class='badge'>";
echo PageViews::views('false', $data['item_id'], 'Items', $data['current_userID']);
echo "</span></div> ";

- Can't find what your looking for? Please use Forum.