本文整理汇总了PHP中core\View::tpl方法的典型用法代码示例。如果您正苦于以下问题:PHP View::tpl方法的具体用法?PHP View::tpl怎么用?PHP View::tpl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类core\View
的用法示例。
在下文中一共展示了View::tpl方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addAction
function addAction()
{
if ($_POST) {
$post = $_POST['FORM'];
$post['status'] = Arr::get($_POST, 'status', 0);
$post['created_at'] = time();
if (!trim(Arr::get($post, 'name'))) {
Message::GetMessage(0, 'Поле "Название" не может быть пустым!');
} else {
$res = Common::insert($this->tablename, $post)->execute();
if ($res) {
Message::GetMessage(1, 'Вы успешно добавили данные!');
HTTP::redirect('backend/seo/' . Route::controller() . '/add');
} else {
Message::GetMessage(0, 'Не удалось добавить данные!');
}
}
$result = Arr::to_object($post);
} else {
$result = array();
}
$this->_toolbar = Widgets::get('Toolbar/Edit', array('list_link' => '/backend/seo/metrika/index'));
$this->_seo['h1'] = 'Добавление';
$this->_seo['title'] = 'Добавление';
$this->setBreadcrumbs('Добавление', 'backend/' . Route::controller() . '/add');
$this->_content = View::tpl(array('obj' => $result, 'tpl_folder' => $this->tpl_folder, 'tablename' => $this->tablename), $this->tpl_folder . '/Form');
}
示例2: innerAction
public function innerAction()
{
$this->_template = 'CatalogItemsWithoutFilter';
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Check for existance
$brand = DB::select()->from('brands')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->as_object()->execute()->current();
if (!$brand) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $brand->h1;
$this->_seo['title'] = $brand->title;
$this->_seo['keywords'] = $brand->keywords;
$this->_seo['description'] = $brand->description;
$this->setBreadcrumbs($brand->name);
// Get count items per page
$limit = (int) Arr::get($_GET, 'per_page') ? (int) Arr::get($_GET, 'per_page') : Config::get('limit');
// Get sort type
$sort = in_array(Arr::get($_GET, 'sort'), array('name', 'created_at', 'cost')) ? Arr::get($_GET, 'sort') : 'sort';
$type = in_array(strtolower(Arr::get($_GET, 'type')), array('asc', 'desc')) ? strtoupper(Arr::get($_GET, 'type')) : 'ASC';
// Get popular items
$result = DB::select(array('catalog_images.image', 'image'), 'catalog.*')->from('catalog')->join('catalog_images', 'LEFT')->on('catalog_images.catalog_id', '=', 'catalog.id')->on('catalog_images.main', '=', DB::expr('1'))->where('catalog.brand_id', '=', $brand->id)->where('catalog.status', '=', 1)->order_by('catalog.' . $sort, $type)->limit($limit)->offset(($page - 1) * $limit)->as_object()->execute();
// Set description of the brand to show it above the sort part
Config::set('brand_description', View::tpl(array('brand' => $brand), 'Brands/Inner'));
// Count of parent groups
$count = DB::select(array(DB::expr('COUNT(catalog.id)'), 'count'))->from('catalog')->where('brand_id', '=', $brand->id)->where('status', '=', 1)->as_object()->execute()->current()->count;
// Generate pagination
$pager = Pager::factory($page, $count, $limit)->create();
// Render template
$this->_content = View::tpl(array('result' => $result, 'pager' => $pager), 'Catalog/ItemsList');
}
示例3: indexAction
public function indexAction()
{
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Seo
$this->_seo['h1'] = 'Карта сайта';
$this->_seo['title'] = 'Карта сайта';
$this->_seo['keywords'] = 'Карта сайта';
$this->_seo['description'] = 'Карта сайта';
$this->setBreadcrumbs('Карта сайта');
// Get pages
$result = DB::select()->from('content')->where('status', '=', 1)->order_by('sort')->as_object()->execute();
$pages = array();
foreach ($result as $obj) {
$pages[$obj->parent_id][] = $obj;
}
// Get catalog groups
$result = DB::select()->from('catalog_tree')->where('status', '=', 1)->order_by('sort')->as_object()->execute();
$groups = array();
foreach ($result as $obj) {
$groups[$obj->parent_id][] = $obj;
}
// Get catalog groups
$brands = DB::select()->from('brands')->where('status', '=', 1)->order_by('sort')->as_object()->execute();
// Get news
$news = DB::select()->from('news')->where('status', '=', 1)->order_by('date', 'DESC')->as_object()->execute();
// Get articles
$articles = DB::select()->from('articles')->where('status', '=', 1)->order_by('id', 'DESC')->as_object()->execute();
// Render page
$this->_content = View::tpl(array('pages' => $pages, 'groups' => $groups, 'news' => $news, 'articles' => $articles, 'brands' => $brands), 'Sitemap/Index');
}
示例4: indexAction
function indexAction()
{
$date_s = NULL;
$date_po = NULL;
if (Arr::get($_GET, 'date_s')) {
$date_s = strtotime(Arr::get($_GET, 'date_s'));
}
if (Arr::get($_GET, 'date_po')) {
$date_po = strtotime(Arr::get($_GET, 'date_po'));
}
$page = (int) Route::param('page') ? (int) Route::param('page') : 1;
$count = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from($this->tablename);
if ($date_s) {
$count->where('created_at', '>=', $date_s);
}
if ($date_po) {
$count->where('created_at', '<=', $date_po + 24 * 60 * 60 - 1);
}
$count = $count->count_all();
$result = DB::select()->from($this->tablename);
if ($date_s) {
$result->where('created_at', '>=', $date_s);
}
if ($date_po) {
$result->where('created_at', '<=', $date_po + 24 * 60 * 60 - 1);
}
$result = $result->order_by('created_at', 'DESC')->limit($this->limit)->offset(($page - 1) * $this->limit)->find_all();
$pager = Pager::factory($page, $count, $this->limit)->create();
$this->_toolbar = Widgets::get('Toolbar/List');
$this->_content = View::tpl(array('result' => $result, 'tpl_folder' => $this->tpl_folder, 'tablename' => $this->tablename, 'count' => DB::select(array(DB::expr('COUNT(id)'), 'count'))->from($this->tablename)->count_all(), 'pager' => $pager, 'pageName' => 'Лента событий'), $this->tpl_folder . '/Index');
}
示例5: indexAction
public function indexAction()
{
$this->_template = 'CatalogItemsWithoutFilter';
$page = !(int) Route::param('page') ? 1 : (int) Route::param('page');
// Seo
$this->_seo['h1'] = 'Поиск';
$this->_seo['title'] = 'Поиск';
$this->_seo['keywords'] = 'Поиск';
$this->_seo['description'] = 'Поиск';
$this->setBreadcrumbs('Поиск');
// Check query
$query = Arr::get($_GET, 'query');
if (!$query) {
return $this->_content = $this->noResults();
}
// Get count items per page
$limit = (int) Arr::get($_GET, 'per_page') ? (int) Arr::get($_GET, 'per_page') : conf::get('limit');
// Get sort type
$sort = in_array(Arr::get($_GET, 'sort'), array('name', 'created_at', 'cost')) ? Arr::get($_GET, 'sort') : 'sort';
$type = in_array(strtolower(Arr::get($_GET, 'type')), array('asc', 'desc')) ? strtoupper(Arr::get($_GET, 'type')) : 'ASC';
// Get items list
$result = DB::select(array('catalog_images.image', 'image'), 'catalog.*')->from('catalog')->join('catalog_images', 'LEFT')->on('catalog_images.catalog_id', '=', 'catalog.id')->on('catalog_images.main', '=', DB::expr('1'))->or_where_open()->or_where('catalog.name', 'LIKE', DB::expr('"%' . $query . '%"'))->or_where('catalog.artikul', 'LIKE', DB::expr('"%' . $query . '%"'))->or_where_close()->where('catalog.status', '=', 1)->order_by('catalog.' . $sort, $type)->limit($limit, ($page - 1) * $limit)->as_object()->execute();
// Check for empty list
if (!count($result)) {
return $this->_content = $this->noResults();
}
// Count of parent groups
$count = DB::select(array(DB::expr('COUNT(catalog.id)'), 'count'))->from('catalog')->or_where_open()->or_where('catalog.name', 'LIKE', DB::expr('"%' . $query . '%"'))->or_where('catalog.artikul', 'LIKE', DB::expr('"%' . $query . '%"'))->or_where_close()->where('catalog.status', '=', 1)->as_object()->execute()->current()->count;
// Generate pagination
$pager = Pager::factory($page, $count, $limit)->create();
// Render page
$this->_content = View::tpl(array('result' => $result, 'pager' => $pager), 'Catalog/ItemsList');
}
示例6: indexAction
public function indexAction()
{
// Seo
$this->_seo['h1'] = 'Корзина';
$this->_seo['title'] = 'Корзина';
$this->_seo['keywords'] = 'Корзина';
$this->_seo['description'] = 'Корзина';
// Get cart items
$cart = C::factory()->get_list_for_basket();
// Render template
$this->_content = View::tpl(array('cart' => $cart, 'payment' => Config::get('order.payment'), 'delivery' => Config::get('order.delivery')), 'Cart/Index');
}
示例7: editAction
function editAction()
{
if ($_POST) {
foreach ($_POST['FORM'] as $key => $value) {
$res = Common::update($this->tablename, array('zna' => $value))->where('id', '=', $key)->execute();
}
Message::GetMessage(1, 'Вы успешно изменили данные!');
HTTP::redirect('backend/' . Route::controller() . '/edit');
}
$result = DB::select()->from($this->tablename)->where('status', '=', 1)->order_by('sort')->find_all();
$this->_toolbar = Widgets::get('Toolbar/EditSaveOnly');
$this->_content = View::tpl(array('result' => $result, 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/Edit');
}
示例8: render
private function render()
{
if (Config::get('error')) {
$this->_template = '404';
}
$this->_breadcrumbs = HTML::breadcrumbs($this->_breadcrumbs);
$data = array();
foreach ($this as $key => $value) {
$data[$key] = $value;
}
echo View::tpl($data, $this->_template);
echo System::global_massage();
}
示例9: indexAction
function indexAction()
{
$this->_seo['h1'] = 'Панель управления';
$this->_seo['title'] = 'Панель управления';
$count_catalog = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('catalog')->count_all();
$count_orders = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('orders')->count_all();
$count_comments = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('catalog_comments')->count_all();
$count_subscribers = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('subscribers')->count_all();
$count_users = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('users')->where('role_id', '!=', 2)->count_all();
$count_banners = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('banners')->count_all();
$count_articles = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('articles')->count_all();
$count_news = DB::select(array(DB::expr('COUNT(id)'), 'count'))->from('news')->count_all();
$this->_content = View::tpl(array('count_catalog' => $count_catalog, 'count_orders' => $count_orders, 'count_comments' => $count_comments, 'count_subscribers' => $count_subscribers, 'count_users' => $count_users, 'count_banners' => $count_banners, 'count_articles' => $count_articles, 'count_news' => $count_news), 'Index/Main');
}
示例10: indexAction
public function indexAction()
{
// Check for existance
$page = DB::select('h1', 'title', 'keywords', 'description', 'text', 'name')->from('control')->where('alias', '=', 'contact')->as_object()->execute()->current();
if (!$page) {
return conf::error();
}
// Seo
$this->_seo['h1'] = $page->h1;
$this->_seo['title'] = $page->title;
$this->_seo['keywords'] = $page->keywords;
$this->_seo['description'] = $page->description;
$this->setBreadcrumbs($page->name);
// Render template
$this->_content = View::tpl(array('text' => $page->text, 'kids' => array()), 'Contact/Index');
}
示例11: innerAction
public function innerAction()
{
Config::set('content_class', 'new_block');
// Check for existance
$obj = DB::select()->from('articles')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->find();
if (!$obj) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $obj->h1;
$this->_seo['title'] = $obj->title;
$this->_seo['keywords'] = $obj->keywords;
$this->_seo['description'] = $obj->description;
$this->setBreadcrumbs($obj->name);
// Add plus one to views
DB::update('articles')->set(array('views' => $obj->views + 1))->where('id', '=', $obj->id)->execute();
// Render template
$this->_content = View::tpl(array('obj' => $obj), 'Articles/Inner');
}
示例12: indexAction
public function indexAction()
{
// Get item information from database
$item = DB::select('catalog.*', array('brands.name', 'brand_name'), array('brands.alias', 'brand_alias'), array('models.name', 'model_name'), array('catalog_tree.name', 'parent_name'))->from('catalog')->join('catalog_tree', 'LEFT')->on('catalog.parent_id', '=', 'catalog_tree.id')->join('brands', 'LEFT')->on('catalog.brand_id', '=', 'brands.id')->on('brands.status', '=', DB::expr('1'))->join('models', 'LEFT')->on('catalog.model_id', '=', 'models.id')->on('models.status', '=', DB::expr('1'))->where('catalog.status', '=', 1)->where('catalog.alias', '=', Route::param('alias'))->as_object()->execute()->current();
if (!$item) {
return Config::error();
}
Route::factory()->setParam('id', $item->id);
Route::factory()->setParam('group', $item->parent_id);
// Add to cookie viewed list
Catalog::factory()->addViewed($item->id);
// Add plus one to views
DB::update('catalog')->set(array('views' => (int) $item->views + 1))->where('id', '=', $item->id)->execute();
// Seo
$this->setSeoForItem($item);
// Get images
$images = DB::select('image')->from('catalog_images')->where('catalog_id', '=', $item->id)->order_by('sort')->as_object()->execute();
// Get item sizes
$sizes = DB::select('sizes.*')->from('sizes')->join('catalog_sizes', 'LEFT')->on('catalog_sizes.size_id', '=', 'sizes.id')->where('catalog_sizes.catalog_id', '=', $item->id)->where('sizes.status', '=', 1)->order_by('sizes.name')->as_object()->execute();
// Get current item specifications list
$specifications = DB::select('specifications.*')->from('specifications')->join('catalog_tree_specifications', 'LEFT')->on('catalog_tree_specifications.specification_id', '=', 'specifications.id')->where('catalog_tree_specifications.catalog_tree_id', '=', $item->parent_id)->where('specifications.status', '=', 1)->order_by('specifications.name')->as_object()->execute();
$res = DB::select()->from('specifications_values')->join('catalog_specifications_values', 'LEFT')->on('catalog_specifications_values.specification_value_id', '=', 'specifications_values.id')->where('catalog_specifications_values.catalog_id', '=', $item->id)->where('status', '=', 1)->where('catalog_specifications_values.specification_value_id', '!=', 0)->as_object()->execute();
$specValues = array();
foreach ($res as $obj) {
$specValues[$obj->specification_id][] = $obj;
}
$spec = array();
foreach ($specifications as $obj) {
if (isset($specValues[$obj->id]) and is_array($specValues[$obj->id]) and count($specValues[$obj->id])) {
if ($obj->type_id == 3) {
$spec[$obj->name] = '';
foreach ($specValues[$obj->id] as $o) {
$spec[$obj->name] .= $o->name . ', ';
}
$spec[$obj->name] = substr($spec[$obj->name], 0, -2);
} else {
$spec[$obj->name] = $specValues[$obj->id][0]->name;
}
}
}
// Render template
$this->_content = View::tpl(array('obj' => $item, 'images' => $images, 'sizes' => $sizes, 'specifications' => $spec), 'Catalog/Item');
}
示例13: innerAction
function innerAction()
{
if (User::info()->role_id != 2 && User::info()->id != Route::param('id')) {
$this->no_access();
}
// Select current user
$organizer = Model::getOrganizerById(Route::param('id'), 1);
if (!$organizer) {
$this->no_access();
}
$this->_seo['h1'] = 'Отчет организатора: ' . $organizer->name;
$this->_seo['title'] = 'Отчет организатора: ' . $organizer->name;
$this->setBreadcrumbs('Отчет организатора: ' . $organizer->name);
// Set filter vars
$date_s = NULL;
$date_po = NULL;
$eventId = null;
$status = null;
if (Arr::get($_GET, 'date_s')) {
$date_s = strtotime(Arr::get($_GET, 'date_s'));
}
if (Arr::get($_GET, 'date_po')) {
$date_po = strtotime(Arr::get($_GET, 'date_po'));
}
if (Arr::get($_GET, 'event') != 0) {
$eventId = Arr::get($_GET, 'event');
}
if (Arr::get($_GET, 'status') != 'null') {
$status = Arr::get($_GET, 'status');
}
$filter = array('date_s' => $date_s, 'date_po' => $date_po, 'status' => $status, 'event_id' => $eventId, 'organizer_id' => $organizer->id, 'order' => array('created_at', 'DESC'));
$posters = Model::getPosters($filter);
// Make array with all need data
$result = array();
foreach ($posters as $poster) {
$result[$poster->id]['poster'] = $poster;
$result[$poster->id]['detailed'] = Model::getDetailed($poster);
}
// Rendering
$this->_content = View::tpl(array('result' => $result, 'pay_statuses' => $this->pay_statuses, 'events' => DB::select()->from('afisha')->where('place_id', 'IS NOT', null)->where('organizer_id', '=', $organizer->id)->find_all(), 'tpl_folder' => $this->tpl_folder), $this->tpl_folder . '/Inner');
}
示例14: indexAction
public function indexAction()
{
// Check for existance
$page = DB::select()->from('content')->where('alias', '=', Route::param('alias'))->where('status', '=', 1)->as_object()->execute()->current();
if (!$page) {
return Config::error();
}
// Seo
$this->_seo['h1'] = $page->h1;
$this->_seo['title'] = $page->title;
$this->_seo['keywords'] = $page->keywords;
$this->_seo['description'] = $page->description;
$this->generateParentBreadcrumbs($page->parent_id, 'content', 'parent_id');
$this->setBreadcrumbs($page->name);
// Add plus one to views
DB::update('content')->set(array('views' => $page->views + 1))->where('id', '=', $page->id)->execute();
// Get content page children
$kids = DB::select()->from('content')->where('status', '=', 1)->where('parent_id', '=', $page->id)->order_by('sort', 'ASC')->as_object()->execute();
// Render template
$this->_content = View::tpl(array('text' => $page->text, 'kids' => $kids), 'Content/Page');
}
示例15: indexAction
public function indexAction()
{
// Seo
$this->_seo['h1'] = 'Оплата';
$this->_seo['title'] = 'Оплата';
$this->_seo['keywords'] = 'Оплата';
$this->_seo['description'] = 'Оплата';
// Check
$order = DB::select()->from('afisha_orders')->where('id', '=', (int) Route::param('id'))->find();
if (!$order) {
return Config::error();
}
$afisha = DB::select()->from('afisha')->where('id', '=', $order->afisha_id)->find();
$amount = 0;
$prices = DB::select()->from('prices')->where('afisha_id', '=', $afisha->id)->find_all();
if (count($prices)) {
$pricesId = array();
foreach ($prices as $key => $value) {
$pricesId[] = $value->id;
}
$seats = DB::select('prices.price')->from('seats')->join('prices', 'LEFT')->on('prices.id', '=', 'seats.price_id')->where('price_id', 'IN', $pricesId)->where('view_key', 'IN', array_filter(explode(',', $order->seats_keys)))->find_all();
if (count($seats)) {
foreach ($seats as $key => $value) {
$amount += $value->price;
}
}
}
$percent = Config::get('liq_pay_percent');
if ($percent > 0) {
$amount = $amount + $amount / 100 * $percent;
}
$dataArr = array('version' => 3, 'public_key' => Config::get('public_key'), 'amount' => $amount, 'currency' => 'UAH', 'description' => 'Оплата за покупку мест на мероприятии: ' . $afisha->name, 'order_id' => $order->id . time(), 'result_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/payment/end/' . $order->id, 'server_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/payment/end/' . $order->id, 'language' => 'ru');
$data = base64_encode(json_encode($dataArr));
$privateKey = Config::get('private_key');
$signature = base64_encode(sha1($privateKey . $data . $privateKey, 1));
// Render template
$this->_content = View::tpl(array('data' => $data, 'signature' => $signature), 'Payment/Link');
}