Posts about Drupal 7, jQuery, PHP, CSS and more

Helpful Drupal 9 Code Snippets

2 years 7 months ago

I continually went to my views embed code through the life of Drupal 7. So lets continue that tradition with posting some of the snippets that are helping the most with Drupal 9.

SQLite Unity and Android - Multiple issues and how I fixed them

5 years 10 months ago

Sqlite is an extremely useful technology for building mobile apps. It has some challenges to get it to work in both iOS and Android.

Flexbox is better than floating or tables for dynamic rows of items

6 years 1 month ago

Here is another bit of code I find myself looking up recently. Flexbox is my new favorite layout tool.  It lets you set even boxes in a row with perfect space between the element and not on the outside.  It is surprisingly easy to use and gives you a perfect way to lay out dynamic content.  Here is the base code to use on the container:

Equal inner table cell spacing - just CSS width and padding

7 years 11 months ago

Instead of padding the left and right side of all your table cells you only want to pad the inner cells.  You want the table of images, perhaps, to fill the entire content area, but you want the images spaced the same inside the content.

Also, you may not have control over the markup of the site, and need to just use width and padding for the four cells.

Only Set The Viewport Width For Mobile Devices

9 years 6 months ago

I know I am going to need this again. This saved me from a decent into madness figuring out why I couldnt get the iPad view to look right. Normally I don't make the iPad view of the site responsive. I just give the user the desktop experience. So setting the viewport to always use "width=device-width" was making the iPad have to scroll to see the 960 pixel width.

Changing The Default Value Of A Form Field In Your Custom Drupal 7 Module

10 years 5 months ago

I guess I couldnt stay in the dark about hooks forever.  They are actually quite useful.  Here was my problem:

I am using a custom profile type for a drupal commerce site in drupal 7.  It is a simple profile type with one simple text field called "From Name".  All I wanted to do was have this be prepopulated with the default value from their last order.  

How To Easily Make A Quick Module In Drupal 7

10 years 6 months ago

How To Easily Make A Quick Module In Drupal 7

I still dont completely understand hooks and all that.  This is maily to have a library of functions you can use across themes.  I used to put everything in template.php, cause ya know, it works.  However then when i was in my admin theme i would get errors of "undefined functions."

Simple 3D Book Opening Effect For All Browsers

10 years 7 months ago

I first have to recognize this awesome web tool by microsoft.  It finally cleared up how to do this transition for me.  It shows a live preview of all these confusing css tranform properties.  As always, If you can get it to work in internet explorer you are pretty much guaranteed...

Browserstack helps you test your site in all browsers

10 years 9 months ago

Browserstack helps you test your site in all browsers

I always forget what site this is when I need it the most, so I'm listing it here.  This site is the perfect solution to test your site in a multitude of browsers.  I am always hearing from clients some wierd design issue on ie7 or ie9.  This site lets you virtually use basically every browser loaded with developer tools.

Drupal 7 subfolder forwarding error in the .htaccess file

10 years 10 months ago

This was an odd problem.  All of the sites on our server are in sub folders.  So this site is actually  The problem seemed to occur out of nowhere, but my guess is GoDaddy updated apache in some form.  So at around 3:00 half of my sites lost their background styles.

Jquery Slide to Top and Bottom of the Page

11 years 5 months ago

Jquery Slide to Top and Bottom of the Page

Pieced together from the internet. This code should give you that nice slide action to the bottom and top of the page.

Simple Node Pager for the Menu System in Drupal 7

11 years 6 months ago

Simple Node Pager for the Menu System in Drupal 7

Ive been working with drupal 7 for about a year...  Self taught.  I like it.  

Its very coder friendly... But at the same time can be very intuitive for clients... As long as you set the site up correctly...

Using db_query in Drupal 7

11 years 8 months ago

Using db_query in Drupal 7

Quick script showing how to use db_query in drupal 7.

Also shown is how to get the location module to sort by distance using "Use PHP code to determine latitude/longitude" given a zip code argument.

$zip = '';
if (isset($_GET['zip'])){
  $zip = $_GET['zip'];

Inserting a View anywhere in a page in Drupal 7

12 years 1 month ago

Inserting a View anywhere in a page in Drupal 7

Heres a simple bit of code that will let you insert a view anywhere in a node.  This is more efficient then making a page version of a view and giving it a path.

In my opinion this code is one of the most critcal snippets for any Drupal 7 developer.  Its a basic buiding block in any site I build.

You can still use your regular node formts/meta tags/etc.