You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This counter is intended for use in GitHub README markdown files. It has the following features:
@@ -13,7 +19,7 @@ This counter is intended for use in GitHub README markdown files. It has the fol
13
19
14
20
You will need:
15
21
16
-
* A HTTP server, not HTTPS. It has not been tested with HTTPS. **If you get it to work with HTTPS please let me know and I will update this file.**
22
+
* A web server, HTTP or HTTPS should be ok.
17
23
* The server needs PHP >5.6.
18
24
* You will need access to your server to copy files and create a folder.
19
25
@@ -160,10 +166,40 @@ It is possible to retrieve the counter data for a single counter or for all of t
160
166
**Return data for a specific counter -**
161
167
162
168
```
163
-
GET http[s]://your-server/path-to-file/mdcountdata.php?id=testtest
169
+
GET http[s]://your-server/path-to-file/mdcountdata.php?id=sensornet
170
+
```
171
+
172
+
The data is returned in JSON -
173
+
174
+
```
175
+
[
176
+
{
177
+
"id": "sensornet",
178
+
"data": {
179
+
"count": 30,
180
+
"time": 1616458038,
181
+
"dtime": [
182
+
"20210322",
183
+
"190718"
184
+
]
185
+
}
186
+
}
187
+
]
164
188
```
165
189
166
190
191
+
**Return just the count data for a specific counter -**
192
+
193
+
```
194
+
GET http[s]://your-server/path-to-file/mdcountdata.php?id=sensornet&count
195
+
```
196
+
197
+
A single value is returned, no JSON formatting -
198
+
199
+
```
200
+
30
201
+
```
202
+
167
203
**Return data for all counters -**
168
204
169
205
```
@@ -254,15 +290,18 @@ GET http[s]://your-server/path-to-file/mdcountdata.php?id=BLAH
254
290
255
291
The following files are used in report generation and viewing:
256
292
257
-
*`mdreport.php` - Retrieves the counter data and renders a Bootstrap 4.x table.
258
-
*`mdreport.css` - Additional required CSS for the table
293
+
*`mdreport.php` - Retrieves the counter data and renders a Bootstrap 4.x table
294
+
*`mdhcreport.css` - Additional required CSS for the table
295
+
*`embedreport.css` - CSS required for an embedded report
296
+
*`reporthead.html` - For non-embedded reports, this contains the page title and table heading
297
+
*`reportcaption.html` - For non-embedded reports, this contains the table caption
259
298
*`mdreport-th.txt` - Column heading text
260
-
*`stddefines.php` - A collection of `define()` that make a number of PHP `$_SERVER[]` values available to the application. It contains components used for creating URLs to resources.
261
-
*`report.html` - The minimum required HTML/CSS and JavaScript/jQuery to render and display the table.
299
+
*`stddefines.php` - A collection of `define()` that make a number of PHP `$_SERVER[]` values available to the application. It contains components used for creating URLs to resources
300
+
*`report.html` - The minimum required HTML/CSS and JavaScript/jQuery to render and display the table
262
301
263
302
**Retrieving the Report -**
264
303
265
-
The code that retreives the report and handles clicks on the column headings is contained in `report.html`.
304
+
The code that retreives the report and handles clicks on the column headings is contained in `report.html`. The necessary CSS can be found in `mdhcreport.css`.
The "Hit Count", "Repository" and "Last Counted" headings can be clicked to select sorting criteria and direction (*ascending vs descending*). When a column heading is clicked the report caption will change to reflect the choice.
346
385
@@ -350,7 +389,23 @@ The "Hit Count", "Repository" and "Last Counted" headings can be clicked to sele
350
389
* The links in the "Repository" column are built from the IDs found in `counters.json`. The ID text I used there is the *name of the repository* that the counter is intended for. The corresponding counter data files are named `repo-name`**`_counter.json`**.
351
390
* When the report is viewed the data shown is *current*.
352
391
* If the "Last Counted" column date and time seem to be incorrect then the time zone may need to be changed. Edit the `timezone.json` file to match your time zone.
353
-
392
+
393
+
## "Embedded" Report
394
+
395
+
It is possible to retreive counter data without using `report.html`. The purpose is to *embed* the table in another page and to be able to apply some alternative CSS.
396
+
397
+
To retrieve it -
398
+
399
+
```
400
+
GET http[s]://your-server/path-to-file/mdreport.php?tsort=d&limit=5&embed
401
+
```
402
+
403
+
The response is going to contain some CSS for the table, and *just* the table itself. You can use a browser and go to `http[s]://your-server/path-to-file/mdreport.php?tsort=d&limit=5&embed`. You will see something like this-
**NOTE:** The table is not sortable like the one rendered with `report.html`.
408
+
354
409
## Other Uses
355
410
356
411
You could count just about anything. All you need is to do a GET of `mdcount.php` with a proper query and you got a counter!
@@ -359,7 +414,7 @@ You could count just about anything. All you need is to do a GET of `mdcount.php
359
414
360
415
This started out as an interesting afternoon project. I created it because I could not find *exactly* what I needed in the many hit counters out there.
361
416
362
-
And this project has evolved since then with the addition (and changes) of JSON formatted counter files, and sorted counter data retrieval.
417
+
And this project has evolved since then with the addition (and changes) of JSON formatted counter files, and sorted counter data retrieval. And the latest change was adding a 5th column to contain some GitHub statistics.
0 commit comments