How can I show the "Views count" on the single ima

schlieper

Joined: 2005-02-06
Posts: 18
Posted: Fri, 2005-08-26 09:39

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

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-08-26 15:22

make a local tpl for photo.tpl and add showViewCount=true to the {g->block type="core.ItemInfo" ...} near the top.

 
schlieper

Joined: 2005-02-06
Posts: 18
Posted: Fri, 2005-08-26 16:24
mindless wrote:
make a local tpl for photo.tpl and add showViewCount=true to the {g->block type="core.ItemInfo" ...} near the top.

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

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Fri, 2005-08-26 16:42

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.

 
schlieper

Joined: 2005-02-06
Posts: 18
Posted: Sat, 2005-08-27 06:27
mindless wrote:
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.

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

 
schlieper

Joined: 2005-02-06
Posts: 18
Posted: Tue, 2005-08-30 11:11

Does anybody else know the solution of my problem?

Thanks.

Ralf

 
swift
swift's picture

Joined: 2003-12-08
Posts: 39
Posted: Wed, 2005-09-07 01:52

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

 
razvansg

Joined: 2006-11-21
Posts: 4
Posted: Wed, 2006-11-22 13:05

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');
}

 
razvansg

Joined: 2006-11-21
Posts: 4
Posted: Wed, 2006-11-22 13:07

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

 
ctuft

Joined: 2002-09-02
Posts: 1
Posted: Sun, 2007-01-28 00:57

Thanks razvansg. With your help, this only took me 5 mintues to get working! Thanks for posting your solution to such an old thread...