Understanding the theme() function on Drupal

May 25th, 2009

One of the most complicated things to understand when templating or developing modules for drupal is the theme() function. But when you know how to deal with it is really useful even when there’s no way to know how many we have available.

The way to use it fairly simple, let’s see how the Garland theme builds the primary links:

print theme('links', $primary_links, 
array('class' => 'links primary-links'));

The first argument is the actual hook we are calling, the second and third are the the arguments we are passing to that functions.

So basically the theme function will output plain HTML and it’s actually way cleaner than defining a function or coding a lot of php on our template.
Read the rest of this entry »

Drupal and GIT

May 10th, 2009

During this year I’ve been moving my projects to GIT. While my private projects are on this server, my public ones are on GitHub as Open Source. Git is a really wonderful version control tool for any kind of project. It makes it easy for me to deploy, maintain and update my current sites. I just wish there could be a way to include the database on it.

In this post I will explain how I’m using GIT to manage a Drupal site on both local and live environment. And since most people already have a site working, I will explain starting from an existing site.

Create the repository

The very first thing is going to the actual site, in my server this site is in: /var/www/sitename.com/public

cd /var/www/sitename.com/public
git init
echo "sites/default/settings.php" >> .gitignore

You can also run this if you want to ignore the files folder (that’s really up to you)

echo "sites/default/files" >> .gitignore

Then you have to add all files to the repository and make the first commit

git add .
git commit -m "Initial commit for this site"

Read the rest of this entry »

Android menu icons

April 10th, 2009

androidiconsIf you are developing applications for Android and you want to make the menu look kinda like the native applications, you can use these icons or, even better, use the layer style and use your own shapes.

These icons were used for Twit2go and you are free to use them in your application. Instructions are inside the PSD file.

Download: android-icons

Twit2go: A few days after the first release

April 3rd, 2009

It’s been a few days since I released the very first version of Twit2go (and my first non-web application) and I’m very happy to see that people is actually enjoying my app. The feedback provided by users is what really drives to continue building any kind of free software and so far I’m getting some really good ideas and users are actually reporting issues.

On the Android Market I’m getting a rating of 3.56/5 which is very good considering all people with broken phones blaming developers, hehe (And the fact that it’s my first app). It’s not that what they say is not valid but I can’t give any kind of support to comments like “Your app crashed everything on my phone, uninstalled” - 1 Star And that’s something the Android Market suffers a lot.
Read the rest of this entry »

Android Twitter Client: Twit2go

February 15th, 2009

twit2gologoSince a while I’ve been talking about this OS and how I liked the way it can do multitasking. And now the more I use it the more I like it, so I decided to start building an application for it and give the OS a complete try. I bought the first Android device, the G1 from HTC and even when it’s not the best phone out there, it comes with Android OS so that’s enough for me.

I started building this Twitter application knowing nothing of Java, which maybe was a bad idea but I managed to get this running in less than a week. As a web developer it’s kind of hard to start understanding how phone or desktop applications behave but I’m getting used to it now.
Read the rest of this entry »