Introduction to Drupal Preprocess & Process Functions

[dropcap type=”v2″]I[/dropcap]n this post, I’m going to give you an introduction to Drupal’s powerful preprocess and process functions. If you’re not already familiar with these functions, I like to think of them as both a front-enders nightmare and best friend. A nightmare only because it’s Drupal and with everything Drupal, has a steep learning curve. A best friend because, it provides the front-ender more control over the output of rendered code allowing for more efficient, clean, and crisp markup. It does need some basic PHP knowledge, but hopefully after reading this post everything will make sense.

Continue reading “Introduction to Drupal Preprocess & Process Functions”

Local SEO Strategies — Drive local customers to your website.

[dropcap type=”v2″]T[/dropcap]argeting the right demographic is one of the most important aspects for many local business websites. Since the internet is global, its sometimes hard to know what to do when it comes to optimizing your site for a particular area. This is important for a business so it can improve its visibility for local customers. Luckily search engines are evolving to meet demands like these; enter the world of Local SEO.

Local Search Helping Small Businesses

Sites optimized for local search can vastly improve its search engine rankings. Say you’re a Googler trying to find a local coffee shop or transportation service around you. If a site has been properly optimized for local search, Google will display a map and other relevent information to the searcher for businesses they’re looking for. This helps click-through rates and makes it easier for customers to find what they’re looking for.

Continue reading “Local SEO Strategies — Drive local customers to your website.”

Open Letter to My Girlfriend (Now finance!)

[dropcap type=”v2″]I[/dropcap] originally wrote this on May 16, 2011 (1 year, 8 months, 29 days ago) and posted in on Facebook for all of our friends and family to read. An open letter to my girlfriend (now finance), I wanted the world to know how amazing she is and how lucky I feel to be with her. I meant every word then and even more so now. Angela Aruffo, soon to be Angela Marshall, Happy Valentine’s Day! I love you Poptart!

Continue reading “Open Letter to My Girlfriend (Now finance!)”

Quick Code: jQuery Sticky Navigation When User Scrolls

Sticky navigation is being used more and more on sites and there’s a good reason why. It improves the UX by making the menu available no matter where the user is on the page. Learn how to create a simple, light-weight jQuery sticky navigation below. Best of all, it’s easy to implement on existing site’s without having to change any existing HTML code!

Sticky navigation is being used more and more on sites and there’s a good reason why. It improves the UX by making the menu available no matter where the user is on the page. Learn how to create a simple, light-weight jQuery sticky navigation below. Best of all, it’s easy to implement on existing site’s without having to change any existing HTML code!

jQuery Sticky Navigation Effect

Without further adieu, let’s jump into the code.

The JavaScript

jQuery(function(){
  var menuOffset = jQuery('#site-navigation')[0].offsetTop;
  jQuery(document).bind('ready scroll',function() {
    var docScroll = jQuery(document).scrollTop();
    if(docScroll >= menuOffset) {
      jQuery('#site-navigation').addClass('fixed').css('width',jQuery('#masthead').width());
    } else {
      jQuery('#site-navigation').removeClass('fixed').removeAttr("width");
    }
   });
});

Fairly basic jQuery code. It will add a class to the navigation when a user scrolls beyond it. Only thing you’ll need to change here is the navigation selector, #site-navigation. Also, you may want to remove .css('width',jQuery('#masthead').width()). That part of the code is more specific to this site.

The CSS

#site-navigation.fixed{
  position:fixed;
  z-index: 9999;
  top:0;
}

Simple stuff! If you’ve got any questions or need help customizing it to meet your needs feel free to shoot me a line below.

Never fear, WordPress is here! Why to Choose WordPress for Your Site

I do a lot of freelance web development work on the side. From small businesses to large, I’ve done them all. Many of these require the owner the ability to manage their site without the need for a web developer every time they want to make a change. That can get quite expensive for an individual or owner. I find that many times these people believe that getting a customized website built for their company or person can be extremely expensive. My aim is this article is to reach those small business owners and individuals interested in a site and put their mind at ease. The fact is, it can be very inexpensive to get a customized site built. That may be a relative term, but after reading this post, I think you’ll agree with me. I’m going to introduce you to WordPress. A phenomenal content management system (CMS) that will make setting up and managing your own site inexpensive and simple.

I do a lot of freelance web development work on the side. From small businesses to large, I’ve done them all. Many of these require the owner the ability to manage their site without the need for a web developer every time they want to make a change. That can get quite expensive for an individual or owner. I find that many times these people believe that getting a customized website built for their company or person can be extremely expensive. My aim is this article is to reach those small business owners and individuals interested in a site and put their mind at ease. The fact is, it can be very inexpensive to get a customized site built. That may be a relative term, but after reading this post, I think you’ll agree with me. I’m going to introduce you to WordPress. A phenomenal content management system (CMS) that will make setting up and managing your own site inexpensive and simple.

Welcome to the new world of WordPress, no longer just for blogs!

I’m a big believer in what a amazing tool WordPress is to power a website. And before you start thinking it’s only good for blogs, it’s not. WordPress has evolved in the past five years to become a versatile CMS capable of being transformed into a fully featured site. It provides a way to manage the site’s content effortlessly with little to no need of technical knowledge. Here’s just a few popular sites you might be surprised that are running on WordPress:

And of course, another expected benefit of using WordPress is that you’ll have a website and blog all in one working harmoniously together.

Why you should choose WordPress for your site and over other content management systems

Learning Curve for Popular CMS
From CaroLINES blog post, Drupal’s learning curve http://urlnub.com/lCM
When people ask me why they should use WordPress over another content management system like Drupal it’s easy to give them an answer. In addition to the reasons below, I suggest you do your own research and not take my word on it. Google whats better wordpress or drupal and you’ll see thousands of pages and posts praising WordPress over Drupal. Check out CaroLINES blog post, Drupal’s learning curve. Frustrated with Drupal and other content management systems like it, she was inspired to create the graphic on the right.

There’s a lot of reasons why to choose WordPress. With it proven success and easy-of-use it’s makes it an obvious choice. But, just incase you’re still on the fence, here’s just a few of the many reasons why you should be using WordPress to manage your site:

Reason One: WordPress is easy to use and affordable

WordPress is simple to use, affordable, easy to learn and has a great intuitive interface. It makes adding images, videos, new pages, blog posts, and more on a regular basis a breeze. You can even customize it to meet your needs for pages like user profiles, specialized landing pages, calendars and more. The sky is the limit! If you can think it, WordPress can be easily customized to do it, from basic informational sites to full-fledge shopping carts.

Code Is Poetry
WordPress Philosophy, http://codex.wordpress.org/WordPress_Philosophy

Best of all, with a little bit of technical knowledge, you can download and install WordPress for free! You can’t beat that. Most custom systems like WordPress can cost thousands upon thousands of dollars. Worst of all, the money pit keeps getting deeper and deeper for site upgrades, fixes and other changes. With WordPress, you’re using a trusted system, tested and used by thousands of users since 2003. It provides free updates and fixes to security vulnerabilities as technology changes and hackers get more resourceful.

Reason Two: No technical knowledge or special software needed

WordPress lives in the Do-It-Yourself world. You no longer have to wait for a programmer to fix a tiny error for a lot of money. One of the great things about the system is that it’s self-contained and doesn’t require any technical knowledge or special software. You’ll no longer need to spend hundreds, even thousands on special development software like Adobe’s tools. All you need is a device with an internet connection and you’re good to go. Spending days and days trying to figure out how to make your site look the way you want are gone. You can easily create new pages, blog posts, format text, upload media, documents and more all without the need for HTML or FTP software.

Reason Three: WordPress goes where you go, update your site from anywhere

WordPress is internet based, so where ever there’s an internet connection you’ll have access to manage your site. You can even use it on your smartphone! In addition, you can set it up to add new blog posts just by sending it to a email address. It’s key feature is the ease at which is makes it to run your website. While your on vacation, walking the dog, out to dinner or sitting on the pot, if you’ve got an internet-enabled device that has a browser or email client, you’re set!

Reason Four: WordPress offers maximum flexibility to it’s users

WordPress is one of the most efficient and powerful tools for building websites. Built on an open-source platform, it’s simple and easy to make changes from the look of the site to customized functionality like a reservation or booking system. Launching Poptart Cooking was a massive success thanks to the ability to customize the site to fit our needs. With its plug-in feature, you can easily add various applications and tools for improving both the front-end and back-end of your website. There are thousands of great one’s to choose from. A limitless number of site’s like WordPress’s Plugin Directory and CodeCanyon provide an endless amount of WordPress plugins to choose from to meet every need. Most of the plugins only require one click to install and use.

Reason Five: Reach the people you want to reach easily driving traffic

SEO or Search Engine Optimization may sound confusing or even difficult to do. With WordPress, there’s plugins out there built specifically for the purpose of SEO to drive a high volume of traffic to your website. It allows online businesses to get high rankings in the various different search engines like Google and Bing. Higher rankings equals more targeted visitors to your website. It can be one of the best methods when you want to link directly to your customers. Additionally, it saves your valuable time and makes it easy to effortlessly create your company’s website while helping to better manage it in an efficient manner. It’s the perfect content management system for both big and small companies since it’s affordable and brings visibility to business.

A quick look into the features of WordPress

Here’s just a few of the screenshots that showcase the powerful features of WordPress. You can find more on their official site.

WordPress is gaining in popularity by the day and is the platform of choice for many high profile establishments such as the American Government, the CIA, the FBI, the Airforce… and many more.

Is WordPress Scalable? Absolutely!

There’s a big myth out there that WordPress isn’t scalable. That’s absolutely false! Many times the reason the site is having a problem growing are issues with the host, poor server setup and/or poorly coded WordPress plugins. Check out Mark Cahill’s post on WordPress Scalability and what you need to know to make WordPress scale.


In Conclusion

Looking to get a website up fast while being able to efficiently manage it? WordPress is your answer. With a bit of technical knowledge you can install it yourself or pay a small fee to have it professionally installed. I’ve done this personally for many of my clients from the basic install to custom functionality. If WordPress is something that interests you and you’re looking to have a site built, I’d be happy to discuss options with no obligation.

The stumbling block for many people who are desperate to get themselves or their company online is the technical step. With WordPress, it’s never been so easy to quickly set a site up online. With the wealth of free knowledge it makes it easy success launching and managing your site.

Introduce Yourself to SASS and Compass

So you’re a front-end web developer? If so, you probably spend a good portion of your day writing a lot of CSS. I remember those days of copying and pasting over and over again, racking your brain remembering the various vender prefixes, trying to ensure your website is cross-browser compatible, all while doing your best to write solid and clean CSS code.

Ever heard of SASS and Compass? I’ll walk you through how these two powerful tools will be able to speed up development time by doing the heavy lifting for you.

Sass could be defined as a meta-language on top of CSS that helps developers code more elegant syntax for CSS and implements various features that makes building stylesheets more manageable.

SASS & Compass

If code could have relationships, SASS and Compass are soul mates. When I first learned of SASS and then it’s pimp cousin Compass, I was intrigued. In the first couple of projects I worked on where I used these valuable tools, so many of my frustrations were solved. Like magic, I could set some standard site colors and then easily reuse them throughout my stylesheets all while managing that color from a single variable.

Then I came across something called “mixins“. These are analogous to the way many programming languages like PHP work. They let you write CSS in a DRY (Don’t Repeat Yourself) fashion while creating optimized stylesheets that are easier to read, write and edit than the old-school way. Plus with Compass, you’ll have access to several useful mixins which you can quickly incorporate into pre-built CSS frameworks like Blueprint, HTML5 Boilerplate, Susy and more. Even more, you can use them semantically, rather than litter your markup with presentational class names. This is great when working with Drupal theming where it’s not always quick and easy to change classes on elements.

SASS: Syntactically Awesome Stylesheets

SASSOne of the first things that caught my eye when visiting their site was the quote, SASS makes CSS fun again.

Basically, writing SASS is exactly the same as writing CSS… if you so choose. Using the SCSS syntax makes all of your CSS files SASS-ready. The only thing missing is all the exciting features SASS provides. Alternately you can write using the more terse syntax that can save you keystrokes.

Here’s both syntaxes below:

SCSS

Check out how similar SCSS is to CSS. The only thing different here is some variables. This is the method I prefer.

SASS

Tired of those repetitive curly braces and semicolons? They’ve been replaced with a more strict indentation-aware syntax. This method may allow you to type faster and visually scan easier. Both syntaxes are equally functional, so your choice should be based on preference.

Compiled to CSS

Here’s what the compiled CSS from either of the SASS code blocks above:

Install and Setup SASS & Compass

There’s a ton of great resources out there on the web on how to install and setup SASS and Compass. Their own documentation is a great start and should provide you all the information you’ll need to get up and running.

Compass

CompassCompass is SASS built pimp. Without SASS, Compass would be homeless. At the very least, Compass can run in the background and watch when changes get made to your sassy files so it can then re-compile and save it as a production-ready CSS file. That’s awesome and all, but that’s not even close to what this pimp has to offer. Compass allows you to setup your project structure so you can incorporate various frameworks, including your own if you’re a rebel. Out of the box, figuratively, Compass comes with a large number of utility mixins and the popular Blueprint CSS framework. That’s a lot of bling already, but mosey on over to GitHub and check out the other awesome goodies that people are working on. 960.gs, Susy, HTML5 Boilerplate and a whole lot more are already waiting for you to play around with. In addition, there’s a number of plugins you can incorporate that were created to perform certain specific tasks in CSS. Fancy Buttons is just one of the many plugins that provides a easy way to add progressively enhanced CSS buttons. Another is Lemonade which allows you to compile all of your .png background images into a nice, tidy sprite file.

Variables

One of my favorite features of SASS is the ability to use variables. Variables you say? Yup. It’s incredible that this isn’t already available is plain ‘ole CSS, because it’s so simple and yet powerful. I did a presentation at my job on using SASS and Compass in a new project we were starting. The first thing I heard about SASS was, “Whoa, now I don’t have to remember hex numbers for all my colors!” Or something similar to that. Here’s an example below using variables and functions to do things like change colors.

$my-red: #b80000;
$my-dark-red: darken($my-red, 10%); // renders as #410101
$my-muted-red: desaturate($my-red, 40%); // renders as $5c1919
$my-transparent-red: transparentize($my-red, 0.5); // renders as rgba(115, 2, 2, 0.5)

It doesn’t stop at colors either. SASS variables can be used to store pretty much any value you’ll need to reuse.

$vertical-margin: 24px;
$horizontal-margin: $vertical-margin * 0.5;
div.container {
  margin: $vertical-margin $horizontal-margin;
}

// Renders as:
div.container P
  margin: 24px 12px;
}

Mixins

Mixins are one of the most powerful features of SASS. Mixins allows coder’s to reuse entire snippets of code and even interject logic while doing it. This gives you reusable and flexible ways to style your markup. You’ll be using mixins everywhere, but let’s start by looking at humble html lists. We use lists in html almost as often as we use div’s. They’re versatile, and therefore are often the best semantic element for a given piece of content, be it a menu, a tag cloud, or upcoming concerts.

Let’s look at the mixin for removing bullets from lists that is included with Compass.

Defining the Mixin

This is where we write the code we want to apply to multiple places. This example happens to be included with Compass but you can easily write your own.

// REMOVE BULLETS FROM A LIST
// Turn off the bullet for an element of a list
@mixin no-bullet {
  list-style-image: none;
  list-style-type: none;
  margin-left: 0px;
}
// turns off the bullets for an entire list
// NOTE THAT THIS MIXIN NESTS THE PREVIOUS ONE ON ELEMENTS
@mixin no-bullets {
  list-style: none;
  li {
    @include no-bullet;
  }
}

Including the Mixin

This is how you apply the mixin as you work.

ul.my-list {
  @include no-bullets;
}

Or you can use the shorthand syntax:

ul.my-list
  +no-bullets

Rendered CSS

ul.my-list {
  list-style: none;
}
ul.my-list li {
  list-style-image: none;
  list-style-type: none;
  margin-left: 0px;
}

Mixins are also used when implementing a CSS framework in Compass. My main problem with implementing the increasingly numerous CSS frameworks is that in order to apply the predefined styles you need to use presentational class names in your markup like, span-6. I used to use them anyway in order to gain the other benefits, but it always tasted funny. Mixins are a huge part of overcoming that hurdle. Since mixins can accept arguments we can use them to calculate an element’s width and other properties, and apply those properties to semantic classes. So if your CSS framework has a set of styles that make an element 6 columns wide, set a margin, and float it to the left we can now write a mixin that can be applied to any class. What’s more, we can make that mixin dynamic so that it can calculate that width and margin instead of just dumbly spitting out static declarations. Mixins are part of the reason SASS and Compass make the perfect pair.

Extend

@extend is the new kid on the block, having recently been developed for SASS version 3, and honestly I’ve only recently started to understand it well enough to know when it’s the right tool to reach for. It’s pretty simple to grasp the concept. Sometimes you write a style for an element, and then you want to apply that style to something else, but add a little more to it. For example you might have a call out, and then want to position it on the left or right of the content.

SASS

$horizontal-margin: 18px;
$padding: 6px;
.callout {
  border: 1px solid black;
  padding: $padding;
}

.left-callout {
  @extend .callout;
  float: left;
  margin-right: $horizontal-margin;
}

.right-callout {
  @extend .callout;
  float: right;
  margin-left: $horizontal-margin;
}

Rendered CSS

.callout, .left-callout, .right-callout {
  border: 1px solid black;
  padding: 6px;
}

.left-callout {
  float: left;
  margin-right: 18px;
}

.right-callout {
  float: right;
  margin-left: 18px;
}

Stay Sassy, Austin

SASS and Compass has been added to my arsenal of web development weapons and should be in yours too! Since I’ve started using these two powerful tools, I’ve become spoiled. Give it a try on your next project and you will be too. Here’s to SASS and Compass, the perfect relationship.