當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Countries::getAll方法代碼示例

本文整理匯總了PHP中Countries::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Countries::getAll方法的具體用法?PHP Countries::getAll怎麽用?PHP Countries::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Countries的用法示例。


在下文中一共展示了Countries::getAll方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: searchjsonAction

 public function searchjsonAction()
 {
     $keyword = strtolower($this->getRequest()->getParam('term'));
     $numOfItem = (int) Zend_Registry::get('Setting')->autocomplete_limit;
     if ($numOfItem > 0) {
         list($Pager, $aRespon['cities']) = City::getAll(array('LOWER(city_id) || LOWER(tags) LIKE ?' => "%{$keyword}%"), 1, $numOfItem);
         $numOfItem = $numOfItem - $Pager->getNumResults();
     }
     if ($numOfItem > 0) {
         //Search countries three
         $aRespon['countries'] = Countries::getAll(array('LOWER(countries_id) LIKE ? OR  LOWER(tags) LIKE ?' => array("%{$keyword}%", "%{$keyword}%")), $numOfItem);
         $numOfItem = $numOfItem - count($aRespon['countries']);
     }
     header('Content-Type: text/html; charset=iso-8859-1');
     $search = ucwords($keyword);
     $keywords = array($keyword, $search, ucfirst(str_replace(' ', '', $keyword)), ucfirst(str_replace(' ', '', My_Plugin_Libs::unUnicode($keyword))));
     $response = array();
     $address = '';
     //rebuil to autocomplete struc
     foreach ($aRespon as $location => $data) {
         foreach ($data as $Obj) {
             $link = '';
             if ($location == 'cities') {
                 $label = $Obj->name . ', ' . $Obj->Countries->name;
                 $link = $Obj->getLink();
                 $country = $Obj->Countries->name;
             } elseif ($location == 'countries') {
                 $label = $Obj->name;
                 $link = $Obj->getLink();
                 $country = $Obj->name;
             } else {
                 $label = $Obj->name;
                 $link = $Obj->getLink();
                 $country = $Obj->Countries->name;
                 $address = $Obj->address;
             }
             $response[] = array('location' => $location, 'link' => $link, 'id' => $Obj->id, 'label' => str_replace($keywords, '<b>' . $search . '</b>', $label), 'value' => $label, 'country' => $country, 'address' => str_replace($keywords, '<b>' . $search . '</b>', $address));
         }
     }
     echo json_encode($response);
 }
開發者ID:hoaitn,項目名稱:base-zend,代碼行數:41,代碼來源:AjaxController.php

示例2: foreach

            <div class="input-group groups div-names">
                <span class="input-group-addon span-names">Еще раз пароль</span>
                <input type="password" id="pass_again" class="form-control"
                       placeholder="Введите еще раз пароль">
            </div>
            <div class="input-group groups div-names">
                <span class="input-group-addon span-names">Телефон</span>
                <input type="tel" id="phone" class="form-control" aria-describedby="basic-addon1"
                       placeholder="Введите номер телефона">
            </div>
            <div class="input-group groups div-names">
                <span class="input-group-addon span-names">Страна</span>
                <select id="country" class="form-control">
                    <option value='select'>Выберите страну</option>
                    <?php 
foreach ($countries->getAll() as $k => $v) {
    foreach ($v as $key => $value) {
        echo '<option value="' . $k . '">' . $value . '</option>';
    }
}
?>
                </select>
            </div>
            <div class="input-group groups div-names">
                <span class="input-group-addon span-names">Город</span>
                <select id="city" class="form-control">
                    <option value='select'>Выберите город</option>
                    <?php 
foreach ($cities->getCities() as $k => $v) {
    foreach ($v as $key => $value) {
        echo '<option value="' . $k . '">' . $value . '</option>';
開發者ID:VictorKaryaka,項目名稱:Registration-PHP-,代碼行數:31,代碼來源:index.php


注:本文中的Countries::getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。