Drupal
Drupal - How to install Drush
What is Drush?
It's a command line shell and scripting interface for Drupal. The Drush Package Manager allows you to download, enable, disable, uninstall, update modules/themes/profiles/translations from the command line in a very simple way (apt-get style) - just type,
drush dl views
3 comments for Drupal - How to install Drush
Drupal - Check if a User has a specific role
Here is a quick way to determine if a user has a specific role
<?php
// Bring the user object into scope.
global $user;
// Check to see if $user has the administrator user role.
if (in_array('administrator', array_values($user->roles))) {
// Do something.
}
?>
1 comments for Drupal - Check if a User has a specific role
Drupal - Adding Javascript to your module
When creating your own Drupal module, you may need to add some styling or Javascript to improve the usability of your module. Here is how to do it.
drupal_add_js(drupal_get_path('module', 'MODULE_NAME') . '/common.js');
Similarly you can add CSS to your module as well
drupal_add_css(drupal_get_path('module', 'MODULE_NAME') . '/styles.css');
1 comments for Drupal - Adding Javascript to your module
Drupal - Use hook_form_alter() to set redirect path on the form
One popular use of this hook is to change the destination of a form submission. Here is how it is accomplished:
<?php
function YOURMODULE_form_alter($form_id, &$form) {
switch ($form['#id']) {
case 'node-form':
if ($form['type']['#value'] == 'story') {
$form['#redirect'] = 'new/url';
}
break;
}
}
?>
1 comments for Drupal - Use hook_form_alter() to set redirect path on the form
Drupal - The Best and my Favorite Modules
I've worked with Drupal in the past for several projects and have come across some modules that have become my favorites. Here they are:
- Tiny MCE
This module was the first to integrate Moxiecode's popular TinyMCE WYSIWYG editor into a Drupal site for editing advance site content.
2 comments for Drupal - The Best and my Favorite Modules
Adding 301 Redirects using htaccess
It's easy adding 301 redirects to your website using Apache's htaccess. A 301 redirect is the most efficient and Search Engine Friendly method for web page redirection. It's not difficult to implement and will preserve your search engine rankings as well.
Often when someone does a redesign of their website or puts it into a new platform, and little consideration is regarded for the difference between the existing an new link structure. You should have a redirect in place if your old link structure varies from the new one. This will help you maintain you search engine rankings and decrease the possibility if someone reaching a 404 page.