Apostolos Dountsis

Web Development & Desktop Application Solutions
  • rss
  • Home
  • Projects
    • Easy Peasy Image Gallery
    • Social Bookmarks Plugin for WordPress
    • Move Comments
  • Downloads
  • Freelance Services
  • Photo Gallery
    • U2 - Vertigo Tour (Rome, Italy)
    • Brighton
    • Amsterdam
    • Athens 2004
  • Links
  • About
    • Portfolio
  • Contact

Easy Peasy Image Gallery (EPIG) 2

The new version EPIG is now available to download. This version has been released as EPIG 2 and not as EPIG 1.2. The reason for the jump in the version numbering is that I have re-written more than 90% of the original code and the code structure now follows the MVC methodology.

Instead of one epig class, the new version comprises of seven classes (model, view, controller, three additional views and a general-purpose library class) that should improve the code readability. From the user’s perspective, no additional overhead has been added. All the gallery personalisation can be done through the config.xml file.

The MVC architecture, should make it easier for fellow PHP developers to extend the View class and derive their own presentation styles instead of hacking through my code. I am including three different presentation styles in EPIG 2 that extend the View class (template.php).

One last thing… the home page of EPIG has now moved from Gamecycle to the Dountsis domain. The main reason for the change is that I felt that Gamecycle was not a natural home for PHP projects. The new home page has been updated to reflect the features of EPIG 2.

Easy Peasy Image Gallery

 

Comments
5 Comments »
Categories
EPIG, PHP
Trackback Trackback

More PHP functions

I have updated the list of general purpose functions with additional functions. I hope that you find them useful.

 

Comments
No Comments »
Categories
PHP
Comments rss Comments rss
Trackback Trackback

Eclipse for PHP

The pursue of a PHP editor is not a easy one. Over the years, I have tried a variety of editors. Some of them were generic text editors, like Notepad, VI, Pico, Textpad, KEDit, XCode and some dedicated PHP editors like Zend and PHPEdit. I needed a PHP editor that I could use on my Mac mini and my PC computer at work. I couldn’t find one that was meeting all my needs. Zend editor is a good choice but it is expensive and slow. Hence, PHPEclipse.

PHPEclipse

Eclipse is an Open Source IDE Java editor, but it can be configured for other languages. PHPEclipse is an add-on that facilitates the development of PHP code. Among its features, I have to point out the autocomplete functionality (Ctrl+Space), and the QuickFix suggestions on syntax errors (when you save the file).

In order to install PHPEclipse, you need to download Eclipse, extract it somewhere on your computer, but DO NOT run it yet.

Download the PHPEclipse (Note: The latest version will be the one at the top of the list displayed on the download page). The PHPEclipse zip file must be extracted in the same directory in which you installed Eclipse. It contains two directories, plugins and features, and these must match to the plugins and features directory in your existing eclipse directory. After extracting PHPEclipse, start Eclipse. PHPEclipse will be loaded automatically.

Subversion

Subclipse is an Eclipse plugin that adds Subversion integration to the Eclipse IDE. You can install Subclipse by adding http://subclipse.tigris.org/update_1.0.x as an update site in Eclipse’s update manager (which you can find in the Help menu).

ESftp

This is an Eclipse Plugin that allows upload and download from SFTP servers, the plugin is customisable on different levels, either at a workbench, project level, has the ability to recurse subdirectories of files and setup an ignore list of files. You can download & install the plugin from its SourceForge repository.

Comments
2 Comments »
Categories
PHP, Programming
Comments rss Comments rss
Trackback Trackback

PHP General Purpose Functions

PHP is a simple and yet very powerful high-level computer language that it is designed for creating dynamic pages and applications on the web. It is very well documented on the official web site and as it becomes obvious from browsing the Functions Reference on the online manual, PHP has a great API.

However, everytime I begin a new project either for a client or for personal experimentation, I end up in need of a set of general-purpose fuctions that are not included in PHP. I tend to put these functions in a file named common.php that I usually include in the base class of my project.

pre_print_r()

This function displays information about a variable in a way that’s readable by humans. If given a string, integer or float, the value itself will be printed. If given an array, values will be presented in a format that shows keys and elements. Similar notation is used for objects.


function pre_print_r($a)
{
print('< pre >‘);
print_r($a);
print(’< /pre >‘);
}

println()

Performs a standard print() on the browser but the generated HTML source code is nicely formatted.


function println($str)
{
print($str."\n");
}

is_even()

Checks if the parameter is an even number. This is useful when you want to present data in a tabular format and you want to display every alternative row with a different background color.

function is_even($number)
{
if ($number % 2 == 0 )
{
// The number is even
return true;
}
else
{
// The number is odd
return false;
}
}

redirect()

This is a wrapper around header(). If no parameter is specified then it performs on redirect on the current page. This function is extremely useful when an insert query is executed as a result of a form submission. If the user decides to refresh the page then the query won’t be performed twice.


function redirect($location='')
{
if(empty($location))
{
header("location: {$_SERVER['PHP_SELF']}”);
}
else
{
header(”location: $location”);
}
exit();
}

send_mail()

This is a wrapper function around mail(). It generates the email headers based on the function parameters.


function send_mail($from_name, $from_email, $to_name, $to_email, $subject, $message)
{
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 1\n";
$headers .= "X-MSMail-Priority: High\n";
$headers .= "X-Mailer: php\n";
$headers .= "From: "".$from_name."" <".$from_email.">\n”;

if(mail(”"”.$to_name.”" <".$to_email.">“, trim($subject), trim($message), $headers))
{
return true;
}
else
{
return false;
}
}

is_extant()

Checks whether the variable is empty, but allow for it to be zero.

function is_extant($var)
{
if (isset($var))
{
if( empty($var) && ($var !== 0) && ($var !== '0') )
return false;
else
return true;
}
else
return false;
}

gd_loaded()

GD is an extremely popular graphic library that is usually compiled into the PHP but it is not available out of the box. This function checks whether the GD has is available in the PHP installation or not.


function gd_loaded()
{
if (!extension_loaded('gd'))
{
if (!dl('gd.so'))
{
return false;
}
}
return true;
}

Comments
4 Comments »
Categories
PHP
Comments rss Comments rss
Trackback Trackback


Categories

  • Adventure Games (1)
  • EPIG (3)
  • Firefox (6)
  • Funny (2)
  • General (11)
  • Microsoft (3)
  • PHP (9)
  • Programming (6)
  • Windows (4)
  • WordPress (16)

RSS Feeds

Subscribe to the Articles RSS feed Subscribe to the Comments RSS feed

Keywords

adblock adventure adventure game Bad Sectors BBC chkdsk Del.icio.us extension Firefox Flash Game Hard Disk Microsoft PEAR PHP Windows Windows XP WordPress

Recent Posts

  • Del.icio.us Firefox 3 Extension
  • Site Revamp & WordPress 2.5
  • Social Bookmarks 4 Point Release
  • Firefox 3 Beta 4
  • The Hitchhiker’s Guide to the Galaxy 20th Anniversary Edition From The BBC
  • Setup a Development Environment for Your WordPress Site

Spam Blocked

60,376 spam comments
blocked by
Akismet
rss Comments rss valid xhtml 1.1 design by jide powered by Wordpress get firefox

© 2006 - 2008 Apostolos Dountsis - All Rights Reserved