PHP Frameworks

This week I experimented with some frameworks to see which would provide me the fastest development track for some hobby projects of mine. When reading this post, bare in mind that I come from a Drupal background (so I’m quite spoiled!)… 😉

Requirements
I had a few requirements that such a framework should have:frameworks

  • User Authentication : This is something almost every application needs in some form. If it was up to me, then this basic functionality should be included within easy framework. This was actually the first reason why I switched to Drupal, I was sick and tired to maintain the user management coding whilest this is a common thing.
  • Good Documentation : I don’t mind learning new things, but they should be very clearly documented. I actually learned php right off the php.net site; hands-on with the user contributed code samples.
  • Easy Setup on a shared hosting : Some frameworks are so high up in the sky that it takes you about an hour just to grasp the concept of how the creators wanted it to be. In my mind, it should just be “extract & go”… This doesn’t mean that it has to be a single directory structure. It’s merely meant towards the frameworks which have a “console-like” application to manage the framework. Not everyone has shell access to their development machine…
  • Active User Community : A big part of the “Fast development track”-motivation lies in code submissions of the community behind the framework. You can borrow the code or you can learn from it… Either way, you’re coding at a much faster pace.
  • Easy Form Support : Forms are a BIG part of every application. We can add some bling to it with “ajax” (hypeword detected!), but it remains a form in it’s bare essence.

My Basic Experience
Now for the ones that I’ve tested… Also I would like to add a word of respect to all the creators of the frameworks. This post is not to bash any frameworks, but just a form to express my experience with testing them all out.

Continue reading “PHP Frameworks”

LogiTouch

About a month ago I started my own webdesign agency. So after almost 2 years of kvaes.be I’ve took the step towards entrepreneurship!

We focus on the “local” market, providing quality websites at an affordable price. It’s not “yet another high priced” bureau… The OpenSource world provides the means which enables us to provide a very interesting price.

Your favorite Webapps as easy to installable stacks

Bitnami

Today I stumbled upon an article mentioning the existence of BitNami. It was an unknown product to me, but I think it has some potential. Imagine the power of Lampp combined with your favorite cms/wiki/…

The key features where they prize themselves with:

  • Easy to install
    In just a few clicks, you can have your favorite open source applications up and running.
  • Multiplatform
    Bitnami Stacks are available for Linux, Windows, and Mac OS X.
  • Integrated
    By the time you click ‘finish’, the software will be integrated, configured and ready to go.
  • Independent
    Bitnami Stacks won’t interfere with any software already installed on your system.
  • Run Natively
    The stacks install directly on your system – no virtual machine required.
  • Open Source
    All Bitnami Stacks are free to download and use under the terms of the Apache License 2.0

For a full list, check out the their stacks page.

JQuery & Drupal : setting content thru a GET request

Below you can find an example of some JQuery code that you can use to do the same as described in a previous article. I’ve stopped using the previous code, as it had too many downsides. After getting to know the power of JQuery, I have to say that it’s much better. AND it’s already included in the drupal distribution.

Example

$(document).ready(
  function(){
    $("select").change(function () {
      var about = this.value;
      var uri = '/my/page/' + about;
      $.get(uri, function(data) {
        $("#div-with-updated-data").html(data);
      });
    })
 }
);

NOTE: Don’t try to use mooscript, scriptalicious, … or any other framework that doesn’t extent JQuery within your drupal. It will give you a lot of “function unkown” situations. 😉

Drupal : Three simple steps to adding ajax to your drupal forms/pages

If you need a simple content refresh system, let me show you an example of a simple (yet powerful) implementation.

Step 1
Download a the lightweight ajax library from ImpliedByDesign, and copy it to a directory called “ajax” in your module directory.

Step 2
Add the following two functions to your drupal module

function printAjaxJs() {
   drupal_add_js(drupal_get_path('module', 'myModule').'/ajax/ajax.js');
}
function printAjaxFunction($function,$page) {
  $output.='function '.$function.'(div_id,content_id) {';
  $output.='subject_id = div_id;';
  $output.='content = document.getElementById(content_id).value;';
  $output.='http.open("GET", "'.$page.'" + content, true);';
  $output.='http.onreadystatechange = handleHttpResponse;';
  $output.='http.send(null);';  $output.='}';
  drupal_add_js($output,'inline');
}   

Step 3
Ajaxfy your forms/pages

  printAjaxJs();
  $function="showContent";
  printAjaxFunction($function,"/show/content/");
  $script=$function."('updated-field','edit-myselect')";
  $form['myForm']['mySelect'] = array(
  '#type' => 'select',
  '#title' => t('Formation Select'),
  '#default_value' => $fdefault,
  '#options' => $foptions,
  '#prefix' => '
', '#suffix' => '
The output of /show/content/*value* will be updated here.
', );

Resetting permissions for drupal

For some odd reason, after testing out some modules I was given an access denied on all content for non-admin users. If you would get such a thing, and are at the end of the road with your options, try the following commands:

INSERT INTO users (uid, name, mail) VALUES (‘0’, ”, ”);
INSERT INTO users_roles (uid, rid) VALUES (0, 1);
INSERT INTO node_access VALUES (0, 0, ‘all’, 1, 0, 0);

It will either return ‘duplicate entry’ warning (ignore this) or -maybe- fix your problem…