本文整理汇总了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);
}
示例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>';