Codekarate Content

By adam
Thu, 2015-03-26 07:33

Drupal 8 coming (queue suspenseful music)! One of the HUGE things with Drupal 8 is this term called "headless Drupal". Don't worry the Drupal drop isn't in any danger of losing precious head real estate, rather headless Drupal refers to using a different client-side (front-end) framework then the back end Drupal framework. From what I have read the goal is to have Drupal become the preferred back-end content management system.

By adam
Wed, 2014-11-12 08:23

There is a saying that "All good things come to those who wait". While whoever said that was most likely not referring to our Git cheat sheet, but the saying still holds true. As of right now, you get get your coding hands on the Code Karate Git Cheat Sheet by clicking here or going to the cheat sheets page (it is the same thing).

By adam
Tue, 2014-10-21 10:42

As developers we always are looking for ways to become more efficient. After all, time is money.

One of things we found that always cost us more time than needed was remembering Drush commands when building our Drupal websites. Obviously, Google will find thousands of sites with this information, but just having a sheet laying on our desks seems to provide the answer faster. Remember time is money.

The Problem

Style this using views and CSS. What you are looking at below is a view being displayed as a grid. This is by far the easiest way to display content in a nice looking grid view, but as you will read there is a MUCH better way.


There are some times in Drupal 6 where you push the limits of what the blocks interface can do. If you need to display the same block, multiple times on the same page, you will start to see these limitations. An example of where this is useful is a Newsletter signup form. Sometimes a client may want a newsletter signup form to be in the footer of every page, but also displayed more prominently on the contact form page.

I recently was helping a new Drupal developer with some issues after they attempted a Drupal update that really messed up their Drupal website. They were getting a bunch of Fatal errors that were causing the site to be completely broken. This user was on a Windows system running a Drupal 7 development site on their localhost. Here are the steps I tried and how I fixed the problem.

Download a new Drupal 7 core

Have you ever ran into a problem where you needed to upload relatively large files and still want to be able to manage these from the Drupal 7 administrative interface? If so, you may run into a situation like the one below:

You will notice the 12 MB text stating that we can only upload files that are 12 MB and under. In this case I needed this number to be a little bigger.

By shane
Wed, 2012-12-05 09:30

I wrote a post on Hiding page titles for specific node types in Drupal 6, this is just an updated post for Drupal 7.

The code is essentially the same, but requires just a minor change. If you want to hide the page title on only the front page of your Drupal 7 website, add the following code to your themes template.php file (replacing THEMENAME with the name of your theme):

function THEMENAME_preprocess_page(&$vars) {
  if ($vars['is_front']) {
    $vars['title'] = '';
  }
}
By shane
Fri, 2012-10-12 02:07

Note: Turns out there is a much easier way to do this as there is an Ubercart function that does essentially the same thing (thanks to the comment below that pointed this out). Just use:

uc_product_is_product($node);

I left the original post below (although it is no longer really needed).

By shane
Mon, 2012-07-30 16:39

An easy one today. I often have to remind myself of how to convert a MySQL datetime to something a little more usable... a UNIX timestamp.

The strototime version

It is incredibly easy, just use the PHP strtotime function.

$timestamp = strtotime($result->my_datetime);

Now you can print the date in any format you want:

print date("Y-m-d H:i:s", $timestamp);

PHP5 Convert MySQL Datetime to PHP date format

If you are using PHP5, the following should accomplish the same thing.

 

Pages