Skip to content

Instantly share code, notes, and snippets.

<?php
date_default_timezone_set('Europe/Moscow');
class Deploy {
/**
* A callback function to call after the deploy has finished.
*
* @var callback
source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Админка
gem 'rails_admin', :git => 'git://github.com/sferik/rails_admin.git'
# Пагинация
gem 'kaminari'
# Хлебные крошки
<!-- write message -->
<?php
$style = "display:none";
if(Yii::app()->controller->action->id == 'errorsending') {
$style = "";
if(CHtml::errorSummary($seller_model)){?>
<div class="error_explanation">
<?php echo CHtml::errorSummary($seller_model, '');?>
public function actionSection($section)
{
$model = Section::model()->findByAttributes(array('vis'=>'1'),
"url_alias=:section",
array(":section"=>$section));
if(!$model || $model->pid){
throw new CHttpException(404);
}
Controller::$current_section = $model->id;
public function actionSearch()
{
if(!empty($_GET['search_text']) && is_array($_GET)) {
$condition = "";
$search_text = urldecode($_GET['search_text']);
$words = explode(" ", $search_text);
$total_words = count($words);
<?php
class SitemapController extends Controller
{
private $site_url = "http://www.kluch-kmv.ru";
public function actionIndex()
{
$sitemap = '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$data = '
<url>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html" xmlns="http://www.w3.org/1999/html">
<head>
<title>Zikkurat</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="css/nivo-slider.css">
<link rel="stylesheet" type="text/css" href="css/anythingslider.css">
<link rel="stylesheet" type="text/css" href="css/themes/default/default.css">
<link rel="stylesheet" type="text/css" href="css/jcarousel/tango/skin.css">
public function uploadImages($images, $id, $description=false)
{
$path = $_SERVER['DOCUMENT_ROOT'].Yii::app()->urlManager->baseUrl.'/content/realty/';
$i = 0;
foreach ($images as $image => $pic) {
$image_name = md5(time().$pic.$i);
$i++;
CONTROLLER
public function actionCreate()
{
$this->pageTitle = "Недвижимость";
$model = new Realty();
$realty_images = new RealtyImage();
$sections = Section::model()->findAll('type=4');
$sections_list = CHtml::listData($sections, 'id', 'name');