2014年3月2日 星期日

Drupal文章內容中增加超連結的CODE


這個例子是將超連結到存放zip檔的位置。
1.在文字格式選擇PHP CODE,且要可以在文字格式選擇PHP CODE要先開啟PHP Filter項目。

2.在編輯欄中輸入底下的CODE:
<?php
//抓目前的node id
$path= $_SERVER ['REQUEST_URI'];
$node_path = explode('/', drupal_get_normal_path($path));
$nodex=$node_path[3];
$nodex1=explode('?', $nodex);
//公用檔案存放路徑
$file_public_path=variable_get('file_public_path', conf_path() . '/files');
//ZIP檔存放路徑
$unzip_file_path=$file_public_path . '/unzipfiles/';
//第二層目錄
$sub_temppath=explode('/',$_SERVER['PHP_SELF']);
$sub_path=$sub_temppath[1]
;//組合第一層目錄+第二層目錄
$url='http://'.$_SERVER['HTTP_HOST'].'/'.$sub_path;
//顯示目前組合之超連結
echo '<a href=\''.$url.'/'. $unzip_file_path.$nodex1[0]. '/index.html\' target=\'_new\' >文件連結</a>';
?>

Drupal增加角色的方法圖示


Drupal 安裝pclzip module的步驟

  1. 先安裝Libraries API  http://drupal.org/project/libraries 
  2. 在Drupal中Enable Libraries Module
  3. 安裝pclzip 模組時要去download兩個東西。一個是pclzip的核心程式 pclzip.lib.php(http://www.phpconcept.net/pclzip/pclzip-downloads)下載最新版本(目前是2.8.2版)
  4.           另外一個是在Drupal用的module(http://drupal.org/project/pclzip)下載(pclzip-7.x-1.x-dev.tar.gz)
  5. 在Drupal網站路徑 sites/all/下新建一個libraries資料夾。如果是多網站環境下就是在 sites/all/<domain>/下新建一個libraries資料夾
  6. 在sites/all/libraries或是sites/all/<domain>/libraries資料夾內再建一個pclzip資料夾並把pclzip.lib.php放到此資料夾中。
  7. 在drupal中安裝pclzip-7.x-1.x-dev.tar.gz這個pclzip模組
  8. 修改pclzip.module file will be there in (pclzip module)
    Go to line# 79 - approx and replace the

    <?phpfunction pclzip_library_exists() {
     
    $pclzip_path = libraries_get_path('pclzip.lib.php');
      if (!
    is_file($pclzip_path)) {
       
    drupal_set_message(t('Could not find the PclZip library file : @pclzip_path', array('@pclzip_path' => $pclzip_path)), 'error');
        return
    FALSE;
      }
      return
    TRUE;
    }
    ?>
    WITH

    <?phpfunction pclzip_library_exists() {
     
    $pclzip_path = libraries_get_path('pclzip');
     
    $pclzip_path = $pclzip_path.'/pclzip.lib.php';
      if (!
    is_file($pclzip_path)) {
       
    drupal_set_message(t('Could not find the PclZip library file : @pclzip_path', array('@pclzip_path' => $pclzip_path)), 'error');
        return
    FALSE;
      }
      return
    TRUE;
    }
    ?>
  9. 在Drupal中Enable pclzip模組
  10. 一定要安裝Libraries API不然會出現miss libaries的錯誤。
補充作法:
Here if some one needs any help, you can use this as patch for now. I think the code that is written for now is wrong.
Do the following steps.
1- Download pclzip.lib.php
2- Create a folder named 'pclzip' inside your libraries folder (preferable - sites/all/libraries)
3- Copy pclzip.lib.php to sites/all/libraries/pclzip (folder) - the path might be diff you have created this folder else where
4- IMP and this is the patch.
Go to pclzip.module file will be there in (pclzip module)
Go to line# 79 - approx and replace the

<?phpfunction pclzip_library_exists() {
 
$pclzip_path = libraries_get_path('pclzip.lib.php');
  if (!
is_file($pclzip_path)) {
   
drupal_set_message(t('Could not find the PclZip library file : @pclzip_path', array('@pclzip_path' => $pclzip_path)), 'error');
    return
FALSE;
  }
  return
TRUE;
}
?>
WITH

<?phpfunction pclzip_library_exists() {
 
$pclzip_path = libraries_get_path('pclzip');
 
$pclzip_path = $pclzip_path.'/pclzip.lib.php';
  if (!
is_file($pclzip_path)) {
   
drupal_set_message(t('Could not find the PclZip library file : @pclzip_path', array('@pclzip_path' => $pclzip_path)), 'error');
    return
FALSE;
  }
  return
TRUE;
}
?>

Drupal PHP Filter

設定PHP Filter方法,可以參考下列影片


Drupal  7.17版本要使用PHP CODE的方法
1.在內容類型新增欄位時只能選到[長文字欄及摘要]
然後在下方的{文字格式}選擇[PHP CODE],這樣才能在編輯欄位裡輸入PHP碼。

或是
2.在新增區塊時在下方的{文字格式}選擇[PHP CODE]。這樣才能在[區塊內容]內輸入PHP碼。

2012年3月29日 星期四

Android app:Eatwhat 吃啥!

您有到了用餐時間,不知道要吃什麼或是想吃飯卻不知道該吃哪家店的情形嗎?來試試看這個Android app吧。當app取得您所在的位置,選擇好您想用餐的類型,只要搖一搖手機,搖一搖它就會依照設定的距離與推薦的個數來推薦附近的相關類型的店家喔。這裡的資訊全部都是Google地方資訊提供的。有可能會有關店的情形,建議您多選擇幾家當『U-BI』。

朋友可以下載來試試看。如果覺得不錯的話,請幫我點選下方廣告鼓勵鼓勵我一下,如有任何建議或是有問題的地方也歡迎跟我說喔,謝謝。

app名稱:Eatwhat 吃啥
下載網址:http://goo.gl/S8KjJ
QR code


Eatwhat 吃啥! 使用相關說明:

1.進入時畫面會自動抓取您目前所在位置。

2.點選下拉選單來選擇您要用餐的類型,選擇好後,搖晃一下您的手機(請小心搖晃,如果手機摔壞的話,小弟我不負責啊)。 下方會出現推薦的商家選項。您可以點選其中的選項來看此店家的資料(店名、電話、地址、地圖與評論)。


3.點選某一店家後就可以看到店家的地址、電話等資訊。




4.按下電話旁邊的,會顯示撥號介面,方便您與店家聯絡。





5.按下查看地圖,可以看到目前您所在的地點與此店家的行車路線圖。


6.按下.查看評論,會顯示此店家的Google地方資訊,提供您用餐的參考。

7.另外在使用時可以按下先按menu鍵設定一下『距離』與『推薦個數』,預設是『500公尺』與推薦個數為『1』個。







2012年1月12日 星期四

Android App_寶貝記錄


當Baby出生後,新手老爸會幫忙換尿布、餵奶等等的事情。但是有時事情一多時就會忘記什麼時候餵奶或是換尿布。所以就自己動手寫了一個簡單的app來記錄寶寶的吃奶跟換尿布的時間及一點小記錄。
以下是功能畫面:
1.小寶貝資訊主頁面

2.記錄哺乳資訊

3.記錄換尿布資訊

4.查詢哺乳與換尿布記錄

5.記錄樣式

有需要的朋友可以免費下載來試試看喔。
App下載網址:
http://goo.gl/b9v9T.qr

2011年8月5日 星期五

血液循環的重要 -- 人體的急劇衰老期


此文是朋友email給我的,為了要陪伴寶貝很久很久所以要努力作這10招囉。

十招動作,每天做20次, 一生受用無窮。(循序漸進, 每天規律作最重要, 量力而為) 
1
 



2
 


3 




4
 




5
 




6
 




7
 



8
 



9
 




10
 


人體50 ~ 59歲.....是急劇衰老期

為什麼?
血液循環對人體健康有重大影響,因為身體的器官組織均需要充裕的養分與足夠的氧才能正常運作,血液循環正是扮演輸送的角色,一旦血液循環差,器官組織得不到適當的補給,自然會功能下降。根據研究,人體的血液循環,尤其是微循環系統會隨著年齡增加而逐漸功能減緩。

而50~59歲的人該如何做健康準備 ? 要先建立防衰老的準備,減少不必要的應酬,避開容易影響健康的刺激性行為,飲食求清淡規律,不過度勞累,不加重生理與心理的負擔。
30-40
歲下降一坡,40~49歲再下降一坡,50~ 59歲則會有明顯的退化表現,通常50歲以上的人容易感覺體力大不如前,容易勞累。如果50~59歲還未能及時調整生活方式,那麼到了60~69歲所有病號便紛紛出籠。
據臨床統計,60~69歲是各種疾病發病的高峰期,如高血壓、糖尿病、動脈硬化、冠心病、白內障、慢性支氣管炎及癌症等疾病,最容易在這個年齡層發生,而其中大部分的人在45歲前都是非常健康的。

如果
50歲以後人體便衰竭下去,那麼50歲以後的人生也未免太無色彩了吧!其實人體在70歲之後,身體又將趨於正常,衰老現象趨於平緩。
換句話說,如果50~59歲能善加保養,降低身體機能老化程度,有助避開60~69歲的疾病危險期。到了70之後便可以真正健康有活力地享受「人生七十才開始」的生活,且延年益壽。