Adrian Callaghan`s Blog

Archive for December, 2008

clikStats

by Adrian on Dec.29, 2008, under Programming, wordpress

clikStats is a wordpress plugin that automatically detects the current links within each post.

ClikStats is retrofitable, and requires no special provision from any classes or code.

Once activated, clikStats will compile who, when, what data which can be viewed through the back office.

The beauty of this plugin is in its portability, it can be used straight out of the box, and provide usefull visitor information, without the need to reverse engineer your posts.

Download the latest version (v0.7) of clikStats from here

Simply add the unzipped folder to your pluggins folder, and make it active to start logging clicks.

Have fun

RELEASE NOTES
v0.3 04.01.09 Provision for pagenation, deletion and better url parsing
v0.4 05.01.09 Required update, due to a naming convention issue
v0.5 18.01.09 Fixed security issues, enhanced UI, extra pages
Big thankyou to Alexandre Araújo for his testing
v0.6 15.02.09 Added search and some nice aesthetics
v0.7 09.05.09 Added clik page/post sourcename, improved date filter system

Some of the best reviews

VanSantos
Daily Seo Blog
Haunting thunder
Tech Ravings
THUK Media

34 Comments more...

Chasing chords

by Adrian on Dec.21, 2008, under Music

Chasing chords is a song I wrote a long time ago

The idea of the song, is that the main chord is trying to escape the minor and major inflections of the lead, while still maintaining its rhythm

Its nice and simple, and I recently popped it on You-Tube incase anybody else would like to play it.

2 Comments more...

Pagenation with php example

by Adrian on Dec.19, 2008, under Programming

Pagenate an array into a table using PHP.

This is a basic example and has been depreciated, a far more advanced and upto date example can be found here.

(Thanks to Andrew (Morf) for his help on this)

To see it in action click here

There are user configurable values at the top, such as query name, and number of results per page etc, the important thing to remember though, is the page link must be correct

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<style>
.nav_arrow {color:#222222; text-decoration:none;}
.nav_number{color:#777777; text-decoration:none;}
.nav_number_current{color:#222222; text-decoration:underline;}
</style>
 
<div style="width:80%; margin:0 auto;">
 
	<?php  
	// do your database query here and store it within array	
 
	// test content (just fills array with test content)
	$contentLimit=50;
	for ($x=0; $x<$contentLimit; $x++){
		$array[$x]['Thing_1'] = $x.'a';
		$array[$x]['Thing_2'] = $x.'b';
		$array[$x]['Thing_3'] = $x.'c';
		$array[$x]['Thing_3'] = $x.'d';
		$array[$x]['Thing_3'] = $x.'e';
		}
	?>
 
 
	<?php // output
 
	// pagination loop begins
	$result = $array;
	$limit = intval(20);
	$pagelink = 'pagenation.php';
	$queryString = 'stat';
 
	// pagenation begins, KUDOS to andrew for his considerable help here
	$listing = intval($_GET[$queryString]);
	$start = $listing * $limit;
 
	$all = count($result);
	$all_pages = ceil($all / $limit);
 
	// this forwards any criteria associated with the search by adding it onto the end of the hyperlink
	$args=""; foreach ($_GET as $key=>$val){
		$args.= $key!=$queryString ? "&".$key."=".$val : "" ;
		}
 
	if($all>0){
		if(($listing+1) > $all_pages){$listing=0;}
		$of = 0;
 
		////////////////////////////////////////// navigation starts
 
		if(($listing+1) > 1 && ($listing+1) <= $all_pages){
			// up
			echo '<a href="'.$pagelink.'?'.$queryString.'='.($listing-1).$args.'" class="nav_arrow" title="previous" alt="previous">&#171;</a>';
			}
 
		if ($all_pages>1){
			// goto page
			for($i=0;$i<$all_pages;$i++){
 
				// echo`s the number also checks to see if this is the current page
				echo $listing==$i ? '<a href="'.$pagelink.'?'.$queryString.'='.$i.$args.'" class="nav_number_current" title="current" alt="current">'.($i+1).'</a>' : '<a href="'.$pagelink.'?'.$queryString.'='.$i.$args.'" class="nav_number" title="page '.($i+1).'" alt="page '.($i+1).'">'.($i+1).'</a>';
				if($i < ($all_pages-1)) echo ' | ';
				}
			}
 
		if(($listing+1) < $all_pages){
			// down
			echo ' <a href="'.$pagelink.'?'.$queryString.'='.($listing+1).$args.'" class="nav_arrow" title="next" alt="next">&#187;</a>';
			}
 
		///////////////////////////////////////// navigation ends
	?>
	<br />
	<table border="1" cellpadding="2" cellspacing="1"  width="100%">
		<tr>
			<th class='tableHeader'>Thing 1</th>
			<th class='tableHeader'>Thing 2</th>
			<th class='tableHeader'>Thing 3</th>
		</tr>
		<?php
		// pagenation resumes
 
		for($i=$start;$i<($start+$limit);$i++){	
	                          if (empty($result[$i])) break; // break if complete
			// format results
			?>
			<tr>
				<td class='tableContents'><?php echo $result[$i]['Thing_1']; ?></td>
				<td class='tableContents'><?php echo $result[$i]['Thing_2']; ?></td>
				<td class='tableContents'><?php echo $result[$i]['Thing_3']; ?></td>
			</tr>
		<?php }	?>
	</table>
	<?php
	}
	else{
		// zero results found
		echo '<h1>No results found</h1>';
		}
	?>	
</div>

 

You can download the complete zipped file here

I have now developed a fully automated function here which is far superior.

2 Comments more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!