以下是最近工作中總結的幾個Drupal小問題,Drupal性能模塊之簡明分析對比,實現view動態輸出的步驟方法,為Drupal主題添加主題內自帶圖片的正確方法。其中第一個是在網上找到的翻譯國外內容,這此感謝這些默默翻譯的高手。
Drupal性能模塊的簡明分析對比
原文:
Varnish
We explored various caching solutions available for Drupal. We shortlisted Varnish, Boost and Authcache modules. We performed a number of tests using these modules. We tested over 1000 pages from different locations. The average page load time without any caching was above 4.0 seconds. The average page load time with Drupal's default caching was 2.5 seconds. The average page load time with the Authcache module was reduced to 1.8 seconds. The average page load time with the Boost module was 1.7 seconds. The average page load time with Varnish module was 1.5 seconds. Therefore we preferred using the Varnish module. These stats are for this site only, the results may vary for other sites.
我簡單翻譯下:
用1000個不同的頁面作的測試,
1.不用任何緩存模塊:平均加載時間4秒以上;
2.使用drupal自帶緩存:平均加載時間2.5秒;
3.使用Authcache模塊,平均加載時間1.8秒;
4.使用Boost模塊,平均加載時間1.7秒;
5.使用Varnish模塊,平均加載時間1.5秒;
實現view動態輸出的步驟方法:
1、在 view 的屬性頁,選擇 header
2、選擇 Global:Text area
3、在彈出框里,覆寫 輸出
4、只有Replacement patterns 顯示出來的字段,才能被調用
5、注意勾選 *Use replacement tokens from the first row
為Drupal主題添加主題內自帶圖片的正確方法
在為drupal的主題添加主題自帶的一些圖片的時候,會碰到一些路徑問題,使用下面這些方法添加的圖片,才能正確顯示在頁面上:
<img src="<?php print $base_path . drupal_get_path('theme', 'yourtheme');?>/image/act-title.jpg">
在php標簽里面輸出url的時候要使用 $base_path 與 主題路徑拼接出來的url 然后再加上主題目錄里面的靜態圖片的路徑,才能正確的顯示.
新聞熱點
疑難解答