While working on Drupal coding, sometimes you may want to get the default files directory path. Here it is said as ‘default’ intentionally, as you can configure a Drupal installation to have default directory as public or private. For most of the sites it will public files directory.
Use following code snippet to get default files directory path.
drupal_realpath(file_default_scheme() . '://');
Or, if you want to get public or private files directory path specifically. Then you can use this to get public directory.
Or, for private directory path.
When you implement
hook_theme() in Drupal, there is provision to specify the file which should be loaded for the theme functions and preprocess functions to be found. So, we can simplify module file by moving out theme function and preprocess function of our theme entries to separate file. This also has added benefit of reducing module loading. On each bootstrapping Drupal will load every .module file those are of enabled modules. So we should consider moving out code from .module file and also giving modular structure. Continue Reading
While working on Drupal, we may need to get taxonomy term name from its id. In Drupal 7, the easiest way would be to call taxonomy_term_load().
taxonomy_term_load() will return taxonomy term object containing all term properties.
Sometimes, we may need more efficient method of getting term name without the heaviness of other properties of that term. And there is no such function in Drupal 7.
I was trying to enable gd for php in Ubuntu 11.04. As usual it should be typing in terminal:
sudo apt-get install php5-gd
Unfortunately it does not worked and gd was not enabled
Typing the command ‘php -a’ I was getting:
“PHP Startup: Unable to load dynamic library ‘/usr/lib/php5/20090626+lfs/gd.so’ – /usr/lib/php5/20090626+lfs/gd.so: undefined symbol: gdImageCreateFromJpeg in Unknown on line 0″ Continue Reading
Once initialised, we can register script and/or CSS style links or raw scripts and/or CSS styles with resource loader object. Then finally we can render everything in correct order in our web page to deliver to client side browser. Continue Reading
For one of my program I was in need to use thread pooling. I tried two of available, then wrote one myself. Rather than waiting for threads by calling join() I implemented checking in a while loop for finishing of threads. The code is given below: Continue Reading
Until now Malayalam community were using a customised free version of old Keyman to type anywhere in a Windows system. Me too was using it in all places except Malayalam Wikimedia projects, on Malayalam Wikimedia projects I use our Narayam which is a built in Malayalam typing solution integrated to Wikis. People were always complaining about Keyman that is does not work on Windows Vista and 7 systems. And even I had started to develop a solution to replace Keyman based solution, I stopped further developments soon after I fully changed my platform to Ubuntu. Continue Reading
Added support for Oriya to Narayam extension. Currently added schemes for Oriya are transliteration and InScript. Subhashish Panigrahi helped to fix the issues in transliteration scheme. I think more issues may come later, as they want more tuning on it. Oriya translator at translatewiki can use this schemes to help their contributions.
Since its creation to just before Oriya Wikipedia was less active. Shiju Alex is helping to build a community there. After Oriya typing feature active, I hope, more Oriya people will show their interest in the project, as the one major barrier has bee solved.
Yesterday (2011/03/01) I added two Sinhalese schemes, Singlish and Wijesekara, to Narayam. Now there available at translatewiki. Thus Sinhalese people can contribute more translations without depending on third party tools.
There are minor issues in Singlish scheme implementation since it is a phonetic one. Hope those issues can be fixed soon.
Few days before I added Naryam, an extension that helps to add various input methods to Mediawiki installations, to Mediawiki subversion repository. Then Roan Kattouw rewrote most of its code to use new ResourceLoader introduced to Mediawiki and jQuery. Also Roan made it to load input methods conditionally based on content language and current user p referenced language. So now it has better code structure and efficient working.
Then Gerard Meijssen proposed it to have at translatewiki. Once the translatewiki team found the extension working, they adopted it for that wiki. Initially Narayam supported Malayalam transliteration and InScript, Bengali Avro, Bengali InScript, Bengali National Keyboard, Tamil99, Tamil transliteration and Sanskrit transliteration schemes. Yesterday I added Hindi InScript, Sanskrit InScript. Kannada transliteration and InScript schemes also have been added now. So these all schemes or input methods are available on transltewiki now. Continue Reading