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


PHP KTemplate::get方法代码示例

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


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

示例3: header

            header('301 Moved Permanently');
            header('Location: ' . $nat);
            die("<h1>301 Moved Permanently</h1>" . '<a href="' . $nat . '">http://' . HOST . $nat . '</a>');
        } else {
            // 404
            header('HTTP/1.1 404 Not Found');
            $subject = $_SERVER['HTTP_HOST'] . ' ' . '404 Not Found';
            $message = my_info();
            my_mail($message, $subject);
            //		cStat::bSaveEvent(EVENT_404);
            die('404 Not Found');
        }
    }
    // Вывод
    header('Content-Type: text/html; charset=' . CHARSET);
    $sOut = $_t->get();
    if (defined('CACHE_ON')) {
        if ($bFlagCache) {
            $Cashe->Add($sRequest, $nLastId, $sOut);
        }
    }
    //echo preg_replace('/\s{2,}/', ' ', $_t->get());
    echo $sOut;
    if (defined('DEBUG')) {
        if (!empty($dbglog)) {
            echo $dbglog;
        }
    }
} catch (KTemplateException $e) {
    // Ошибка шаблонизатора
    ExceptionHandler('Template error', $e);
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:index.php

示例4: email

        } else {
            $_POST['sex'] = 'default';
            $BreadCrumbs->addBreadCrumbs($sKey, 'Регистрация аккаунта');
            $tpl->assign('title', 'Регистрация аккаунта');
            $tplForm->assign('content', 'Регистрация на этом сайте даст вам возможность оставлять комментарии в блоге.');
            $tplForm->assign('act', 'register');
            $tplForm->assign('submit', 'Зарегистрироваться');
            $tplForm->assign('validation_login', $tplForm->fetchBlock('validation_login'));
        }
        $tplForm->assign('validator_login', 'Только английские строчные буквы, цифры, тире и знак подчеркивания');
        $tplForm->assign('validator_name', 'Любые буквы, цифры, тире и знак подчеркивания');
        $tplForm->assign('validator_password', 'Любые буквы, цифры, тире и знак подчеркивания');
        $tplForm->assign('validator_age', 'Число полных лет (в пределах от 4 до <a  target="_blank" href="http://ru.wikipedia.org/wiki/%D0%9A%D0%B0%D0%BB%D1%8C%D0%BC%D0%B0%D0%BD,_%D0%96%D0%B0%D0%BD%D0%BD%D0%B0">122</a>)');
        $tplForm->assign('validator_email', 'Правильный email (используется для уведомлений, на сайте не отображается)');
        $tplForm->assign('validator_kcaptcha', 'Защита от автоматических регистраций - введите символы, изображенные на картинке');
        $sForm = $tplForm->get();
        $sForm = HTML_FormPersister::ob_formpersisterhandler($sForm);
        $sForm = $metaForm->process($sForm);
        $tpl->assign('content', $sForm);
        break;
}
$_t->assign('ContentBlock', $tpl);
$tpl->reset();
// BREADCRUMBS
$_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());
// HEAD_TITLE
$_t->assign('head_title', $sTitle);
// SEO
$_t->assign('seo_title', $sSeoTitle);
$_t->assign('seo_keywords', $sSeoKeywords);
$_t->assign('seo_description', $sSeoDescription);
开发者ID:rigidus,项目名称:rigidus,代码行数:31,代码来源:newuser.php

示例5: get

 public function get()
 {
     $t = parent::get();
     if ($this->_removeEmptyBlocks && isset($this->_blc) && is_array($this->_blc)) {
         foreach ($this->_blc as $key => $value) {
             if ($this->_blc[$key] == true) {
                 $t = str_replace($this->_delimiterStart . $key . $this->_delimiterEnd, '', $t);
             }
         }
     }
     return $t;
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:12,代码来源:KTemplate.php

示例6: WHERE

    function getPages_Component($component_id)
    {
        if (!is_numeric($component_id)) {
            return;
        }
        $sql = "SELECT `page_id` FROM `" . DB_PREFIX . DB_TBL_COMPONENTS2PAGES . "` WHERE (`component_id` = {$component_id})";
        $sql = mysql_query($sql);
        if (false == $sql) {
            my_die();
        }
        $aLikedPages = array();
        while ($row = mysql_fetch_assoc($sql)) {
            $aLikedPages[$row['page_id']] = $row;
        }
        $tpl = new KTemplate();
        $tpl->loadTemplateContent('
			<!-- BEGIN TreePages -->
			<table cellpadding="0" cellspacing="0" border="0">
				<!-- BEGIN MenuElt -->
				<tr style="margin:0; padding: 0">
					<td style="margin:0; padding: 0">
						<div style="margin-left: {level}px">
							<!-- BEGIN Controls -->
							<input type="checkbox" name="pages[{id}]" {checked} />
							<!-- END Controls -->
							<!-- BEGIN hyperlink -->
							<a href="{link}">
								{title}
							</a>
							<!-- END hyperlink -->
						</div>
					</td>
				</tr>
				<!-- END MenuElt -->		
			</table>
			<!-- END TreePages -->
		');
        $tplTreePages = $tpl->fetchBlock('TreePages');
        $param = '';
        foreach (aSpecialGetMenu($param) as $k => $v) {
            $tplMenuElt = $tplTreePages->fetchBlock('MenuElt');
            $tplMenuElt->assign('key', $v['key']);
            $tplMenuElt->assign('title', $v['title']);
            $tplMenuElt->assign('level', count($v['level']) * 20);
            $tplControls = $tplMenuElt->fetchBlock('Controls');
            $tplControls->assign('id', $v['id']);
            if (isset($aLikedPages[$v['id']])) {
                $tplControls->assign('checked', 'checked');
            }
            $tplMenuElt->assign('Controls', $tplControls);
            $tplControls->reset();
            $link = implode('/', $v['level']);
            if ($link == '') {
                $link = '/';
            }
            if ($v['hidden_menu'] != 0) {
                $v['title'] = '(' . $v['title'] . ')';
            }
            if ($v['hidden'] == 0) {
                $tplHyperLink = $tplMenuElt->fetchBlock('hyperlink');
                $tplHyperLink->assign('link', $link);
                $tplHyperLink->assign('title', $v['title']);
                $tplMenuElt->assign('hyperlink', $tplHyperLink);
                $tplHyperLink->reset();
            } else {
                $tplMenuElt->assign('hyperlink', '&nbsp;<a style="color: #999999">' . $v['title'] . '</a>');
            }
            $tplTreePages->assign('MenuElt', $tplMenuElt);
            $tplMenuElt->reset();
        }
        $tpl->assign('TreePages', $tplTreePages);
        // Уплотняем
        $sReturn = preg_replace('/\\s{2,}/', ' ', $tpl->get());
        return $sReturn;
    }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:75,代码来源:Components.php

示例7: int_list

function int_list($aArray, $sFileNameItemsTpl)
{
    //	dbg($aArray);
    $aChunk = array_chunk($aArray, 20);
    //	dbg($aChunk);
    // verify & decrement
    if (!isset($_GET['pg'])) {
        $_GET['pg'] = 0;
    } elseif (!is_numeric($_GET['pg'])) {
        $_GET['pg'] = 0;
    } elseif ($_GET['pg'] < 1) {
        $_GET['pg'] = 0;
    } else {
        $_GET['pg'] = $_GET['pg'] - 1;
    }
    if (isset($aChunk[$_GET['pg']])) {
        //		Console::log($aChunk[$_GET['pg']]);
        $aArray = $aChunk[$_GET['pg']];
    }
    $sResult = '';
    if (!empty($aArray)) {
        //		dbg(FLGR_ITEMS.'/'.$sFileNameItemsTpl);
        $tplItem = new KTemplate(FLGR_ITEMS . '/' . $sFileNameItemsTpl);
        //		dbg($tplItem);
        foreach ($aArray as $v) {
            $tplItem->assign($v);
            $sResult .= $tplItem->get();
            $tplItem->reset();
        }
    }
    $tplPager = new KTemplate();
    $tplPager->loadTemplateContent('
		<br />
		<div class="pager">
			<a href="#" class="prew"><img src="/images/arrleft.png" alt="Назад" width="25" height="15"></a> <a href="#" class="next"><img src="/images/arrright.png" alt="Назад" width="25" height="15"></a>
			<ul>
				{EltPlace}
			
				<!-- BEGIN Elt -->
				<li><a href="?pg={n}">{n}</a></li>
				<!-- END Elt -->
				
				<!-- BEGIN SelElt -->
				<li><span>{n}</span></li>
				<!-- END SelElt -->
			</ul>
		</div>
	');
    foreach ($aChunk as $k => $v) {
        if ($_GET['pg'] == $k) {
            $tplElt = $tplPager->fetchBlock('SelElt');
        } else {
            $tplElt = $tplPager->fetchBlock('Elt');
        }
        $tplElt->assign('n', $k + 1);
        $tplPager->assign('EltPlace', $tplElt);
        $tplElt->reset();
    }
    $tplPager->assign('Elt', '');
    $tplPager->assign('SelElt', '');
    $tplPager->assign('EltPlace', '');
    return '<div>' . $sResult . '</div>' . $tplPager->get();
}
开发者ID:rigidus,项目名称:cobutilniki,代码行数:63,代码来源:int.php


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