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


PHP KTemplate::loadTemplateContent方法代码示例

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


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

<?php

// ≈сли пользователь залогинен - сюда он попал
// случайно и его надо перебросить на его профиль.
/*
if ($Permissions->bIsLogged()) {
	header('Location: /user/'.$Permissions->getLoggedUserId());
	include_once(FLGR_COMMON.'/exit.php');
}
*/
// «амен¤ем рутовый шаблон на шаблон стартовой страницы
if ('' == $sModuleTpl) {
    my_die('Error: Template not found');
}
$sTpl = microkernel(FLGR_TEMPLATES . '/' . $sModuleTpl . '.htm');
$_t = new KTemplate();
$_t->loadTemplateContent($sTpl);
开发者ID:rigidus,项目名称:cobutilniki,代码行数:17,代码来源:about.php

示例4: KTemplate

$sql = 'SELECT * FROM `' . DB_PREFIX . DB_TBL_PRODUCTS . '` WHERE id = ' . $del_id;
$sql = mysql_query($sql);
if (false == $sql) {
    my_die();
}
$aDel = mysql_fetch_assoc($sql);
if (empty($aDel)) {
    $_t->assign('content', '<span style="color: red">Ошибка:</span> Удаляемая группа не существует!');
    $_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());
    return;
}
// TEMPLATE
$tpl = new KTemplate();
$_s = file_get_contents(__FILE__);
$_s = substr($_s, strpos($_s, '?' . '>') + 2);
$tpl->loadTemplateContent($_s);
$tpl->assign('h_title', 'Удаление продукта');
$tpl->assign($aDel);
$tpl->assign('act', $act);
// OUT
$_t->assign('BreadCrumbs', $BreadCrumbs->getBreadCrumbs());
$_t->assign('content', $tpl);
return;
?>

<h2>{h_title}</h2>

Вы действительно хотите удалить этот продукт?

<form method="post">
<input type="submit" value="Да" />
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:product-del.php

示例5: tplList

function tplList($aIn, $sName, $type, $aSel = array())
{
    $tplContainer = new KTemplate();
    switch ($type) {
        case 'radio':
            $sTplContainer = '
		<!-- BEGIN block -->
		<input type="radio" name="' . $sName . '" value="{k}" <!-- BEGIN sel --> checked <!-- END sel --> />{v}<br />
		<!-- END block -->
		';
            break;
        case 'listbox':
            $sTplContainer = '
		<select name="' . $sName . '">
		<!-- BEGIN block -->
		<option value="{k}" <!-- BEGIN sel --> selected <!-- END sel --> >{v}</option>
		<!-- END block -->
		</select>
		<br />
		';
            break;
        case 'multiple':
            $sTplContainer = '
		<select multiple size="7" name="' . $sName . '[]">
		<!-- BEGIN block -->
		<option value="{k}" <!-- BEGIN sel --> selected <!-- END sel --> >{v}</option>
		<!-- END block -->
		</select>
		<br />
		Удерживайте клавишу CTRL чтобы указать несколько значений
		<br />
		';
            break;
        case 'checkbox':
            $sTplContainer = '
		<!-- BEGIN block -->
		<input type="checkbox" name="' . $sName . '[]" value="{k}" <!-- BEGIN sel --> checked <!-- END sel --> />{v}<br />
		<!-- END block -->
		';
            break;
        case 'text':
            $sTplContainer = '
		<!-- BEGIN block -->
		<input type="text" name="' . $sName . '" style="width: 90%" <!-- BEGIN sel --> value="{v}" <!-- END sel --> /><br />
		<!-- END block -->
		<br />
		';
            break;
        case 'textarea':
            $sTplContainer = '
		<!-- BEGIN block -->
		<textarea name="' . $sName . '" style="width: 90%" rows="10"><!-- BEGIN sel -->{v}<!-- END sel --></textarea><br />
		<!-- END block -->
		<br />
		';
            break;
    }
    $tplContainer->loadTemplateContent($sTplContainer);
    if ($type == 'text' || $type == 'textarea') {
        $tpl = $tplContainer->fetchBlock('block');
        if (!is_array($aSel)) {
            $tplSel = $tpl->fetchBlock('sel');
            $tplSel->assign('v', $aSel);
            $tpl->assign('sel', $tplSel);
        } else {
            $tpl->assign('sel', '');
        }
        $tplContainer->assign('block', $tpl);
        $tpl->reset();
    } else {
        if ($aSel != array()) {
            if (!is_array($aSel)) {
                $aSel = array($aSel);
            }
            $aSel = array_flip($aSel);
            //dbg($aSel);
        }
        $bCheked = true;
        foreach ($aIn as $k => $v) {
            $tpl = $tplContainer->fetchBlock('block');
            $tpl->assign('k', $k);
            $tpl->assign('v', $v);
            if (isset($aSel[$k])) {
                $tpl->assign('sel', $tpl->fetchBlock('sel'));
            } else {
                $tpl->assign('sel', '');
            }
            $tplContainer->assign('block', $tpl);
            $tpl->reset();
        }
    }
    return $tplContainer;
}
开发者ID:rigidus,项目名称:cobutilniki,代码行数:93,代码来源:common.php

示例6:

$tplRSS->loadTemplateContent('<?xml version="1.0" encoding="windows-1251"?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
  <title>{site}</title>
  <link>{site_link}</link>
  <description>{site_description}</description>
  <language>ru</language>
  <managingEditor>{site_email}</managingEditor>
  <generator>na_kolenke</generator>
  <lastBuildDate>{last_build_date}</lastBuildDate>
  <image>
    <url>http://{site}/img/icon_for_rss.jpg</url>
    <title>{site}</title>
    <link>{site_link}</link>
    <width>100</width>
    <height>131</height>
  </image>
  
<!-- BEGIN item --> 
  <item>
    <guid isPermaLink=\'true\'>http://{site}/postid/{id}</guid>
    <title>{title}</title>
    <link>http://{site}/postid/{id}</link>
    <comments>http://{site}/postid/{id}</comments>
    <description><![CDATA[ {text} ]]></description>
    <pubDate>{date}</pubDate>
  </item>
<!-- END item -->
	
</channel>
</rss>');
开发者ID:rigidus,项目名称:izverg,代码行数:31,代码来源:rss.php

示例7: 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

示例8: 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

示例9: get

 /**
  * Возвращает BreadCrumbs
  *
  * @return unknown
  */
 function get()
 {
     $aBreadCrumbs = $this->aBreadCrumbs;
     // localize it
     $tail = array_pop($aBreadCrumbs);
     $ret = '';
     // ord
     if (!empty($aBreadCrumbs)) {
         // tpl
         $tpl = new KTemplate();
         $tpl->loadTemplateContent($this->ord);
         // assembly
         $lnk = '';
         foreach ($aBreadCrumbs as $v) {
             // Способ сбросить аккумулятор - %
             if ($v['key'][0] == '%') {
                 $lnk = '';
                 $v['key'] = substr($v['key'], 1);
             }
             if ($lnk == '/') {
                 $lnk .= $v['key'];
             } else {
                 $lnk .= '/' . $v['key'];
             }
             $v['link'] = $lnk;
             $tpl = $this->getItem($tpl, $v);
         }
         $ret .= $tpl->get();
     }
     // tail
     if (false != $tail) {
         // tpl
         $tpl = new KTemplate();
         $tpl->loadTemplateContent($this->fin);
         // assembly
         $v = $tail;
         $lnk .= '/' . $v['key'];
         $v['link'] = $lnk;
         $tpl = $this->getItem($tpl, $v);
         $ret .= $tpl->get();
     }
     return $ret;
 }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:48,代码来源:BreadCrumbs.php

示例10: overbox

}
//dbg($aFields);
if (defined('FCK')) {
    $aOptInputs['text'] = overbox('fck', array('{Field}', '{var}'));
}
$tpl->assign('Fields', '');
foreach ($aFields as $k => $v) {
    $tplFields = $tpl->fetchBlock('Fields');
    $tmp = $tplFields->get();
    foreach ($aOptInputs as $kk => $vv) {
        if ($kk == $v['Type']) {
            $tmp = str_replace('[opt-inputs]', $vv, $tmp);
        }
    }
    $tplFields = new KTemplate();
    $tplFields->loadTemplateContent($tmp);
    $tplFields->assign($v);
    if (!isset($aElt[$v['Field']])) {
        $aElt[$v['Field']] = '';
    }
    $tplFields->assign('var', $aElt[$v['Field']]);
    if ($v['Type'] == 'blob') {
        // Получаем рамер содержимого поля blob
        $sql = "SELECT OCTET_LENGTH( `" . $v['Field'] . "` ) \n\t\tFROM `" . DB_PREFIX . DB_TBL_PRODUCTS . "`\n\t\tWHERE `id`='" . $product_id . "'";
        $sql = mysql_query($sql);
        if (false == $sql) {
            my_die();
        }
        $size = current(mysql_fetch_assoc($sql));
        $tplFields->assign('size', $size . ' bytes');
    }
开发者ID:rigidus,项目名称:cobutilniki,代码行数:31,代码来源:product-edit.php


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