drupal

CVSing back your drupal site.

The benefits of using source control are great. It is like working with another developer, to review your code changes, even if you are all by yourself, not to mention being able to rollback any changes that you have made.

When using drupal, I like to grab core, modules and themes using cvs rather than downloading files. I find it easier to keep core and modules up-to-date while maintaining the patches I might have applied to a module.

Rules can make your life simpler

On this site, or Living Plenty or dedicated to my cat Abraham Mao, I want authenticated users to be taken to the group page, which shows all their unread group discussions. Anonymous users when browsing the sites would just go to the usual node page.

When searching drupal, I tried out Front page module, however, it did not work for me to do what I wanted.

Optimizing Feedapi

When using feedapi and making nodes out of feedapi items, this can cause quite a load on the server.

If using sql search in particular, may cause the database to be bogged down, because each feed can generate a handful to 100's of feed item nodes.

There are quite good viable alternatives to sql core search, with the use of apache solr search module, xapian, sphinx amongst others.

Where is the drupal omnifunc for vim?

Recently I tried out omni complete in vim, and I love it. It is included in vim 7. This adds a function lookup for php, html, python, javascript, css, xml, sql and c amongst others.

To enable under your home directory in the ".vimrc" file add one line
:autocmd FileType php set omnifunc=phpcomplete#CompletePHP

Syntax Highlighting

In "~/.vimrc"

:syntax enable
:colors pyte
:syntax on

Pushing out your own tokens

If you are in need of custom tokens, here is an example of how to create custom token for a specific vocabulary.


/**
* Implementation of hook_token_values()
*/
function csm_support_token_values($type, $object = NULL, $options = array()) {
if ($type == 'node') {
$tokens['term-media-type'] = '';
$termArray = $object->taxonomy;
$tid_media_type = $termArray[15];
$term_obj = taxonomy_get_term($tid_media_type);
$tokens['term-media-type-tid'] = $term_obj->tid;
$tokens['term-media-type'] = strtolower($term_obj->name);
return $tokens;
}
}