当前位置: 首页>>代码示例>>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;未经允许,请勿转载。