12th Mar2010

Couple of things I learned while creating sites in Drupal part 2

by admin

As i am continuing to create sites in Drupal i of course continue to learn of new Drupal ways to accomplish them and make them better. Sometimes even going back to sites of our previous clients and adding a module or two that i just found out existed, and think would benefit them.

On one of the sites i recently worked we bumped into a very puzzling problem the site looked and worked fine in (you guessed it) Firefox, Chrome and Safari but for some reason was totally messed up in Internet Explorer 7. Don’t get me wrong i am not surprised when i see a site having alignment problems in IE this is a known thing, but here it was as if it didn’t see half the CSS at all!

After hours and hours of trying to figure out and nail down the problem, checking the HTML for possibility of any unclosed tags and the like, removing a variety of JavaScript files and removing CSS stylesheets one by one (there were 32 of them). We were able to figure it out the HTML, JavaScript and CSS were all valid, the problem was that Internet Explorer reads maximum 30 CSS stylesheets, and since we had 32 of them, the last two were just ignored. Yes i know 30 stylesheets sounds like a lot but if you ever worked on a Drupal website you will know its not hard to get there: 5 default Drupal CSS files, another 5 from your theme plus every second module you add to your site like UberCart ads one or two of them you are at thirty already. Thats probably one of the reasons Drupal has “Optimize CSS files” option in the performance section of your Admin menu.

Once i started optimizing the site i found few more useful tools and modules to get you there. You probably already know what firebug is and used this popular add-on for Firefox, there is one more add-on that makes the optimization work much easier “Page Speed by Google”. They will show how well you page performs and give you optimization tips. Following the tips i found that there are some good Drupal modules that could help you follow the tips. For example:

  • CSS GZIP module – this module will gzip your aggregated css files
  • JavaScript Aggregator – minifies the JavaScript using JSMin
  • Boost provides static page caching for Drupal enabling a very significant performance and scalability boost for sites that receive mostly anonymous traffic

Another useful tool for optimizing your page is CSS sprites. CSS sprite combines multiple background images into a single image. This technique makes web pages faster because it reduces the number of downloads per page. This step should be done at the design level, but it could be done later you will just spend little more time doing it.

If you liked this post you might want to read the first part.

Do you have any useful things you would want to share? Feel free to do so in the comments. Did you enjoy reading this post? Then share it by clicking the “share this post” button bellow.

04th Feb2010

Drupal Hacks – How to add a custom login box into your Drupal theme

by admin

Login BoxI just did a guest post on lichtman.ca please read it there.

03rd Jan2010

Should you use WordPress or Drupal?

by admin

For Drupal 7 vs WordPress 3 read Here

I spend most of my working days working with Drupal so it’s no surprise that my first blog post on my site was about Drupal. You probably noticed though, that my blog runs on WordPress. I knew someone will point it out to me and ask me why, and i got this question today from a friend of mine. So i decided to write a blog post about the general difference between WordPress and Drupal, and when you should choose one or another.

WordPress:

lets start with an excerpt from the WordPress.org site:

WordPress started as just a blogging systems, but has evolved to be used as full content management system and so much more through the thousands of plug-ins, widgets, and themes, WordPress is limited only by your imagination. (And tech chops.)

Now my thought based on experience and observation:

WordPress is an excellent system to use when creating a website that lets you quickly get your thoughts out on the web, but while it is often used as a blog, it can be configured to work in many other interesting ways as well. I have used it several times with clients that are brand new to the Internet and having a website, yet they can pick this system up and use it quicker than the other two (Drupal or Joomla). Since WP is already developed to work as a blog, though, it can be setup to do so without any hesitation. Comments are already built into the system, as well as pinging services, multiple blogger profiles, track-backs and more. Most of the time nothing needs to be done to those systems either, because they already work the way that the user would want them to.
WordPress, however, is not to be used for everything.

While i know there are e-commerce sites powered by WordPress, people have had little success (its there, just not much) using WordPress as a shopping cart. The reason that WordPress was created, was to put the keys of starting your own websites in everyones hand, take for instance their famed five minutes install. But by doing it they stripped it to the bare minimum, which in turn now stops people keep people from wanting to customize it to do things that are much more advanced. It is supposed to be used as built, out of the box, because any modification that you give to it may very well cause it to break. You will find many users of WP complaining that it is not developer friendly and rightfully so, because there will be countless times in your journey to that great website that an upgrade released by the WP developers causes your entire site to simply disappear, or for those modifications that you made previously to no longer even exist.

WordPress Pros:

  • Simple to use – No need for modifications
  • Excellent for blogging or sharing thoughts in a sequential manner
  • Even the most elderly of users can get the hang of it quickly

WordPress Cons

  • Not very developer friendly
  • The community seems to like to complain much more that the Drupal community for example
  • Upgrades, while they are extremely easy to do, sometimes bring more bugs than fixes, and the more plugins you have the bigger the chance of it happening

Drupal

If you are the type of person who would rather hand-code the content of your pages than use a WYSIWYG Editor, or if you enjoy tweaking the code that makes up the framework of a website, then Drupal is probably for you. This advanced content management system, sometimes more closely resembles a developer platform than a traditional CMS. Its not to say that only developers can use the system though, but to say that they will feel more at home here than in the other two. Interestingly, being more developer friendly does not automatically make it more user friendly in fact the developer has to work hard to make it that way if they need the end-product to do so.

There are dozens of more functions that can be used to develop in Drupal than in WordPress. Every single node has its own set of commands and tags that can be placed elsewhere to manipulate the function of the site, and this makes for a very intense experience (whether or not you know what you are doing). For those that are not so developer-minded, this can be the trial of their lives, but for people who live in code well, they can literally get lost developing some very cool websites.

Now, Drupal websites can act and function in some pretty cool ways, but Drupal has the problem that it just doesn’t look that great (at least not withoput long hours of work…). I have seen very few websites built in Drupal that look and feel as good as they function. Not that they don’t exist they are just few compared to the other ones. And the problem is not that its not themable, take for example a site we made (in conjunction with U2R1media) for Amaravati a gorgeous site but we spent probably almost twice the time on the theming as on functionality. So the problem is just the opposite its very themable and customizable, but out of the box it looks like a site back from nineties, and theming has extremely steep learning curve. You can especially see this in the theme directory on the Drupal.org website, where there are dozens of these themes built to prove the exact point I just made. It’s a shame really, because with all of the development advancements the software has, it would almost be perfect with a stronger usability and design interface. It has made huge improvements with the core 6.x but more is needed and according to what i have read and saw about Drupal core 7.x they are putting a lot of effort into this area, but we will have to wait until it’s first stable release is out and then  some time until all the important modules have their stable releases out the door.

Drupal Pros

  • Extremely developer friendly.
  • Strong community to help discern the dozens (hundreds) of functions, modules and patches available.
  • Can be used to create some really awesome websites that can outperform a majority of other sites out there.
  • Scales as no other system would

Drupal Cons

  • Not very designer and user-friendly. It’s hard for someone with little code knowledge to make the leaps required to do the very cool things that Drupal is becoming known for.
  • Themes for Drupal has been a huge case of fail (until recently). Probably because it has been developers, not designers, that are making the themes.
  • Getting a Drupal website published could cost you more time, and thus more money, than WordPress.
  • While WordPress could be hosted on a very cheap hosting, Drupal needs an access to a lot of RAM.

How Secure is it to use open source CMS

Drupal was all over the news a couple of month ago when WhiteHouse.gov remade their website in Drupal, it was definitely a vote of confidence in  in Drupal’s security by a site thats one of the most targeted by hackers in the world. Now while WordPress was not chosen by the White House, it’s known that BlackBerry is considered a brand of secure communications, so much so that even the President of United States Barack Obama was permitted by his security team to have one, and when they recently remade their Inside BlackBerry blog they used WordPress. So as far as Security is concerned, i would say it should not be on top of your list if you create in either one of the systems.

What do you consider to be the pros and cons of each system? Do you disagree with any of the remarks i made about them? please feel free to leave a comment.

29th Dec2009

Couple of things I learned while creating sites in Drupal

by admin

DrupalI am now creating my 5-th site in Drupal, three of them being pretty big and totally custom. So using a free or even premium theme was not an option. Each section of the site looked so much different that if i would cover logo and name of the site, you would probably think twice before saying thats its the same site. Obviously i made a lot of mistakes, but as they say “The best way to learn is from your mistakes”. So let me share with you some of my mistakes and what i learned from them, plus some of the modules that i found really useful.

Starter Theme

Start with free blueprint theme this will give you a starting point so that you will have all the elements on the page but without actually having any design, so that when you start putting in your design you don’t have to fight with legacy code from the theme.

Admin

Next very important step is going to be to install Admin Menu. This module is so important that it was included in core of Drupal 7.

Javascript

As i mentioned earlier the sites i was working on were very custom they were using:  jQuery, Cufon,  Accordion, Ajax, Thickbox, In-Field Labels… The version of jQuery that comes prepackaged with Drupal is old. So what i did is just put the latest version in the theme… I got it to work but not without having multiple versions of jQuery being included on every page, which in turn forced me to use “jQuery no conflict mode”. Even though we got it to work eventually, every time you add any module that uses jQuery i have to go through the javascript and substitute “$” sign with “jQuery”. So obviously there must be a better way. An indeed there is, what i could, and should, have done is install jQuery Update module, which would update the version in a “Drupal” way. Also there is a jQuery UI Module which contains:

  • Accordion
  • Datepicker
  • Dialog
  • Progressbar
  • Slider
  • Tabs

There is also a Cufon Module, Thickbox Module etc. So whatever you trying to do try to find a Drupal way of doing it.

Theming the site

There are few must have tools (Modules) in this area. You will need Devel Module to see whats going on under the hood of your drupal site what templates and what functions are used and which names you could use to override those. Another module that i find myself using a lot is Views. I use it for two entirely different purposes, one to create a custom block or a page. Another use is not so “Drupal”, sometimes you have no other choice but to stick in a SQL query into your theme, but the problem you will encounter is Drupal is so flexible and generic that sometimes to get one entry from the database you will need to connect and join three, four or even five tables, so to write the SQL query by hand will take you a while, here is where my second use of Views comes into play, there is an option to show you the SQL query the view runs while generating content you requested, so you could just copy it and stick it into your theme.

Other Modules i use:

  • Token – Used mostly by other modules
  • imageapi – Used by other modules
  • Disqus – substitutes the default comment system with the one from Disqus  which lets your readers comment by login in with their Twitter, Facebook login or others, plus it lets you have the conversation all across the web, i find it truly amazing.
  • CCK – Lets you add custom fields aside from title and body
    • filefield – File type of CCK Field
    • imagefield – Image type of CCK Field
  • imagecache – Lets you show the same image in variety of sizes, based on presets
  • Poormanscron – runs the cron jobs for you (will be included in core of Drupal 7)
  • pathauto – automatically generates aliases
  • globalredirect – makes sure that node/10 takes you to node10alias, so that there is only one URL to unique content
  • webform – If you are planning to have any forms on your site
    • webformblock – If you want to show the form in a block, versus a whole page

As i continue to make more mistakes (read learn) i will continue to share more lessons i learned. If there is anything you would like to share or ask, feel free to do so in the comments.

If you liked this post you might want to read the part 2.

Reblog this post [with Zemanta]
Pages:«12