protected function renderContent() { yii::beginProfile('loc'); $session = new CHttpSession(); $session->open(); $newCountry = $this->newCountry ? $this->newCountry : ($session['top-country'] ? $session['top-country'] : $this->defaultCountry); $session['top-country'] = $newCountry; $newCity = $this->newCity ? $this->newCity : ($session['top-city'] ? $session['top-city'] : $this->defaultCity); $session['top-location'] = $newCity; if ($newCountry == "international") { $country = 'international'; $city = GeoCityApi::getCityByName($newCity); if ($city) { $cities = GeoCityApi::getTopPrioritiesInternational($city->id); } else { $cities = GeoCityApi::getTopPrioritiesInternational(); } } else { $country = GeoCountryApi::getCountryByName($newCountry); $city = GeoCityApi::getCityByName($newCity); if ($country && $city) { $cities = GeoCityApi::getTopPrioritiesByCountry($country->id, $city->id); } elseif ($country) { $cities = GeoCityApi::getTopPrioritiesByCountry($country->id); } } if ($country && $cities) { $this->render('topLocation', array('city' => $city, 'country' => $country, 'current' => $this->current, 'cities' => $cities)); } yii::endProfile('loc'); }
protected function renderContent() { yii::beginProfile('top-cities'); $country = GeoCountryApi::getCountryByName($this->country); $cities = GeoCityApi::getTopPrioritiesByCountry($country->id); $this->render('topCities', array('cities' => $cities)); yii::endProfile('top-cities'); }
<?php /** * Created by PhpStorm. * User: x.guo * Date: 2016/4/4 * Time: 18:18 */ use yii\helpers\Html; use yii\helpers\Url; use yii\widgets\Menu; use yii\widgets\Breadcrumbs; use frontend\assets\FrontendAsset; yii::beginProfile('mainAsset', 'gx'); FrontendAsset::register($this); yii::endProfile('mainAsset', 'gx'); $this->title = 'admin'; $baseUrl = Yii::getAlias('@web'); ?> <?php $this->beginPage(); ?> <!DOCTYPE html> <html lang="<?php echo Yii::$app->language; ?> "> <head>