Feed items

Drupal: Adding a tertiary menu to your theme

Unfortunately Drupal only allows you to add primary and secondary menu’s by default. However there are times you need deeper levels, for example a third (tertiary) level submenu.
After some searching and looking at the core code I came up with a pretty easy solution.
First add the following functions to your template.php file.

SoapSource added into the Cakephp datasources repository

Today my Soap datasource has been added into the Cakephp datasources repository by Graham Weldon.
Great to see my work got accepted.

Fixed (sticky) toolbars with jQuery

Here’s a little snippet of code that let’s you create sticky toolbars like they use in Magento for example :)

Include this in your js somewhere and then just call $(‘.toolbar’).fixed();

$.fn.fixed = function() {
return this.each(function() {
var header = $(this);
var offset = header.offset();
var floater = $('').append(header.clone(true));
floater.hide().appendTo(document.body).addClass('floating-toolbar');

$(window).scroll(function() {
var s = $(this).scrollTop();

if (s > offset.top) {
header.css('visibility', 'hidden');
floater.show();
} else {
floater.hide();
header.css('visibility', 'visible');
}
});
});
};

And here’s some css to make it work.

Work in progress

I finally decided to work on my new Wordpress template again. I’ll be working on it ‘live’ for the next couple of weeks, iterating trough a couple of ideas until I’m satisfied.
Please don’t hesitate to comment on the design :)

Let the graduation begin…

So finally after 3 months I finally started with my graduation after a real slow start.
My goal is to become an interaction design expert, I wanna lift myself to the next level. I’m doing this together with Geoffrie Hoiting. We’ve started a new blog where we will post our findings during our journey into interaction design.
You can follow us on http://inc.redible.com.

Book review: CakePHP Application Development

Just like many other CakePHP bloggers out there, I also received a copy of Cakephp Application Development written by Ahsanul Bari and Anupom Syam, published by PACKT publishing.
The first thing I noticed were the cake’s printed on the cover, they don’t look really tasty to me because of the odd colors. Thankfully the inside of the book looked much better.

The overall structure of the book is good and makes sense. The writing style is easy and pleasant to read, therefor all the grammar and punctuation mistakes didn’t bother me at all. The indentation of the code blocks isn’t always consistent, but it’s not really annoying.

GIT: ignoring changes in tracked files

There may be times when you want to edit some variables in for example a database connection file, to run an application right from within your GIT repo. Of course you don’t wont those changes to be commited, so you add the file the .gitignore.
However adding tracked files to .gitignore won’t work because GIT will still track the changes and commit the file if you use the -a parameter.
Fortunately GIT has a very easy solution for this, just run the following command on the file or path you want to ignore the changes of:

git update-index --assume-unchanged

If you wanna start tracking changes again run the following command:

SoapSource, a SOAP Client Datasource for CakePHP

Update: Fixed some stupid typo’s in the documentation.
I’ve published my SOAP Datasource on Github, you can find the sourcecode in the ‘soapsource‘ repository.
SoapSource allows you to connect with SOAP servers that support Wsdl. I also started implementing functionality for non Wsdl SOAP servers, but I don’t think I will continue on this.
SoapSource now supports non wsdl servers also, you can add ‘uri’ and ‘location’ parameters to your datasource configuration now.
In order to use the Datasource you will need to have PHP5 installed with the SOAP extension.

Here’s how you use it:

Copy the soap_source.php file to your app/models/datasources/ directory

Installing PHP5 soap extension on Leopard 10.5.5

While working a new project of mine, SoapSource: a soap datasource for Cakephp, I wanted to make use of PHP’s SOAP extension. As I figured out quickly the default install of PHP on Mac OS X Leopard isn’t compiled with the SOAP extension enabled. So I thought; that’s easy, just recompile PHP with the SOAP extension enabled.. However I encountered some serious problems.
It appears to be impossible to compile a 64bit version of PHP on Mac OS, there’s some sort of bug with ‘libiconv’.
So next idea, recompile Apache in 32bit, Mysql in 32bit and ofcourse PHP in 32bit… well again I didn’t succeed, so I reverted all my changes back to the original settings after a day of hard work and frustrations.

But then I found out you can compile dynamic extensions without recompiling your entire PHP installation. So I got SOAP running within 5 minutes using to following instructions:

Cakephp router and prefixes

Cakephp has been supporting admin routes for a long time. It’s also possible to use custom prefixes next to your admin routes for extra flexibility. However you will probably face some problems when you start using prefix routes. I’ll show you how to handle some of them.

First of all let’s create our prefix route

Router::connect('/manager/:controller/:action/*', array('prefix' => 'manager', 'manager' => true));

Links
Creating links to your prefixed actions is easy

echo $html->link('Edit user', array('controller' => 'users', 'action' => 'edit', 'manager' => true, 1));

This will create a link to : ‘/manager/users/edit/1′