CategoryClasses

A PHP Scaffold Class

If you’re a fan of Ruby on Rails’ scaffolding feature, you’ll be surprised that the same thing can be achieved in PHP. In their 15 minute weblog instuctional movie, this feature is used and shows how development time is greatly reduced by dynamic generation of a pseudo–CMS for managing your applications database tables.

Now here’s a PHP class that enables us to do the same, where we can list, add, edit, and delete table rows for all our database tables. Of course we can do it with PHPMyAdmin, but here’s another option for rapid prototyping in our web applications.

Now if only someone would extend this to accommodate foreign keys and other table–to–table restrictions. For now, here’s our little PHP Scaffolding class.

Fighting comment spam with Akismet

Every web 2.0 builder is most likely exposed to comment spam because of the social nature of this generation’s web applications. This requires considerable effort in building a system that is not easily gamed by spammers, to avoid it being rendered useless by nonsense content.

Aside from email, comment spam is the next most prevalent form of spamming. This is largely because of the nature how google ranks pages through its PageRank algorithm.

Automattic’s Akismet has been one good weapon against comment spam since its inception as WordPress’s spam blocking mechanism. Thanks to its useful API, you can now use Akismet to check your comments against their spam–fighting magic from any PHP4–based system, using this PHP class from Pablotron.org.

A few good libraries

AJAX libraries.

I’ve been looking at several AJAX libraries these past few days for use with iPAP and several other planned projects. Going through AJAX Matters’s list leads us to many projects and options, and finding the right one for a specific need can be a cumbersome task. I’m providing some insights for the ones I find good enough.

  1. XAJAX is PHP–based and generates the Javascript programatically. You need to designate the action executed like replacing or appending content, but there is minimal need for tinkering with Javascript at all. Unfortunately, modifying or altering the generated client–side code is not as straightforward as other libraries. Another plus is that the PHP functions and custom functions you need can be in the same page you’re displaying to the user, so all you need to do is include() the xajax class file. XAJAX is good for PHP developers seeking to add some AJAX functionality to their applications, but those with a healthier Javascript/DOM acumen would find the next two libraries friendlier.
  2. advAJAX recently made the digg frontpage and proves to be simple yet easy to customise. If you’re comfortable coding Javascript, you can mix and match advAJAX with other presentational libraries and you’d have your very own toolset for your application.
  3. SACK is last on this list, but definitely not on functionality. In fact, it is good enough that an earlier version is used in WordPress 2.0 for all its AJAXy goodness. Just like advAJAX, you can customize your Javascript to perfection. The difference is in the syntax for setting parameters and calling functions, and boils down to personal preference.

To summarize my observations, XAJAX is best for those familiar with PHP who’d rather not deal with too much Javascript. advAJAX and SACK are better options for Javascript hackers who need the customization possibilities.

AJAX Classes

AJAX is one of the primary ingredients for almost all Web 2.0 applications. This allows better interaction and feedback between the application and the user, allowing for an enhanced usability and user experience.

These AJAX PHP classes over at PHP Classes will surely help in providing the functionality for your web applications.

© 2016 builder2

Theme by Anders NorenUp ↑

Follow

Get every new post delivered to your Inbox

Join other followers: