Tips and Tricks
How to display user's fullname in Drupal
By default, Drupal will have only username and password for such a user. Whenever username is displayed, it will try to call a theme funtion namely username
by specified $node
. If you want to display user's fullname instead, you have to customize a little bit.
- sugree's blog
- Add new comment
- Read more
- 5544 reads
How to list nodes in multiple taxonomies in Drupal using Subquery
I found a good question regarding PHP snippet for Drupal. Usually, we will list nodes in multiple taxonomies using OR operator. However, you might need to list using AND operator which nodes must be in all specified taxonomies instead. It is not easy to do so using plain SQL. The straightforward solution is to use subquery.
- sugree's blog
- Add new comment
- Read more
- 2178 reads
How to manually sort table in Drupal
Drupal provides powerful and flexible built-in table sort functionality. However, it will only work with database query through standard db_query()
and pager_query()
. In many cases, rows are fetched from external system, e.g., mailbox. We may add a few lines to get the same behavior.
- sugree's blog
- Add new comment
- Read more
- 3835 reads
How to compile PHP for Plesk
I would like to enable mbstring
and/or iconv
in PHP running on Plesk. This is a painful process. I have to compile and install lots of packages. The most important thing is the configure
. Note that this host is FreeBSD.
- sugree's blog
- Add new comment
- Read more
- 3043 reads
How to force fsck in Ubuntu
Most of you may try to let servers run as long as possible to maximize availability in term of uptime. That is good. However, there is at least a side-effect originated by the nature of file system where as it is necessary to clean up something important. For example, ext2/ext3 should be checked for every 30 mounted or 180 days. It is fine to reboot a server once a year as long as the file system is not read/write too often, especially when there is very low free space. That's why you should force to run fsck
sometimes.
- sugree's blog
- Add new comment
- Read more
- 15171 reads
How to redirect url permanently in Apache
One day you may want to rename your domain name to a new one due to inappropriate use of the old domain. However, the old domain is still valid and still valuable for search engines. It is possible to redirect all existing urls to the new domain gracefully. For example, http://abc.com/node/8 to http://def.com/node/8. Whenever one tries to access http://abc.com/node/8, webbrowser will be automatically redirected to http://def.com/node/8. This behavior also applies to search engines.
The trick is to use mod_rewrite in Apache HTTP Server
- sugree's blog
- Add new comment
- Read more
- 2007 reads
Recent comments
3 years 29 weeks ago
3 years 34 weeks ago
3 years 35 weeks ago
3 years 35 weeks ago
3 years 36 weeks ago
3 years 38 weeks ago
3 years 38 weeks ago
3 years 38 weeks ago
3 years 38 weeks ago
3 years 38 weeks ago