Drupal Base Themes

1 Comment

Using a base theme when it comes to creating a theme for your Drupal site can be a polarizing issue. On the one hand, some people swear by using Garland as a starting point, customizing it until it looks nothing like the original theme at all. However, I personally prefer the other approach – start with a stripped back base theme and build from there.

There are numerous benefits for using a base theme to build your new Drupal theme. Depending on which base theme you go with, some of the benefits include:

  • -Sensible CSS resets, so your HTML elements are consistent across browsers and platforms
  • -Included templates, meaning you get a great set of templates for your page, node, blocks etc to work with and build off.
  • -Most base themes will include additional classes, making your CSS more concise and easier to write.
  • -Additional functionality, such as block configuration links and module integration.
  • -Out of the box compliant XHTML and CSS.

While there are numerous benefits to using a base theme, there are many people who will offer counter-arguments. These may include:

Time display and manipulation in Linux

0 Comments

We use timestamps a lot in web development, whether using Drupal or not. Sometimes during debugging we may want to know what is the actual human readable time for a timestamp (eg. 1279566878). This is easy to achieve in Linux, without writing any PHP code.
date -d@1279566878
Simply use the command in shell and you will see something like Mon Jul 19 12:14:38 PDT 2010, which gives the human readable time for the Unix timestamp 1279566878.

Another thing we'd like to do sometimes is to change the server time and timezone. In Ubuntu, you can type the command
dpkg-reconfigure tzdata
or
tzselect
and then select the timezone you want. Or you can do so by modifying the timezone file /etc/localtime
ln -sf /usr/share/zoneinfo/America/Toronto /etc/localtime
This would set the timezone to America/Toronto.

To change the current server time, you may use the command
date 052018302010.15
which would set the time to May 20, 2010, 18:30:15. The format of the time string is nnddhhmmyyyy.ss where
nn: 2-digit month (01 - 12)

Rounded Corners With jQuery

1 Comment

Rounded corners have become very popular and could be very easy to implement using CSS3. However as we know, some widely used browsers won’t give support to CSS3, making our life more complicated and our code more ugly.

Luckily, there are ways to get around for browser limitations! There are numerous CSS-only techniques that vary in complexity and flexibility. In addition to the numerous javascript techniques that are usually easier to implement. This is my favorite one:

The “jQuery Corner Plugin” (jquery.malsup.com/corner/) will add divs to the element with a solid color background to hide the original corners and create the illusion of rounded corners. What I really like about the “jQuery Corner Plugin” is that it detects if your browser gives support to CSS3 and will use the appropriate CSS if possible.

Here’s how to implement it:

Pros of Drupal being open source

1 Comment

I compiled a list of some pros about Drupal being open source.

Pros:

1. Contributed modules
Like the Apple App commercials "There's an app for that," ...there normally is a module for that too. It might not be exactly what you want but it does give you multiple community options.

2. Free
I love free things, no licenses, no sign up fees, no signing up for newsletters, its just there to download and play with. Install it as many times and in as many locations as you need. There's no need to count, track, or monitor for license compliancency.

3. Easily Changeable Code
you can fix and tweak problems according to your needs. You can also learn about how the system works itself by looking at the core code. This is a huge win over closed sources where you don't even own the code.

4. Community
Lots of resources and eyes from other people. You can find help and contributions from other people, and not just one company.

5 Musician Websites using Drupal

3 Comments

Drupal has gotten really popular, mostly because of its easy to use interface and modular design. Creating custom themes are also easy to create with a little Drupal knowledge. If design is not your thing, there are many pre-built themes available for download if you do a quick search.

The popularity of Drupal has also caught the attention of many artistic individuals. In this case, I'm talking about musicians. Even though it may not be the artists themselves that create these sites, the sites were still made to represent the artist. These sites show the flexibility of Drupal and how it may be tailored to anyone's needs. At first glance, it may not look like a Drupal powered site, but I'm sure many developers will be able see the difference.

Ozzy Osbourne's Offical Site
Ozzy Osbourne's Offical Site

Lunch & Learn Presentation Slides

0 Comments

First, thank you to those who attended the Lunch & Learn at Steamworks on Thursday Jun 17th. I always enjoy preaching Drupal to those who are unfamiliar with it, because using it truly opens all kinds of doors for your organization and its web presence. Things that you would never have thought possible, suddenly become a reality. The Drupal community is an enthusiastic and dedicated group, and when I talk about how much I love Drupal, I am representing the whole community.

That being said, here are the slides from my presentation. I do hope that it comes in handy and helps you convince more people to use Drupal.

View

Quicktabbing with Quicktabs

0 Comments

Quicktabs has quickly become one of my favorite Drupal modules of all time. To think that I was actually wasting time creating tabs by using jQuery plugins, and writing custom AJAX. Creating tabbed content is one of the most popular techniques used on the web today, and with Quicktabs it has never been easier to add tabs to your Drupal site - even with AJAX!

First you'll want to install Quicktabs

Once you have Quicktabs installed, there are a couple of ways to generate tabs. You can do it through the Drupal interface, or you can do it programmatically, but first, make sure you have some content that you want to show in tabs! Quicktabs works with your existing content. You can tab between views, blocks, nodes, or a mixture of these.

For this demo, we'll use Views and set up 2 displays filtered by a certain taxonomy term. We will then create a tab that displays nodes of each taxonomy term respectively. Make sure you have some taxonomy terms to choose from for each post. Then you'll want to create a view called "my_listing", or whatever makes sense for you.

CSS-Only Box Shading Technique

4 Comments

Introduction

Here is a fun technique to add shading to your web pages using only CSS with PNG images, without using JavaScript, Flash, server-side scripting, or Photoshop, and remain totally independent from colors and textures.

Try it here.

Background

Most shading techniques suffer the drawback of the core technology they use:

  1. Photoshop: images must be individually styled for each pattern combination
  2. Javascript: CPU intensive

The main issue with Photoshop techniques comes from the time spent creating images, and from the complexity of the code to keep tack of them. For each color/teture combination, 8 images (4 corners and 4 edges) are required.

One technique called “sliding door” reduces these elements to 6, but requires larger images:

Drupal Developers 101: How to organize your custom module

0 Comments

Drupal developers will always have their own style of coding, and module file structure conventions. On a project where there are two or more developers, it can be beneficial to have a unified way of structuring your custom modules.

One of the reasons why I prefer structuring custom modules is because it makes it easier to find functions or block of codes when debugging.

When all the team members’ are using the same file structure, it is easier for each of them to jump in and help each other debug things if needed.

If there are people on your team who don’t code the same way no worries. Simply having the same filename conventions, and placing functions in different files, in the same manner, makes your project more organized and easier to maintain in the long run.

Here's an example of a file structure that I have used on one of my projects:

module_name
-cck_content_types(exported content types, if necessary)
-js
-css
-images
-includes
-templates
--blocks
--views(overridden views template files)
--others

Keeping your Drupal theme organized.

6 Comments

When working with large websites and web-applications the number of files on your theme folder can grow quickly, and if you're not organized it can get very messy . As a result you’ll find yourself spending a lot more time looking for bits of code every time you have to change or update something.

Here are some tips to help keep you organized.

File Structure:

On Drupal a couple of files have to be on your theme rood folder:

  • - page.tpl.php
  • - node.tpl.php
  • - template.php
  • - themename.info
  • - comment.tpl.php

If your file doesn't have to be on the theme root folder, it should be organized with similar files on subfolders. Here is what we typically use:

  • 1 of 8
  • >