2014年6月25日 星期三

在Drupal Views裡如何用一個條件去篩選n個欄位的值

在Drupal Views裡如果要用一個條件去篩選n個欄位的值要怎麼做勒

步驟如下
1.「FILTER CRITERIA點選『新增』(add)。
2. 在Add filter criteria頁面中使用搜尋欄位搜尋[ global ]。如下圖所示:


3.勾選Global: Combine fields filter選項。並按下方的Apply(all display)。

4.進入Configure filter criterion: Global: Combine fields filter頁面先勾選Expose this filter to visitors, to allow them to change it選項



5.輸入標籤(你想顯示在畫面上的文字)

6.下拉選擇『Operator』運算式。這有很多Operator如 is equal to(等於)、is not equal to(不等於)、Contains(包含)、Start with(起始於)等等......。本例是選擇Contains(包含)。

7.Value不填寫。但在Choose fields to combine for filtering項目中選擇要合併篩選的欄位。可以按著shift鍵來選擇多個項目。(注意:這些選擇的欄位必須是在FIELDS裡面有的欄位。)完成圖如下:



8.按下Apply(this display)鍵將設定結果起來。準備測試~

9.測試結果如果沒有問題的話記得將views儲存起來喔。


2014年6月20日 星期五

Android App 增加擴充檔案的方法

Android App 增加擴充檔案的方法

1.登入Google Play Developer Console 
2.選擇要上傳的應用程式
3.選擇階段並上傳APK檔案
選擇上傳新的APK檔


4.上傳檔案後,會出現這個畫面。下拉使用擴充程式檔,選擇上傳新檔案。然後選擇要上傳的zip檔案(就是把你另外的檔案用zip壓縮起來,就可以了。)
選擇上傳擴充程式檔

5.然後要當成擴充程式檔的zip就會上傳到google play 主機上去了。
上傳擴充程式檔中

6.上傳完畢後就會顯示新的程式擴充檔的檔名。接下來就可以點選下方的『立即發佈...』的按鈕將應用程式發佈出去。
顯示擴充程式檔的系統用之檔名

7.最後就是要等幾個小時,應用程式才會生效。才能在 Google Play Store找到。



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』個。