View Full Version : Addon: top_views
casperghst42
09-11-2006, 02:13 PM
I've created a small add which can be used to generate a 'top' viewed page.
I only create a thumbrow for horizontal, for vertical one should use HITS_<xx>_<y>, which <xx> is THUMBNAIL, COUNT, DATETIME (photo time), HEADLINE (name of photo), BODY (description), and <y> is a number from 1 to the maximum number of thumbnails wanted to be shown.
Example:
<tr>
<td valign=top><span class="title"><HITS_COUNT_1></span></td>
<td><span id="thumbrow"><HITS_THUMBNAIL_URL_1></span></td>
<td><span class="footer"><HITS_HEADLINE_1><br/><HITS_DATETIME_1></span></td>
</tr>
It should fairly easy to expand....
Live example: http://www.exilepixel.com/pixelpost/index.php?x=hits
Download: http://exilepixel.com/download/pixelpost/top_views_0.1.zip
Regards
Casper
fredmeg
09-24-2006, 10:51 PM
Thank you ! This addon is great.
Only one problem on my page : apostrophe (I'm french) are replaced buy /'.
Visible on this link :
http://dansmarue.free.fr/index.php?x=hits
Connie
09-25-2006, 01:46 PM
Only one problem on my page : apostrophe (I'm french) are replaced buy /'.
so I assume this addon was written by some american / english person who does not know that there are some umlauts and special characters existing ;=)
who wrote this addon?
please check how the entries are read from the database and how they are "formatted" to show perfectly in PP and do the same in that Addon, please!
casperghst42
09-26-2006, 03:11 PM
Sorry not American nor English - Danish, and yes I know of these things called special characters:-) - just never use them.
I'll get around to fix this....
Regards/Casper
Only one problem on my page : apostrophe (I'm french) are replaced buy /'.
so I assume this addon was written by some american / english person who does not know that there are some umlauts and special characters existing ;=)
who wrote this addon?
please check how the entries are read from the database and how they are "formatted" to show perfectly in PP and do the same in that Addon, please!
Connie
09-26-2006, 05:00 PM
Ah, you wrote it ;=)
I think you have enough special characters to run into trouble ;=)
Casper, just use the standard escaping / string modifying functions of PHP
casperghst42
09-26-2006, 07:59 PM
I updated it to escape 'special' characters, please try it and let me know if it works; http://www.exilepixel.com/download/pixelpost/top_views_0.2.zip
I don't use special characters as I've not had a danish keyboard for 6 years, and 99.9999% of what I do is in English anyway. But yes, they are a pain.
Regards/Casper
fredmeg
09-27-2006, 07:14 AM
but the problem persists.
http://dansmarue.free.fr/index.php?x=hits
but thank you for your help !
casperghst42
09-27-2006, 08:27 AM
Please try again - same file, but slightly updated.
Thanks.
Regards/Casper
but the problem persists.
http://dansmarue.free.fr/index.php?x=hits
but thank you for your help !
fredmeg
09-27-2006, 09:27 AM
But same problem...
Sorry but I don't understand anything about php language... so I can't do anything.
fredmeg
09-27-2006, 09:34 AM
A "ghost picture" appear on the hits page.
I've deleted it but an empty frame is still on the page.
http://dansmarue.free.fr/index.php?x=hits
casperghst42
09-27-2006, 09:51 AM
The ghost image is probablly because you delete image no 100 - I will add code to make sure that it will not take deleted photos into the list.
As for the the other still ongoing issue with the characters, I can now see that it encodes the ' to <amp>#039; - I do not understand where the \ comes from.
Regards/Casper
Connie
09-27-2006, 09:58 AM
I did not look into your source code, but slashes come mostly from
this one
http://www.php-center.de/en-html-manual/function.addslashes.html
Just add strip_slashes to remove \ from title of pic.
casperghst42
09-27-2006, 02:26 PM
Cheers, thank you for that one.
I've also added a check for existense of the photo, as deleted photos are still in the counter table.
http://www.exilepixel.com/download/pixelpost/top_views_0.3.zip
Please test and let me know if it works.
Regards/Casper
Just add strip_slashes to remove \ from title of pic.
fredmeg
09-27-2006, 05:32 PM
Everything is OK now.
http://dansmarue.free.fr/index.php?x=hits
No more problem with caracters and my ghost picture is now really dead.
I like this addon. Thank you Casper and others ! Nice work !
djaef
09-28-2006, 03:21 AM
sorry Casper I don't get it. Could you explain again how to edit the variables? I can't get mine to work,
Geoff
(jeg kan også tale dansk hvis du vil hellere email - djaef dot optusnet dot com dot au)
casperghst42
09-28-2006, 07:30 AM
I create the following variables;
<THUMBNAILS_HITS_ROW> - just a normal row (just like the normal <THUMBNAILS_ROW>.
<HITS_THUMBNAIL_URL_x> - url to thumbnail
<HITS_COUNT_x> - counter, the number of hits
<HITS_DATETIME_x> - datetime of the photo
<HITS_HEADLINE_x> - headline of the photo (also the title)
<HITS_BODY_x> - description of the photo
_x - that is the counter, or in another way it is the number in the list;
_10 is the 10th, _9 is the 9th, ... _1 is the 1th.
As an example I use tables, just to make it look a bit nicer;
<TABLE>
<TR>
<TD><HITS_COUNT_1></TD>
<TD><HITS_HUMBNAIL_URL_1></TD>
<TD><HITS_DATETIME_1><BR/><HITS_HEADLINE_1></TD>
<TR>
<TR>
<TD><HITS_COUNT_2></TD>
<TD><HITS_HUMBNAIL_URL_2></TD>
<TD><HITS_DATETIME_2><BR/><HITS_HEADLINE_2></TD>
<TR>
...
</TABLE>
That will give you a table with thumbnails and a bit more information.
I've created a seperate page, using the browse template as template, calling it hits_tempate.html - to access it you can use index.php?x=hits (nice thing about pixelpost).
That's it.
Regards/Casper
heras
11-30-2006, 06:47 AM
How cool! You made an addon for my addon (saving me some work, as was planning to build this)
As the Joomla guys and gals put it: Opensource matters!
RobbieMc
12-05-2006, 02:20 AM
Great addon combination. Thanks loads for both counter and top views.
Rob
RobbieMc
12-05-2006, 05:15 PM
After working with this combo of addons the last few days, I see one possible way in which it (the counter addon) might be improved: perhaps it should NOT count the image hits that get recorded without an id number? ie, when it is the current image.
I guess it depends on what you want to convey in tracking and showing these numbers. If you want to show what people are 'choosing' to view, then eliminating the first loads would be more 'accurate'. If you want to simply show how many eyeballs fell on a particular image, than including the current image view would do that.
But with the latter approach, it really says more about how many visitors you had on the day that image was the current image than it says about whether people who visited actually liked that image. And an image that is posted on, for example, a Sunday will be seen as more popular than others because more people visit on Sunday. And if you don't upload another image for few days, the hits for the 'current' image for those days could quickly exceed all others.
In my view, since the greatest value of a count is to show people what other people seem to find interesting either because they clicked on it in the gallery or in the bottom thumbnail row (if you have one), the current image hits shouldn't be counted unless they have an image id (which means they clicked on a link somewhere to get that image. As it stands these choices get flooded out by regular hits.
Just some thoughts on what is otherwise a great addon.
Rob
RobbieMc
12-06-2006, 03:05 AM
Just FYI, I changed line 29 of the counter addon to
if ( isset( $_GET['showimage'] ) ) {
instead of
if ( isset( $image_id ) ) {
which hopefully will then only count hits if the viewer actually selected the image from a link somewhere.
I know this isn't perfect because it will undercount the actual number of views, but as a measure of the comparative interest in a given image, I think thsi will reveal more useful data, as indicated in the above post.
I'll let you know if I am happy with the results of the new code over time.
Rob
heras
12-06-2006, 09:12 AM
Hmmzzzz.... Your contemplations seem to make sense...
It confinced me that one should be able to choose the strategies of counting and I have implemented such a thing.
It is avaible from the addons page, version: 0.3
Thank you for your meditations.
1000words
12-31-2006, 01:48 PM
Casper
Many thanks for your add-on. I found it to be very useful.
Regards
David
casperghst42
01-09-2007, 07:21 PM
David,
My pleasure.
Regards/Casper
Casper
Many thanks for your add-on. I found it to be very useful.
Regards
David
casperghst42
01-24-2007, 06:31 PM
Just updated top_views to 0.4.
0.4 - yet more extended charcter issues
added <HITS_DATETIME_FORMATTED_X>,
<HITS_DATE_X>, <HITS_TIME_X>
Thanks to Dr. Ozdi that some extended (UTF8) characters did not disply correctly.
Casper
persianpix
01-25-2007, 12:35 AM
i downloaded the .4 version and i get an error message on the addon page when i login as admin... "warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource.....on line 126".
i quickly copied and pasted the html code that was posted here but nothing is being generated.
any ideas?
thanks in advance :)
persianpix
02-08-2007, 05:04 AM
just a quick note before this thread goes down the pile that no thumbnails is being generated. any help would be appcreciative :) http://persianpix.com/index.php?x=hits
Dennis
02-08-2007, 10:05 AM
<TR>
<TD></TD>
<TD><HITS_HUMBNAIL_URL_1></TD>
<TD><BR/></TD>
<TR>
your tag's are not processed. Are you sure you use the correct tags? I find at least one wrong tag: <HITS_HUMBNAIL_URL_1>
persianpix
02-08-2007, 01:35 PM
i corrected the type-o. i just checked the tags again and i belive i'm using the right one's but nothins is still being generated!
Dkozikowski
02-08-2007, 04:01 PM
Out of curiosity, did you also install the counter addon? This addon you are trying to use now requires the counter addon to be installed.
persianpix
02-08-2007, 06:07 PM
humn, no. i saw there was a post on counter but didn't realize that it is required. can you please tell me where i can go to install it. thanks :)
Dkozikowski
02-08-2007, 06:34 PM
http://www.pixelpost.org/v1/index.php?x=downloads&details=179
persianpix
02-08-2007, 10:17 PM
humn... i have the counter installed in the addon's folder now but nothing is being generated yet. here is what my code looks like in the hits_template.html:
<div id="page">
<span class="title">Top Hits:</span><hr /><br />
<TABLE>
<TR>
<TD><HITS_COUNT_1></TD>
<TD><HITS_THUMBNAIL_URL_1></TD>
<TD><HITS_DATETIME_1><BR/><HITS_HEADLINE_1></TD>
<TR>
<TR>
<TD><HITS_COUNT_2></TD>
<TD><HITS_THUMBNAIL_URL_2></TD>
<TD><HITS_DATETIME_2><BR/><HITS_HEADLINE_2></TD>
<TR>
</TABLE>
<br /><br />
</div>
austriaka
02-08-2007, 10:28 PM
persianpix, does it have to be the public hits page or is it more for your own interest?
Have a look at image_stats addon: http://forum.pixelpost.org/showthread.php?t=5941
It gives you powerful image statistics in admin area and a small monthly and daily image counter for public
KArin
persianpix
02-08-2007, 10:55 PM
karin, thanks for the suggestion. i do have image_stats installed and it works great. as you've guessed i would like to have a similar feature for my visitors :)
vBulletin® v3.7.3, Copyright ©2000-2013, Jelsoft Enterprises Ltd.