本文整理汇总了PHP中HTML_Template_IT::touchBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP HTML_Template_IT::touchBlock方法的具体用法?PHP HTML_Template_IT::touchBlock怎么用?PHP HTML_Template_IT::touchBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HTML_Template_IT
的用法示例。
在下文中一共展示了HTML_Template_IT::touchBlock方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildMenuElement
/**
* This function creates a HTML-block for a menu item.
*
* @access public
* @author arnold:tserepov <tserepov@gmail.com>
* @param MenuElement $parameters['menuElement']
* the menu element
* @param string $parameters['type']
* the type
* @see MenuElement::$type
* @uses MENU_COMMON for the common menu
* @uses MENU_OUTER for the menu of outer links
* @uses MENU_INNER for the menu of inner links
*/
public static function buildMenuElement($parameters)
{
require_once 'HTML/Template/IT.php';
$tpl = new \HTML_Template_IT(ROOT_FOLDER . 'tutshtml');
$tpl->loadTemplatefile('burnstudio2-template.html');
switch ($parameters['type']) {
case MENU_COMMON:
$tpl->setCurrentBlock('menu-item');
$tpl->setVariable(array('HREF' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL' => $parameters['menuElement']->translate(array('property' => 'label'))));
$tpl->parse('menu-item');
// echo ' 38: ', $tpl->get('menu-item');
return $tpl->get('menu-item');
break;
case MENU_OUTER:
$tpl->setCurrentBlock('outer-link');
$tpl->setVariable(array('HREF-OF-OUTER-LINK' => null === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-OUTER-LINK' => $parameters['menuElement']->translate(array('property' => 'label'))));
$tpl->parse('outer-link');
return $tpl->get('outer-link');
break;
case MENU_INNER:
$parameters['menuElement']->setAttributes();
if ($parameters['menuElement']->isActive()) {
$tpl->touchBlock('current');
}
$tpl->setCurrentBlock('inner-link');
$tpl->setVariable(array('HREF-OF-INNER-LINK' => '' === $parameters['menuElement']->getHref() ? $parameters['menuElement']->translate(array('property' => 'href', 'isSlug' => true)) : $parameters['menuElement']->getHref(), 'LABEL-OF-INNER-LINK' => $parameters['menuElement']->translate(array('property' => 'label'))));
$tpl->parse('inner-link');
return $tpl->get('inner-link');
break;
default:
exit("What type?");
}
}
示例2: showLoginForm
function showLoginForm(&$liveUserObj)
{
$tpl = new HTML_Template_IT();
$tpl->loadTemplatefile('loginform.tpl.php');
$tpl->setVariable('form_action', $_SERVER['SCRIPT_NAME']);
if (is_object($liveUserObj)) {
if ($liveUserObj->getStatus()) {
switch ($liveUserObj->getStatus()) {
case LIVEUSER_STATUS_ISINACTIVE:
$tpl->touchBlock('inactive');
break;
case LIVEUSER_STATUS_IDLED:
$tpl->touchBlock('idled');
break;
case LIVEUSER_STATUS_EXPIRED:
$tpl->touchBlock('expired');
break;
default:
$tpl->touchBlock('failure');
break;
}
}
}
$tpl->show();
exit;
}
示例3: showLoginForm
function showLoginForm($liveUserObj = false)
{
include_once 'HTML/Template/IT.php';
$tpl = new HTML_Template_IT();
$tpl->loadTemplatefile('loginform.tpl.php');
$tpl->setVariable('form_action', $_SERVER['PHP_SELF']);
if (is_object($liveUserObj)) {
if ($liveUserObj->status) {
switch ($liveUserObj->status) {
case LIVEUSER_STATUS_ISINACTIVE:
$tpl->touchBlock('inactive');
break;
case LIVEUSER_STATUS_IDLED:
$tpl->touchBlock('idled');
break;
case LIVEUSER_STATUS_EXPIRED:
$tpl->touchBlock('expired');
break;
default:
$tpl->touchBlock('failure');
break;
}
}
}
$tpl->show();
exit;
}
示例4: buildHeader
/**
* This function builds the header.
*
* @access public
* @author kalmer
* @return string
*/
public static function buildHeader()
{
require_once 'HTML/Template/IT.php';
$tpl = new \HTML_Template_IT(dirname(__FILE__) . '/../html');
$tpl->loadTemplatefile('header.html');
$tpl->touchBlock('header');
$tpl->parse('header');
return $tpl->get('header');
}
示例5:
<?php
require_once 'HTML/Template/IT.php';
$tpl = new \HTML_Template_IT(dirname(__FILE__) . '/../HTML');
$tpl->loadTemplatefile('header.html');
$tpl->touchBlock('header');
$tpl->parse('header');
echo $tpl->GET('header');
示例6:
foreach ($persons as $person) {
echo "ID " . $person["ID"] . "<br>Nimi " . $person["Name"] . "<br>Pilt ";
if (!empty($person["Picture"])) {
echo $person["Picture"] . "<br>";
} else {
echo "pilt puudub<br>";
}
}
/*
?>
<table>
<tr>
<th>ID</th>
<th>Nimi</th>
<th>Pilt</th>
</tr>
<tr>
<td>{ID}</td>
<td>{Name}</td>
<td><img href="{Picture}" /></td>
</tr>
</table>
<?php */
require_once 'HTML/Template/IT.php';
$tmpl = new \HTML_Template_IT(dirname(__FILE__) . '/../HTML');
$tmpl->loadTemplatefile('footer.html');
$tmpl->touchBlock('footer');
$tmpl->parse('footer');
echo $tmpl->get('footer');
示例7: parseHeader
function parseHeader($intCatId, $strCommand, $intElmntId)
{
global $_PATHS, $_CONF, $objLiveUser;
$objTpl = new HTML_Template_IT($_PATHS['templates']);
switch ($intCatId) {
case NAV_MYPUNCH_LOGIN:
case NAV_MYPUNCH_NOACCOUNT:
$objTpl->loadTemplatefile("header-login.tpl.htm");
break;
default:
$objTpl->loadTemplatefile("header.tpl.htm");
break;
}
$objTpl->setVariable("TITLE", htmlentities($_CONF['app']['pageTitle']));
$objTpl->setVariable("GENERATOR", htmlentities(APP_NAME));
$objTpl->setVariable("REVISION", htmlentities(APP_VERSION));
switch ($intCatId) {
case NAV_PCMS_ELEMENTS:
$objTpl->touchBlock("tree");
$objTpl->touchBlock("animation");
$objTpl->touchBlock("tooltip");
$objTpl->touchBlock("cms.elements");
switch ($strCommand) {
case CMD_ADD:
case CMD_ADD_DYNAMIC:
case CMD_ADD_FOLDER:
case CMD_EDIT:
$objTpl->touchBlock("calendar");
$objTpl->touchBlock("cms.languages");
break;
}
break;
case NAV_PCMS_TEMPLATES:
$objTpl->touchBlock("tree");
$objTpl->touchBlock("animation");
$objTpl->touchBlock("tooltip");
$objTpl->touchBlock("cms.templates");
switch ($strCommand) {
case CMD_ADD_STRUCTURE:
case CMD_ADD_STRUCTURE_DETAIL:
$objTpl->touchBlock("cms.aliases");
}
break;
case NAV_PCMS_STORAGE:
$objTpl->touchBlock("tree");
$objTpl->touchBlock("animation");
$objTpl->touchBlock("tooltip");
$objTpl->touchBlock("cms.storage");
break;
case NAV_PCMS_ALIASES:
$objTpl->touchBlock("animation");
$objTpl->touchBlock("cms.aliases");
break;
case NAV_PCMS_FEEDS:
$objTpl->touchBlock("animation");
$objTpl->touchBlock("cms.feeds");
break;
case NAV_PCMS_LANGUAGES:
$objTpl->touchBlock("animation");
$objTpl->touchBlock("cms.languages");
break;
case NAV_MYPUNCH_USERS:
$objTpl->touchBlock("tree");
$objTpl->touchBlock("animation");
$objTpl->touchBlock("cms.users");
break;
}
if (AnnounceMessage::getMessages(false)->count() > 0 && $objLiveUser->checkRight(MYPUNCH_ANNOUNCEMENTS_VIEW)) {
$objTpl->touchBlock("lightbox");
}
$objLang = isset($_SESSION["objLang"]) ? unserialize($_SESSION["objLang"]) : NULL;
$strLang = !is_null($objLang) ? strtolower($objLang->get("abbr")) : "en";
$objTpl->setVariable("DATEPICKER_LANG", $strLang);
$strReturn = $objTpl->get();
$strReturn .= parseScriptHeader($intCatId, $strCommand, $intElmntId);
return $strReturn;
}
示例8:
<?php
require_once "pear/HTML/Template/IT.php";
$tpl = new HTML_Template_IT("./");
$tpl->loadTemplatefile("test.tpl.html", true, true);
$tpl->setCurrentBlock("not_logged");
$tpl->touchBlock("not_logged");
$tpl->parseCurrentBlock("not_logged");
$tpl->Show();
示例9:
<?php
require_once 'HTML/Template/IT.php';
$tpl = new \HTML_Template_IT(dirname(__FILE__) . '/../html');
$tpl->loadTemplatefile('Header.html');
$tpl->touchBlock('BLOCK');
$tpl->parse('BLOCK');
echo $tpl->get('BLOCK');
示例10: parseAlias
//.........这里部分代码省略.........
$objTpl->setCurrentBlock("multiview-listactionitem");
$objTpl->setVariable("LIST_ACTION_TEXT", $key);
$objTpl->setVariable("LIST_ACTION_VALUE", $value);
$objTpl->parseCurrentBlock();
}
$objTpl->setCurrentBlock("multiview");
$objTpl->setVariable("ACTIONS_OPEN", $objLang->get("pcmsOpenActionsMenu", "menu"));
$objTpl->setVariable("ACTIONS_CLOSE", $objLang->get("pcmsCloseActionsMenu", "menu"));
$objTpl->setVariable("LIST_LENGTH_HREF_10", "href=\"?list=10&cid=" . NAV_PCMS_ALIASES . "\"");
$objTpl->setVariable("LIST_LENGTH_HREF_25", "href=\"?list=25&cid=" . NAV_PCMS_ALIASES . "\"");
$objTpl->setVariable("LIST_LENGTH_HREF_100", "href=\"?list=100&cid=" . NAV_PCMS_ALIASES . "\"");
switch ($_SESSION["listCount"]) {
case 10:
$objTpl->setVariable("LIST_LENGTH_HREF_10", "");
break;
case 25:
$objTpl->setVariable("LIST_LENGTH_HREF_25", "");
break;
case 100:
$objTpl->setVariable("LIST_LENGTH_HREF_100", "");
break;
}
$objTpl->setVariable("LIST_LENGTH_HREF", "&cid=" . NAV_PCMS_ALIASES);
$objTpl->setVariable("LIST_WITH_SELECTED", $objLang->get("withSelected", "label"));
$objTpl->setVariable("LIST_ACTION_ONCHANGE", "Alias.multiDo(this, this[this.selectedIndex].value)");
$objTpl->setVariable("LIST_ITEMS_PER_PAGE", $objLang->get("itemsPerPage", "label"));
$objTpl->setVariable("BUTTON_LIST_SELECT", $objLang->get("selectAll", "button"));
$objTpl->setVariable("BUTTON_LIST_SELECT_HREF", "javascript:Alias.multiSelect()");
$objTpl->parseCurrentBlock();
//*** Form variables.
$intActiveLanguage = 0;
if ($strCommand == CMD_EDIT) {
$objAlias = Alias::selectByPK($intAliasId);
$intActiveLanguage = $objAlias->getLanguageId();
$objTpl->setVariable("FORM_ACTIVE_VALUE", $objAlias->getActive() ? "checked=\"checked\"" : "");
$objTpl->setVariable("FORM_ALIAS_VALUE", $objAlias->getAlias());
$objTpl->setVariable("FORM_URL_VALUE", $objAlias->getUrl());
$objTpl->setVariable("FRM_HEADER", $objLang->get("editAlias", "form"));
$objTpl->setVariable("FRM_STYLE", "");
$objTpl->setVariable("CMD", CMD_EDIT);
$objTpl->touchBlock("alias.edit");
} else {
$objTpl->setVariable("FORM_ACTIVE_VALUE", "checked=\"checked\"");
$objTpl->setVariable("FRM_HEADER", $objLang->get("addAlias", "form"));
if (!$blnError) {
$objTpl->setVariable("FRM_STYLE", " style=\"display:none\"");
}
$objTpl->setVariable("CMD", CMD_ADD);
$objTpl->touchBlock("alias.add");
}
//*** Languages.
$objLanguages = ContentLanguage::select();
foreach ($objLanguages as $objLanguage) {
$objTpl->setCurrentBlock("language.item");
$objTpl->setVariable("ID", $objLanguage->getId());
$objTpl->setVariable("LABEL", $objLanguage->getName());
$objTpl->setVariable("SELECTED", $intActiveLanguage == $objLanguage->getId() ? " selected=\"selected\"" : "");
$objTpl->parseCurrentBlock();
}
$objTpl->setVariable("ALIASES", $objLang->get("aliases", "label"));
$objTpl->setVariable("BUTTON_ADD", $objLang->get("aliasAdd", "button"));
$objTpl->setVariable("FRM_LABEL_ACTIVE", $objLang->get("active", "form"));
$objTpl->setVariable("FRM_LABEL_ALIAS", $objLang->get("alias", "form"));
$objTpl->setVariable("FRM_DESCR_ALIAS", $objLang->get("alias", "tip"));
$objTpl->setVariable("FRM_LABEL_LANGUAGE", $objLang->get("language", "form"));
$objTpl->setVariable("FRM_DESCR_LANGUAGE", $objLang->get("language", "tip"));
$objTpl->setVariable("FRM_LABEL_ALL_LANGUAGES", $objLang->get("allLanguages", "form"));
$objTpl->setVariable("FRM_LABEL_URL", $objLang->get("element", "form"));
$objTpl->setVariable("FRM_LABEL_SAVE", $objLang->get("save", "button"));
$objTpl->setVariable("CID", NAV_PCMS_ALIASES);
$objTpl->setVariable("EID", $intAliasId);
$objTpl->parseCurrentBlock();
$strReturn = $objTpl->get();
break;
case CMD_REMOVE:
if (strpos($intAliasId, ',') !== false) {
//*** Multiple elements submitted.
$arrAliases = explode(',', $intAliasId);
$objAliases = Alias::selectByPK($arrAliases);
foreach ($objAliases as $objAlias) {
$objAlias->delete();
}
} else {
//*** Single element submitted.
$objAlias = Alias::selectByPK($intAliasId);
$objAlias->delete();
}
//*** Redirect the page.
$strReturnTo = request('returnTo');
if (empty($strReturnTo)) {
header("Location: " . Request::getUri() . "/?cid=" . request("cid") . "&cmd=" . CMD_LIST);
exit;
} else {
header("Location: " . Request::getURI() . $strReturnTo);
exit;
}
break;
}
return $strReturn;
}