Sunday, November 19, 2017 02:45 pm EST

Blogs

Bri's picture

Git command cheat sheet

The majority of this list came from http://cheat.errtheblog.com/s/git but I have added in some tidbits that I have found in other places as well.

Configuration

git config -e [--global]
edit the .git/config [or ~/.gitconfig] file in your $EDITOR

git config --global user.name 'John Doe'
git config --global user.email johndoe@example.com
sets your name and email for commit messages

git config branch.autosetupmerge true
tells git-branch and git-checkout to setup new branches so that git-pull(1)

Bri's picture

Change the submitted variable in drupal 7

Go to: /admin/config/regional/date-time/formats/add
Create desired time format, i.e. l, d/m/Y or see http://id.php.net/manual/en/function.date.php for available options.
Add format.
Go to: /admin/config/regional/date-time
Set medium data type into the desired one.

Bri's picture

Theming the Contact Form in Drupal 7 (contact_site_form)

Theming the contact form in Drupal 7 is almost the same as most people did it in Drupal 6, but the one change through me for a loop for quite awhile.

Using Drupal 6, most people would add some code to their template.php file and create something like the following:

DRUPAL 6

function myTheme_theme() {
  return array(
	'contact_mail_page' => array(
					'arguments' => array('form' => NULL),
					'template' => 'contact-form',
					),
	);
}
function myTheme_preprocess_contact_mail_page(&$vars)
{
	$vars['name'] = drupal_render($vars['form']['name']);	
Bri's picture

An Example of Using db_query in Drupal 7

If you are writing your own modules, there is a good chance you have used db_query quite a bit in the past. The database layer has been overhauled in Drupal 7, and as a result, the way you get query results has changed slightly. Here is an example to how you how it's used.

// Notice the place holders are now done using the same syntax as PDOs (:uid)
// Placeholders also don't need to be quoted anymore.
$uid = 1;
$result = db_query('SELECT n.nid, n.title, n.created
FROM {node} n WHERE n.uid = :uid', array(':uid' => $uid));
Bri's picture

Template suggestions for Drupal 7 - theme_hook_suggestions

I decided to take some time to figure out how template suggestions work in Drupal 7 being that the release date is getting very close. At the time of this writing Drupal 7 is in RC 4, but they are saying that it will be released officially on January 5th of 2011. I have been working with 7 for a few weeks and finally decided to see if I could get the template suggestions to work. A few things have changed, but they are not that much different from the way they worked in 6. The first difference is that 7 uses a double "-" for its templates by default.

Syndicate content