drupal 路径归纳

1. $base_url: 是globals.php文件里定义的全局变量,返回访问网站的根目录, 详见http://api.drupal.org/api/drupal/developer%21globals.php/global/base_url/7
注:$base_url 返回的路径后面不带/,所以在拼接url的时候要注意加上,如:
$link = $base_url . '/node/add';

2. drupal_get_path('module', 'custom')

current theme

frontend default theme
$theme_path = drupal_get_path('theme', variable_get('theme_default', NULL));

git tips

1. Branch
先pull一下,然后使用git branch -r查看新建的分支是否在了,然后用如下命令
git branch --track xxx origin/xxx
这个是把origin里的内容放到本地环境,这样就能用git branch直接看到,并修改

2. Ignore
git update-index --assume-unchanged .gitignore

git clean -n -d

Great tutorial for php composer

Composer is a dependency manager tracking local dependencies of your projects and libraries.

Official link: http://getcomposer.org/doc/

Tutsplus tutorial: http://wunderkraut.com/blog/how-to-create-a-patch-for-a-drupal-module/20...

Great video tutorial from youtube, and it shows exactly how composer works with drupal, have fun with her :)

5 methods to tell a site built with drupal

1. view souce
2. Try to access certain files
3. Visit the User URLs
4. Use websites

5. Expires header

wget -S https://drupal.org | grep "^Expires"

Why Integer instead of datetime in mysql

A MySQL datetime field is quite difficult to manipulate. If you want to do anything with it, you need to either run SQL with datetime functions, which can become quite complex, or retrieve the records and then use PHP code to convert the data. On the other hand, a unix timestamp is just a number, so selections are quick, it easy to do comparisons, etc. Furthermore, Datetime is stored as a string, which takes up more space than an int, and querying is slower, as most RDBMS engines index int's a lot more efficient. And a final concern is portability.