Skip to main content
Dev Update

Syntax Highlighting

It's probably been too long since I wrote any PHP, but alas.

I've just installed a new syntax highlighting plugin for WordPress, and this post is sort of a test of the new system. I'm going to post a small snippet of some old PHP code that I had written a few years back. Thinking of it, I haven't written PHP in years, I'm losing my touch.

// Establishes basedirectory for where all the desktops are
$basedir = "/absolute/path/goes/here/";

// Establishes Where Counter Will Be For Each File
$counter_file = $basedir . $file . "/counter.txt";

// Puts the file lines into $counter_file_line array
$counter_file_line = file($counter_file);

// adds one to the number in the  array or the very first line
$counter_file_line++;

// opends the file and then writes the new number and then closes it
$cf = fopen($counter_file, "w");
fputs($cf, "$counter_file_line"); 
fclose($cf);

// Sets Location Of Files
$url = "http://yoururl.com/folder/" . $file . "/" .  $file . ".zip";

// Shows Download Count / Download Link
echo "  This file has been downloaded **";
echo $counter_file_line;
echo "** times.

Click to download ";
echo $file;
echo ".zip

Some sort of programming, eh? Eww, and look at that terrible markup.

#PHP#WordPress#plugin

// join the conversation

Have thoughts on this post?

The Lab doesn't have comments, but the discussion is always open on Discord.