当前位置: 首页>>代码示例>>PHP>>正文


PHP KTemplate::assign方法代码示例

本文整理汇总了PHP中KTemplate::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP KTemplate::assign方法的具体用法?PHP KTemplate::assign怎么用?PHP KTemplate::assign使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在KTemplate的用法示例。


在下文中一共展示了KTemplate::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 function get()
 {
     global $Permissions;
     global $sRequest;
     $tpl = new KTemplate();
     $_s = file_get_contents(__FILE__);
     $_s = substr($_s, strpos($_s, '?' . '>') + 2);
     $tpl->loadTemplateContent($_s);
     $sql = "SELECT * FROM `" . DB_PREFIX . DB_TBL_COMMENTS . "` WHERE `url`='" . $sRequest . "'";
     $sql = mysql_query($sql);
     if (false == $sql) {
         my_die();
     }
     $aList = array();
     while ($row = mysql_fetch_assoc($sql)) {
         $aList[] = $row;
     }
     //		dbg($aList);
     if (empty($aList)) {
         $tpl->assign('Comment', 'Нет комментариев');
     }
     foreach ($aList as $v) {
         $sql = "SELECT * FROM. `" . DB_PREFIX . DB_TBL_USERS . "` WHERE `id`=" . $v['user_id'];
         $sql = mysql_query($sql);
         if (false == $sql) {
             my_die();
         }
         $aUser = array();
         while ($row = mysql_fetch_assoc($sql)) {
             $aUser = $row;
         }
         //			dbg($aUser);
         $v = array_merge($v, $aUser);
         //			dbg($v);
         $tplComment = $tpl->fetchBlock('Comment');
         $tplComment->assign($v);
         $tpl->assign('Comment', $tplComment);
         $tplComment->reset();
     }
     if ($Permissions->bIsLogged()) {
         $tpl->assign('CommentForm', $tpl->fetchBlock('CommentForm'));
     } else {
         $tpl->assign('CommentForm', 'Войдите, чтобы оставить комментарий');
     }
     return $tpl->get();
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:46,代码来源:comments.php

示例2: int_block

function int_block($aArray, $sFileNameItemsTpl, $sEmpty = "пусто")
{
    //	Console::log($aArray);
    $tpl = new KTemplate(FLGR_ITEMS . '/int.htm');
    if (!isset($aArray['More'])) {
        $tpl->assign('More', '');
    } elseif (is_array($aArray['More'])) {
        foreach ($aArray['More'] as $k => $v) {
            $tplMore = $tpl->fetchBlock('More');
            $tplMore->assign('x_more', $k);
            $tplMore->assign('more', $v);
            $tpl->assign('More', $tplMore);
            $tplMore->reset();
        }
        unset($aArray['More']);
    }
    //	dbg($aArray['Items']);
    if (is_array($aArray['Items'])) {
        $tplItems = new KTemplate(FLGR_ITEMS . '/' . $sFileNameItemsTpl);
        //	dbg($tplItems);
        if (empty($aArray['Items'])) {
            $tplItems->assign('Item', $sEmpty . '<br /><br />');
        }
        foreach ($aArray['Items'] as $v) {
            $tplItem = $tplItems->fetchBlock('Item');
            //		dbg($v);
            $tplItem->assign($v);
            $tplItems->assign('Item', $tplItem);
            $tplItem->reset();
        }
        $tpl->assign('Items', $tplItems);
    } else {
        $tpl->assign('Items', $aArray['Items']);
    }
    if (!isset($aArray['count'])) {
        $aArray['count'] = count($aArray['Items']);
    }
    unset($aArray['Items']);
    $tpl->assign('info', '');
    $tpl->assign($aArray);
    return $tpl;
}
开发者ID:rigidus,项目名称:cobutilniki,代码行数:42,代码来源:int.php

示例3: OutResult

function OutResult($aAll)
{
    global $BreadCrumbs;
    global $_t;
    //	Console::log($aAll);
    // ADD_BREADCRUMBS
    $BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
    // BreadCrumbs
    $_t->assign('BreadCrumbs', $BreadCrumbs->get());
    // Css
    stylesheet('communication.css');
    // DopNav
    $_t->assign('DopNav', '');
    // OPEN
    $tpl = new KTemplate(FLGR_TEMPLATES . '/search.htm');
    // Item
    $tpl->assign('Item', int_list($aAll, '_user.htm'));
    // Count
    $tpl->assign('count', count($aAll));
    // CLOSE
    $_t->assign('ContentBlock', $tpl);
    $tpl->reset();
}
开发者ID:rigidus,项目名称:cobutilniki,代码行数:23,代码来源:!search.php

示例4: table

 function table()
 {
     $params = func_get_args();
     $table = array_shift($params);
     $acc = '';
     foreach ($params as $v) {
         $acc .= $v;
     }
     $acc = '<table>' . $acc . '</table>';
     $tpl = new KTemplate();
     $tpl->loadTemplateContent($acc);
     global $Db;
     if (!isset($this->id)) {
         return 'env error';
     }
     $sql = "SELECT * FROM `" . DB_PREFIX . $table . "` WHERE `id`= '" . $this->id . "'";
     $db_result = $Db->queryRow($sql);
     $tpl->assign($db_result);
     return $tpl->get();
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:20,代码来源:lisp.php

示例5: count

		<a href="#" onclick="ShowHide(\'write_wall\');" class="comment_new">
			написать
		</a>
	', 'info' => '
		<div id="write_wall" style="display: none;">
			<form method="post">
				<input type="hidden" name="act" value="write_wall" />
				<input type="hidden" name="user_id" value="' . $off . '" />
				<textarea name="message" rows="6" style="width: 90%; overflow-x: hidden;"></textarea>
				<input type="submit" value="Отправить" />
				<br />
				<br />
			</form>
		</div>
	', 'href' => "/walls/{$seg}/{$off}", 'Items' => $aWalls);
$tpl->assign('Wall', int_block($aArray, 'l_wall.htm'));
// OUT
// Выводим саму фотографию
$tpl->assign($aItem);
// Выводим ее порядковый номер и кол-во фотографий в альбоме
$aPhotos = ${$owner}->getPhotos($aOwner['id']);
$tpl->assign('count', count($aPhotos));
foreach ($aPhotos as $k => $v) {
    if ($v['id'] == $aItem['id']) {
        break;
    }
}
$tpl->assign('num', $k + 1);
// Выводим предыдущую и следующую фотографию в альбоме
$tpl->assign('Prew', '');
$tpl->assign('Next', '');
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:photo.php

示例6: VALUES

            $sql = "INSERT INTO `" . DB_PREFIX . DB_TBL_POSTS . "` ( \n\t\t\t\t`id`,\n\t\t\t\t`category`,\n\t\t\t\t`t`, \n\t\t\t\t`title`,\n\t\t\t\t`annotation`,\n\t\t\t\t`text`,\n\t\t\t\t`image`,\n\t\t\t\t`hidden`\n\t\t\t\t) VALUES (\t\t\t\t\n\t\t\t\t'',\n\t\t\t\t'" . $category . "',\n\t\t\t\t'" . mysql_escape_string($_POST['t']) . "',\n\t\t\t\t'" . mysql_escape_string($_POST['title']) . "',\n\t\t\t\t'" . mysql_escape_string($_POST['annotation']) . "',\n\t\t\t\t'" . mysql_escape_string($_POST['text']) . "',\n\t\t\t\t'" . mysql_escape_string($_POST['image']) . "',\n\t\t\t\t'" . mysql_escape_string($_POST['hidden']) . "'\n\t\t\t\t)";
            $sql = mysql_query($sql);
            if (false == $sql) {
                my_die();
            }
            header('Location: ' . $aCmsModules['newsadm']['key']);
            break;
    }
}
// load template
$tpl = new KTemplate(FLGR_CMS_TEMPLATES . '/' . $sModuleTpl . '.htm');
if (!defined('FCK')) {
    // TEXT
    $tplFck = $tpl->fetchBlock('text');
    $tplFck->assign($aParent);
    $tpl->assign('text', $tplFck);
    $tplFck->reset();
    unset($aParent['text']);
    // ANNOTATION
    if (!defined('PAGE_NO_ANNOTATION')) {
        $tplFck = $tpl->fetchBlock('annotation');
        $tplFck2 = $tplFck->fetchBlock('annotation');
        $tplFck2->assign($aParent);
        $tplFck->assign('annotation', $tplFck2);
        $tpl->assign('annotation', $tplFck);
        $tplFck->reset();
    } else {
        $tpl->assign('annotation', '');
    }
} else {
    // TEXT
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:news-add.php

示例7: switch

// CONTROLLER
if (isset($_POST['act'])) {
    //	dbg($_POST);
    switch ($_POST['act']) {
        case 'registration':
            if (isset($_POST['rules'])) {
                if (isset($_POST['18year'])) {
                    $acc = 'if (' . "\r\n";
                    foreach (current(parse(file_get_contents(FLGR_SCHEMES . '/registration.txt'))) as $v) {
                        if (is_array($v)) {
                            $acc .= '(!empty($_POST["values"]["' . $v[1] . '"])) &&' . "\r\n";
                        }
                    }
                    $acc = substr($acc, 0, strlen($acc) - 4) . "\r\n" . ') {
						$EnvUser->insert($_POST["values"]);
						$Permissions->login($_POST["values"]["login"], $_POST["values"]["password"]);
						header("Location: /user/");
						include_once(FLGR_COMMON."/exit.php");
					}';
                    dbg($acc, '-');
                    eval($acc);
                }
            }
            break;
        default:
            break;
    }
}
// OUT
$_t->assign('form', $view);
开发者ID:rigidus,项目名称:cobutilniki,代码行数:30,代码来源:registration.php

示例8: header

            break;
        case 'write_wall':
            $Walls->create($_POST['message'], 'user', $_POST['user_id']);
            //			header('Location: '.$_SERVER['REQUEST_URI']);
            break;
        case 'del_wall_message':
            //			dbg($_POST);
            $Walls->del($_POST['id']);
            header('Location: ' . $_SERVER['REQUEST_URI']);
            break;
        default:
            break;
    }
}
// Count
$tpl->assign('count', count($aItems));
// Item
//dbg($self);
$tplItem = new KTemplate(FLGR_ITEMS . "/_{$self}.htm");
if (empty($aItems)) {
    $tpl->assign('Item', 'нет элементов');
} else {
    $tpl->assign('Item', int_list($aItems, "_{$self}.htm"));
}
//foreach ($aItems as $v) {
//	$tplItem->assign($v);
//	$tpl->assign('Item', $tplItem->get());
//	$tplItem->reset();
//}
$_t->assign('DopNav', '');
if ($sModuleTpl == 'topics') {
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:collection.php

示例9: KTemplate

}
$aParent = mysql_fetch_assoc($sql);
if (empty($aParent)) {
    $_t->assign('content', '<span style="color: red">Ошибка:</span> Родительская страница не существует!');
    return;
}
foreach ($aParent as $k => $v) {
    $aParent[$k] = '';
}
// load template
$tpl = new KTemplate(FLGR_CMS_TEMPLATES . '/edit.htm');
if (!defined('FCK')) {
    // TEXT
    $tplFck = $tpl->fetchBlock('text');
    $tplFck->assign($aParent);
    $tpl->assign('text', $tplFck);
    $tplFck->reset();
    unset($aParent['text']);
    // ANNOTATION
    if (!defined('PAGE_NO_ANNOTATION')) {
        $tplFck = $tpl->fetchBlock('annotation');
        $tplFck2 = $tplFck->fetchBlock('annotation');
        $tplFck2->assign($aParent);
        $tplFck->assign('annotation', $tplFck2);
        $tpl->assign('annotation', $tplFck);
        $tplFck->reset();
        unset($aParent['text']);
    } else {
        unset($aParent['annotation']);
        $tpl->assign('annotation', '');
    }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:version-add.php

示例10: KTemplate

// BREADCRUMBS
$BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
if (!$bFlagLastModule) {
    return;
}
$_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());
// TEMPLATE
$tpl = new KTemplate();
$_s = file_get_contents(__FILE__);
$_s = substr($_s, strpos($_s, '?' . '>') + 2);
$tpl->loadTemplateContent($_s);
// Left
$tplSub = $tpl->fetchBlock('subfunctions');
$tplSub->assign('subst', $sRequest);
$tpl->assign('subfunctions', $tplSub);
// Right
$sql = "SELECT * FROM `" . DB_PREFIX . DB_TBL_USERS . "`";
$sql = mysql_query($sql);
if (false == $sql) {
    my_die();
}
$aAccounts = array();
while ($row = mysql_fetch_assoc($sql)) {
    $aAccounts[] = $row;
}
if (empty($aAccounts)) {
    $tpl->assign('content', 'Нет аккаунтов');
} else {
    $tplContent = $tpl->fetchBlock('content');
    foreach ($aAccounts as $k => $v) {
开发者ID:rigidus,项目名称:izverg,代码行数:30,代码来源:accounts.php

示例11: KTemplate

    }
}
// GET
$tpl = new KTemplate(FLGR_CMS_TEMPLATES . '/' . $sModuleName . '.htm');
$sql = 'SELECT * FROM `' . DB_PREFIX . DB_TBL_HOSTS . '` ';
$sql = mysql_query($sql);
if (false == $sql) {
    my_die();
}
$aList = array();
while ($row = mysql_fetch_assoc($sql)) {
    $aList[] = $row;
}
//dbg($aList);
if (empty($aList)) {
    $tpl->assign('Host', '<tr><td>Нет хостов</td></tr>');
} else {
    foreach ($aList as $v) {
        $tplHost = $tpl->fetchBlock('Host');
        $tplHost->assign($v);
        $tplHost->assign('to_host', $aCmsModules['rcon']['key']);
        if ($v['slave']) {
            $tplHost->assign('checked', 'checked');
        } else {
            $tplHost->assign('checked', '');
        }
        $tpl->assign('Host', $tplHost);
        $tplHost->reset();
    }
}
// OUT
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:hosts.php

示例12: microkernel

<?php

if ('' == $sModuleTpl) {
    my_die('Error: Template not found');
}
$sTpl = microkernel(FLGR_TEMPLATES . '/' . $sModuleTpl . '.htm');
$_t = new KTemplate();
$_t->loadTemplateContent($sTpl);
$_t->assign('content', crbr($sText));
开发者ID:rigidus,项目名称:cobutilniki,代码行数:9,代码来源:static.php

示例13: dbg

            break;
        case 'del_role':
            $Permissions->delRole($_POST['role']);
            break;
        case 'rename_role':
            $Permissions->renameRole($_POST['id'], $_POST['name']);
            break;
        default:
            dbg($_POST);
            break;
    }
}
// TEMPLATE
$tpl = new KTemplate(FLGR_CMS_TEMPLATES . '/' . $sModuleTpl . '.htm');
$aRoles = $Permissions->getAllRoles();
$tpl->assign('InRole', '');
$tpl->assign('Roles', '');
foreach ($aRoles as $v) {
    $tplRoles = $tpl->fetchBlock('Roles');
    $tplRoles->assign('subst', $aCmsModules['roles']['key']);
    $tplRoles->assign('del', $aCmsModules['role-del']['key']);
    $tplRoles->assign('id', $v['id']);
    $tplRoles->assign('name', $v['name']);
    $tplRoles->assign('cnt', '(' . count($Permissions->getUsersWithThisRole($v['id'])) . ')');
    if (isset($aRequest[$nLevel + 1]) && $aRequest[$nLevel + 1] == $v['id']) {
        $BreadCrumbs->addBreadCrumbs($v['id'], $v['name']);
        $tplRoles->assign('b', '<b>');
        $tplRoles->assign('/b', '</b>');
        $bFlag404 = false;
        $tplInRole = $tpl->fetchBlock('InRole');
        $tplInRole->assign('role', $v['name']);
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:roles.php

示例14: switch

// SET BREADCRUMBS
$BreadCrumbs->addBreadCrumbs($sKey, $sTitle);
// Если каталог не существует - выводим ошибку и завершаем работу, сбрасывая флаг 404
//dbg($aCatalog);
// POST
if (isset($_POST['act'])) {
    switch ($_POST['act']) {
    }
}
// TEMPLATE
$tpl = new KTemplate();
$_s = file_get_contents(__FILE__);
$_s = substr($_s, strpos($_s, '?' . '>') + 2);
$tpl->loadTemplateContent($_s);
$tpl->assign('h_title', 'Создание формы');
$tpl->assign('microtime', substr(md5(microtime()), 0, 10));
// Получаем столбцы таблицы продуктов,
// удаляя из результата те, по которым построены индексы
// и те, которые не относятся к этому каталогу.
// К каждому столбцу добавляем поле Value, которое содержит интерфейсное название поля
// OUT
$_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());
$_t->assign('content', $tpl);
return;
?>

<h2>{h_title}</h2>
Форма:&nbsp;
<form method="post" style="display:inline;">
<input type="text" name="name" value="{name}" size="20" />
开发者ID:rigidus,项目名称:cobutilniki,代码行数:30,代码来源:forms_add.php

示例15: KTemplate

            }
            // обновим запись в БД
            $sql = "UPDATE `" . DB_PREFIX . DB_TBL_FORMS_TYPES . "` \n\t\t\t      SET `name`='{$new_type_name}', `params`='{$new_type_params}', `db_type`='{$new_type_bd_type}' \n\t\t\t      WHERE id={$edit_type_id}";
            $sql = mysql_query($sql);
            if (false == $sql) {
                my_die();
            }
            break;
    }
}
$tpl = new KTemplate(FLGR_CMS_TEMPLATES . '/forms_types.htm');
//разворачиваем шаблоны
// запросим все типы из базы
$sql = "SELECT * FROM `" . DB_PREFIX . DB_TBL_FORMS_TYPES . "` ";
$sql = mysql_query($sql);
if (false == $sql) {
    my_die();
}
// Заполняем шаблон
while ($row = mysql_fetch_assoc($sql)) {
    $tplTypeItem = $tpl->fetchBlock('TypeItem');
    $tplTypeItem->assign($row);
    $tpl->assign('TypeItem', $tplTypeItem);
    $tplTypeItem->reset();
}
if (mysql_num_rows($sql) < 1) {
    $tpl->assign('TypeItem', '');
}
// OUT
$_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());
$_t->assign('content', $tpl);
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:forms_types.php


注:本文中的KTemplate::assign方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。