How can I show the "Views count" on the single image views?
Example-Gallery-Image [Matrix-Layout]:
http://www.fotogemeinschaft.de/v/fotografen/Werner-Sperl/Menschen/Menschen+01.jpg.html
----
Gallery-Version = 2.0-rc-2 Kern 0.9.36
PHP-Version = 4.3.10 cgi
Webserver = Apache/1.3.33 (Unix)
Datenbank = mysql 4.0.20-standard
Werkzeuge = ArchiveUpload, Gd, Thumbnail, NetPBM, Exif, ImageMagick, SquareThumb
Betriebssystem = Linux infong 2.4 #1 SMP Mon Aug 9 10:21:08 CEST 2004 i686 unknown
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; de-AT; rv:1.7.11) Gecko/20050728
Posts: 8601
make a local tpl for photo.tpl and add showViewCount=true to the {g->block type="core.ItemInfo" ...} near the top.
Posts: 18
Thanks! I´ve tried this, but the counter is only shown in the left picture-block, but not on the Picture-site:
Example:
http://www.fotogemeinschaft.de/v/motive/kunst-kultur/literatur/Canetti-Party-im-Blitz.jpg.html?g2_imageViewsIndex=1
--------
Here are my modifications in:
/gallery2/themes/matrix/templates/local/photo.tpl
------------------------------------------------------------------------
<td style="width: 30%">
{g->block type="core.ItemInfo"
item=$theme.item
showViewCount=true
showOwner=true
class="giInfo"}
{g->block type="core.PhotoSizes" class="giInfo"}
------------------------------------------------------------------------
Ralf
PS: I am using "matrix-Greymatter" template/theme
Posts: 8601
ah, right.. the data isn't loaded.
you'll have to edit your matrix/theme.inc, function showPhotoPage().. add 'viewCount' in the $dataTypes list at the top of that function.
Posts: 18
Hi mindless,
I´ve tried this also, but the counter isn´t shown:
Example:
http://www.fotogemeinschaft.de/v/fotografen/torsten-andreas-hoffmann/indien/india_39.jpg.html?g2_imageViewsIndex=1
Here are my modifications in:
/gallery2/themes/matrix/theme.inc
------------------------------------------------------------------------
/**
* @see GalleryTheme::showPhotoPage
*/
function showPhotoPage(&$template, $item, $params) {
$dataTypes = array('owner', 'viewCount', 'parents', 'systemLinks', 'itemLinks', 'permissions',
'itemLinksDetailed', 'itemNavigator', 'imageViews');
if (!empty($params['showMicroThumbs'])) {
$dataTypes[] = 'navThumbnails';
}
$ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes);
if ($ret->isError()) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
return array(GalleryStatus::success(), 'theme.tpl');
}
------------------------------------------------------------------------
Ralf
PS: Caches were cleared
Posts: 18
Does anybody else know the solution of my problem?
Thanks.
Ralf
Posts: 39
I'd love to be able to do this too, any suggestions? What is that 'imageViews' data chunk that gets loaded (I tried it and it was empty, but am now curious as to what it contains). Anyway, any help on showing view counts on the item page would be great
Posts: 4
it took me 3 hours and lots of pain. and the last post here is 2 years old. ill post the response anyway for anyone who may come accros this problem in the future.
You need to modify this: (on the matrix theme for example)
In the gallery2\themes\matrix\theme.inc you have to change the code from this:
function showPhotoPage(&$template, $item, $params) {
$dataTypes = array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions',
'itemLinksDetailed', 'itemNavigator', 'imageViews');
if (!empty($params['showMicroThumbs'])) {
$dataTypes[] = 'navThumbnails';
}
$ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes);
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
return array(null, 'theme.tpl');
}
====================================
to this:
function showPhotoPage(&$template, $item, $params) {
$dataTypes = array('owner', 'parents', 'systemLinks', 'itemLinks', 'permissions',
'itemLinksDetailed', 'itemNavigator', 'imageViews', 'viewCount'); // <-here i added the viewCount argument
if (!empty($params['showMicroThumbs'])) {
$dataTypes[] = 'navThumbnails';
}
$ret = $this->loadCommonTemplateData($template, $item, $params, $dataTypes);
if ($ret) {
return array($ret->wrap(__FILE__, __LINE__), null);
}
return array(null, 'theme.tpl');
}
Posts: 4
Oh, and then of course you want to show the "view count" on your photo page dont you?
In gallery2\themes\matrix\templates\photo.tpl you introduce the following block where ever suits you:
{g->block type="core.ItemInfo" item=$theme.item showDate=false showOwner=false showViewCount=true class="giInfo"} // this smarty registered function displays the view count.
The extra argument that had to be added is "showViewCount=true".
Posts: 1
Thanks razvansg. With your help, this only took me 5 mintues to get working! Thanks for posting your solution to such an old thread...