Drupal Hacks – How to add a custom login box into your Drupal theme
I just did a guest post on lichtman.ca please read it there.
I just did a guest post on lichtman.ca please read it there.
I 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:
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:
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.