dev-master
9999999-devHrefCount is a PHP library that register in database how many times a link is clicked by user
MIT
The Requires
Wallogit.com
2017 © Pedro Peláez
HrefCount is a PHP library that register in database how many times a link is clicked by user
HrefCount is a PHP library that register and store in database, how many times a link is clicked by user., (*1)
Install the latest version with, (*2)
$ composer require emoretti/href-count ^dev-master
Change the attribute in hrefCountConfig class as you needed., (*3)
Change with your site base url, (*4)
private $BASE_URL = "http://<yoursite>/";
You can change the key for the query string variable, (*5)
private $QUERY_STRING_VAR_NAME = "qs";
Set your database connection data
php private $DATABASE_HOST = "localhost";
private $DATABASE_NAME = "test";
private $DATABASE_USR = "root";
private $DATABASE_PWD = "";
private $TABLE_NAME = "href_count";, (*6)
Create an instance of hrefCount() class in the page you will use the HTML a tag.
In the href attribute, insert the call to the href() method, passing the "link" and "alias" values., (*7)
<html>
<head>
<title>Click Counter Example</title>
</head>
<body>
<h1>Click Counter PHP - Example use</h1>
<h2>Click a link to increase the relative counter.</h2>
<h3>Same Page link</h3>
<a href="<?php $HC->href('index.php','Homepage') ?>">Homepage</a><br/>
<h3>Same Page link with get parameter</h3>
<a href="<?php $HC->href('index.php?test=hello','Homepage_Hello') ?>">Homepage with query string</a>
<h3>Same page with #anchor link</h3>
<a href="<?php $HC->href('#ancorar','Homepage_anchor') ?>">Homepage with Anchor</a><br/>
<h3>Another page link</h3>
<a href="<?php $HC->href('link1.php','Another page') ?>">Link1</a><br/>
</body>
</html>
In any linked page you want count the click add, (*8)
Ettore Moretti - info@ettoremoretti.com - https://twitter.com/emoretticom - https://www.facebook.com/emoretticom/, (*9)
href-count is licensed under the MIT License - see the LICENSE file for details, (*10)
HrefCount is a PHP library that register in database how many times a link is clicked by user
MIT