Hello all,
After my problem I had with editing/deleting an record I am looking for some kind of way to show the number of times someone clicked an image (or link).
I have a photodatabase (at this moment with just one photo). I have installed the plugin for resizing my photos when I upload them. When you click on the photo you will get the large photo in a new screen. I was wondering, is there some kind of way (a counter??) to show the number of times that the photo has been clicked/viewed?
Example:
Views: xxxxx
I hope someone can help me🙂
Kind regards,
Ruud
After my problem I had with editing/deleting an record I am looking for some kind of way to show the number of times someone clicked an image (or link).
I have a photodatabase (at this moment with just one photo). I have installed the plugin for resizing my photos when I upload them. When you click on the photo you will get the large photo in a new screen. I was wondering, is there some kind of way (a counter??) to show the number of times that the photo has been clicked/viewed?
Example:
Views: xxxxx
I hope someone can help me🙂
Kind regards,
Ruud
Hi flyboeing,
I built a link counter for a client recently that you could probably adapt.
The calling link is like this
and then in the 'job-link' form Extra Code 1 box is this code
Bob
I built a link counter for a client recently that you could probably adapt.
The calling link is like this
<a href='".JURI::base()."index.php?option=com_chronocontact&chronoformname=job_link&task=extra&jid=".$j->job_ref."' target='_blank' >More Information/Enquire*</a>
and then in the 'job-link' form Extra Code 1 box is this code
<?php
/* ensure that this file is called by another file */
defined('_JEXEC') or die('Restricted access');
$jid = JRequest::getString('jid', '', 'get');
if ( !$jid ) {
$mainframe->redirect('index.php');
die();
}
$db =& JFactory::getDBO();
$query = "
SELECT `job_link`
FROM `#__chronoforms_job_list`
WHERE `job_ref` = '$jid' ;
";
$db->setQuery($query);
$j = $db->loadObject();
$user = JFactory::getUser();
$query = "
INSERT
INTO `#__chronoforms_job_links`
SET `user_id` = '".$user->id."',
`job_ref` = ".$db->quote($jid).",
`recordtime` = '".date("Y-m-d H:i:s")."'
";
$db->setQuery($query);
$db->query();
$mainframe->redirect($j->job_link);
?>
This form (a) does a little validation on the calling URL; looks up the link info in the database; saves the click record in another table (you could update a hit counter table instead of recording the click details); and redirects the user to the link.Bob
Hi Bob,
Thank you for your answer. I will try this later today.
To store and update the views, do I have to make an other table? I saw your script, and I think I have to change some values to the values I have in my table/database :wink:
Thank you for your answer. I will try this later today.
To store and update the views, do I have to make an other table? I saw your script, and I think I have to change some values to the values I have in my table/database :wink:
Hi flyboeing,
You could also add a column to the table where the image links are stored, either method will work depending on what your application needs.
Yes - this is from quite a different application. Use it as a suggestion for your own script.
Bob
To store and update the views, do I have to make an other table?
You could also add a column to the table where the image links are stored, either method will work depending on what your application needs.
I have to change some values to the values I have in my table/database
Yes - this is from quite a different application. Use it as a suggestion for your own script.
Bob
This topic is locked and no more replies can be posted.