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


PHP HTML_Template_IT::parseCurrentBlock方法代码示例

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


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

示例1: executeUpdateScript

function executeUpdateScript(HTML_Template_IT &$objTpl)
{
    if (!verifyVersion($GLOBALS["_CONF"]["app"]["version"])) {
        $objTpl->setCurrentBlock("update");
        $objTpl->setVariable("VERSION", $GLOBALS["_CONF"]["app"]["version"]);
        $objTpl->parseCurrentBlock();
    }
}
开发者ID:laiello,项目名称:punchcms,代码行数:8,代码来源:inc.verify_version.php

示例2: buildView

 /**
  * Function to build view
  *
  * @access public
  * @author Kristine <Kristinesepp@gmail.com>
  * @param number $parameters['a'] first summand
  * @param number  $parameters['b'] second summand
  * @param number $parameters['sum'] sum        
  */
 public static function buildView($parameters)
 {
     require_once "HTML/Template/IT.php";
     $tpl = new \HTML_Template_IT(dirname(__FILE__) . "/");
     $tpl->loadTemplatefile("HArjutus.html", true, true);
     $tpl->setCurrentBlock("form");
     $tpl->setVariable(array('URL-BEGIN' => BEGINNING_OF_URL, 'SUMMAND' => $parameters['a'], 'SUMMAND2' => $parameters['b'], 'SUM' => $parameters['sum']));
     $tpl->parseCurrentBlock("form");
     $tpl->show();
 }
开发者ID:piiskop,项目名称:pstk,代码行数:19,代码来源:SumView.php

示例3: parseHelp

function parseHelp($intElmntId, $strCommand)
{
    global $_PATHS, $objLang;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    $objTpl->loadTemplatefile("help.tpl.htm");
    $objTpl->setVariable("HELP", $objLang->get("help", "label"));
    $objTpl->setCurrentBlock("paragraph");
    $objTpl->setVariable("HEADER", $objLang->get("docHeader", "help"));
    $objTpl->setVariable("BODY", $objLang->get("docBody", "help"));
    $objTpl->parseCurrentBlock();
    $strBody = $objLang->get("hotkeysBody", "help");
    if (!empty($strBody)) {
        $objTpl->setCurrentBlock("paragraph");
        $objTpl->setVariable("HEADER", $objLang->get("hotkeysHeader", "help"));
        $objTpl->setVariable("BODY", $strBody);
        $objTpl->parseCurrentBlock();
    }
    return $objTpl->get();
}
开发者ID:laiello,项目名称:punchcms,代码行数:19,代码来源:inc.tplparse_help.php

示例4: getNews

function getNews(&$db, $newsCategory)
{
    $query = "
        SELECT
            news_id      AS id,
            DATE_FORMAT(news_date, '%D %b %Y at %H:%I:%S') AS date,
            news_title   AS title,
            news_content AS content
        FROM
            news
        WHERE
            news_category = '$newsCategory'
        AND
            news_id<>0
        ORDER BY
            date ASC";

    $news = $db->queryAll($query, null, MDB2_FETCHMODE_ASSOC, true);

    if (PEAR::isError($news)) {
        die($news->getMessage() . ' ' . $news->getUserinfo());
    } else {
        $tpl = new HTML_Template_IT('./');

        $tpl->loadTemplatefile('news.tpl', true, true);

        foreach ($news as $name) {
            $tpl->setCurrentBlock('row');
            $tpl->setVariable('DATE',    $name['date']);
            $tpl->setVariable('TITLE',   $name['title']);
            $tpl->setVariable('CONTENT', $name['content']);
            $tpl->parseCurrentBlock('row');
        }
        return $tpl->get();
    }
}
开发者ID:nistormihai,项目名称:Newscoop,代码行数:36,代码来源:home.php

示例5: array

<?php

require_once "HTML/Template/IT.php";
$listitems = array('Computer Science', 'Nuclear Physics', 'Rocket Science');
$tplfile = 'tpl0.tpl';
$tpl = new HTML_Template_IT('./');
$tpl->loadTemplateFile($tplfile);
$tpl->setVariable('title', 'IT List Examples');
foreach ($listitems as $item) {
    $tpl->setCurrentBlock('listentry');
    $tpl->setVariable('entry_text', $item);
    $tpl->parseCurrentBlock('cell');
}
$tpl->show();
开发者ID:bozhink,项目名称:Code-Chunks,代码行数:14,代码来源:template0.php

示例6: die

     ."    FROM TB_MOVIE m"
     ."    LEFT JOIN TB_MOVIE_SCH s ON s.MOVIE_SEQ = m.SEQ"
     ."     AND s.CLASS_ID = '$p_class_id'"
     ."   WHERE s.PLAN_ILSI > '0000-00-01'";
 $res =& $db->query($sql);
 if (PEAR::isError($db)) {
   die($db->getMessage());
 }  
 
 // 편집 
 $iCol=0;
 $sColHeader=array();
 while ($res->fetchInto($row)) {
   if (!$tpl->setCurrentBlock("col_header")) Error("setCurrentBlock");
   $tpl->setVariable("COL_HEADER", $row[0]);
   $tpl->parseCurrentBlock("col_header");    
   // parse outter block
   if (!$tpl->parse("col_header")) Error("parseCurrentBlock");
   $sColHeader[$iCol++] = $row[0];    
 }
 
 // 점검
 /*
 echo("<br>");
 foreach( $sColHeader as $ccc)
 {
 	echo($ccc.":");
 }      
 echo("<br>");
 */
   
开发者ID:kimyongyeon,项目名称:mos,代码行数:30,代码来源:movie_rec.php

示例7: array

<?php

require_once "HTML/Template/IT.php";
$data = array("0" => array("Stig", "Bakken"), "1" => array("Martin", "Jansen"), "2" => array("Alexander", "Merz"));
$tpl = new HTML_Template_IT("./templates");
$tpl->loadTemplatefile("main.tpl.htm", true, true);
foreach ($data as $name) {
    foreach ($name as $cell) {
        // Assign data to the inner block
        $tpl->setCurrentBlock("cell");
        $tpl->setVariable("DATA", $cell);
        $tpl->parseCurrentBlock("cell");
    }
    // Assign data and the inner block to the
    // outer block
    $tpl->setCurrentBlock("row");
    $tpl->parseCurrentBlock("row");
}
// print the output
$tpl->show();
开发者ID:bantudevelopment,项目名称:polysmis,代码行数:20,代码来源:sample_it.php

示例8: generateItemFile

function generateItemFile($itemId, $path, $idx, $itemsData)
{
    global $db;
    $row =& $db->getRow(CMD_SEL_ITEM, array($itemId), DB_FETCHMODE_ASSOC);
    if (PEAR::isError($row)) {
        print $row->getMessage() . "\n";
        return;
    }
    print "Generate item page... {$itemId} \n";
    // Новый объект
    if ($row["item_id"] == 0) {
        $fields = getViewFields();
        $imgUrl = IMAGES_BASE . getNormImagePath("new" . $row["id"]);
    } else {
        $categId =& $db->getOne("SELECT category_id FROM items WHERE id = ?", array($row["item_id"]));
        if (PEAR::isError($categId)) {
            $fields = getViewFields();
        } else {
            $fields = getViewFields($categId);
        }
        $imgUrl = IMAGES_BASE . getNormImagePath($row["item_id"]);
    }
    $fields = removeFields($fields[0], $fields[1]);
    $fields = array_unique($fields);
    ob_start();
    $tpl = new HTML_Template_IT("");
    $tpl->loadTemplatefile(ITEM_TPL_FILE, true, true);
    $params = array("itemData" => $itemsData, "perPage" => 1, "delta" => 3, "append" => false, "expanded" => true, "fileName" => "?popup=[%d]", "mode" => "Sliding", "path" => "", "prevImg" => "&lt;prev", "nextImg" => "next&gt;");
    $pager = new ExtendedPager1($params);
    $pager->ext = BASE_INDEX_URL_POPUP;
    $pager->infoStr = NAV_INFO_STR;
    $pager->prev = NAV_PREV;
    $pager->prevDis = NAV_PREV_DIS;
    $pager->next = NAV_NEXT;
    $pager->nextDis = NAV_NEXT_DIS;
    $pager->prevPages = NAV_PREV_PAGES;
    $pager->prevPagesDis = NAV_PREV_PAGES_DIS;
    $pager->nextPages = NAV_NEXT_PAGES;
    $pager->nextPagesDis = NAV_NEXT_PAGES_DIS;
    $pager->currentPage = $idx + 1;
    $navigation = $pager->getLinks();
    $navigation = $pager->replaceLinks($navigation);
    $navigation = str_replace("/http://", "http://", $navigation);
    $navigation = str_replace(".http://", "http://", $navigation);
    $tpl->setVariable("NAVIGATION", $navigation);
    $row["name"] = stripslashes($row["name"]);
    $tpl->setVariable("name1", $row["name"]);
    $tpl->setVariable("HTMLTITLE", $row["name"] . START_PATH_TITLE);
    foreach ($fields as $field) {
        if (!isset($row[$field])) {
            continue;
        }
        if (strlen(trim($row[$field])) == 0) {
            continue;
        }
        $row[$field] = stripslashes($row[$field]);
        $tpl->setCurrentBlock($field);
        $tpl->setVariable($field, $row[$field]);
        $tpl->parseCurrentBlock();
    }
    $tpl->setCurrentBlock("image");
    $tpl->setVariable("image", $imgUrl);
    $tpl->parseCurrentBlock();
    $tpl->show();
    $contents = ob_get_contents();
    ob_end_clean();
    $fName = str_replace(" ", "-", trim($row['art']));
    $fName = str_replace("/", "-", $fName);
    FileUtils::saveContents(OUTPUT_DIR . "/popup/" . $fName . ".html", $contents);
}
开发者ID:rivetweb,项目名称:old-auto-catalog,代码行数:70,代码来源:Generator.php

示例9: buildLanguageMenu


//.........这里部分代码省略.........
  * @uses LANGUAGE           for languages
  * @uses TITLE_LANGUAGE     for the explanation of the change of the
  * 		language
  */
 private static function buildLanguageMenu($parameters)
 {
     if (!isset($parameters['isError']) || !$parameters['isError']) {
         require_once 'HTML/Template/IT.php';
         $tpl = new \HTML_Template_IT(sprintf('%1$s/../assets/tpl/%2$u', dirname(__FILE__), $parameters['width']));
         $tpl->loadTemplatefile('languages.tpl');
         require_once O_FOLDER . '/keeled/Language.php';
         $language = new Language();
         if (isset($_SESSION['language'])) {
             $language->setId($_SESSION['language']);
             $idOfLanguageToExclude = $_SESSION['language'];
         } else {
             $language->setId(DEFAULT_LANGUAGE);
             $idOfLanguageToExclude = DEFAULT_LANGUAGE;
         }
         $language->setLanguage();
         require_once O_FOLDER . 'errors/Error.php';
         // echo ' 1658: ', $parameters['type'];
         $languagesInUse = Language::createLanguagesInUse(array('classes' => array('SystemMenuItem', 'Page', 'PageNews', 'SystemString'), 'idOfLanguageToExclude' => $idOfLanguageToExclude, 'object' => isset($parameters['id']) ? Error::requireFile(array('id' => $parameters['id'], 'type' => $parameters['type'], 'isInstance' => TRUE, 'isToBeCompleted' => TRUE, 'isView' => FALSE)) : NULL));
         // echo ' 1675: <pre>';print_r($languageInUse); echo '</pre>';
         $numberOfLanguage = 0;
         foreach ($languagesInUse as $languageInUse) {
             $numberOfLanguage++;
             if ($numberOfLanguage < 3) {
                 switch ($parameters['type']) {
                     case 'Error':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('errors_Error_error');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Feedback':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_formOfFeedback');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Hierarchy':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_hierarchy');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Humans':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId(ALIAS_HUMAN_LIST);
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'Pages':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_pages');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     case 'SystemStrings':
                         require_once O_FOLDER . '/keeled/SystemString.php';
                         $systemString = new SystemString();
                         $systemString->setId('configuration_systemStrings');
                         $systemString->setCompleteSystemString();
                         $alias = $systemString->translate(array('block' => 'title'));
                         break;
                     default:
                         require_once O_FOLDER . '/errors/Error.php';
                         $object = Error::requireFile(array('id' => $parameters['id'], 'type' => $parameters['type'], 'isInstance' => TRUE, 'isToBeCompleted' => TRUE, 'typeOfError' => 'JSON', 'isInstance' => TRUE, 'isView' => FALSE));
                         $object->setIdOfLanguage($languageInUse['id']);
                         $title = $object->translate(array('block' => 'title'));
                         // echo ' 1717: ', $title;
                         require_once O_FOLDER . 'Slug.php';
                         $alias = Slug::slugify(array('original' => $title));
                 }
                 $currentLanguage = new Language();
                 $currentLanguage->setId($languageInUse['id']);
                 $currentLanguage->setLanguage();
                 $tpl->setCurrentBlock('language-in-menu');
                 $tpl->setVariable(array('ALIAS-OF-LANGUAGE' => $alias, 'DESIGNATION-OF-LANGUAGE-IN-MENU' => $currentLanguage->getNaming(), 'ID-OF-LANGUAGE-IN-MENU' => $languageInUse['id'], 'LOCATION-OF-LANGUAGE' => DOMAIN));
                 $tpl->parseCurrentBlock();
             }
         }
         if (count($languagesInUse) > 2) {
             require_once O_FOLDER . 'FormRowView.php';
             $tpl->setCurrentBlock('box-for-languages');
             $tpl->setVariable(array('ALIAS-IN-RIGHT-SIDEBAR' => $alias, 'ALIAS-OF-LANGUAGES' => ALIAS_OF_LANGUAGES, 'ALT-LANGUAGE' => ALT_LANGUAGE, 'BEGINNING-OF-URL-IN-RIGHT-SIDEBAR' => DOMAIN, 'FIELD-OF-LANGUAGE' => FormRowView::buildFormFieldWithMessageField(array('class' => ' Language', 'dataFieldName' => 'language', 'isInfoAbove' => FALSE, 'mainTypeOfDataField' => 'Input', 'typeOfBox' => 'input', 'suffix' => $parameters['suffix'], 'title' => TITLE_LANGUAGE, 'value' => $language->getNaming())), 'ID-OF-LANGUAGE' => isset($_SESSION['language']) ? $_SESSION['language'] : DEFAULT_LANGUAGE, 'PATH-TO-IMAGES-IN-RIGHT-SIDEBAR' => IMAGES_FOLDER, 'SUFFIX-IN-RIGHT-SIDEBAR' => $parameters['suffix']));
             $tpl->parseCurrentBlock();
         }
         $tpl->parse('languages');
         return $tpl->get('languages');
     } else {
         return '';
     }
 }
开发者ID:piiskop,项目名称:pstk,代码行数:101,代码来源:BodyView.php

示例10: parseMenu

function parseMenu($intCatId, $strCommand)
{
    global $_PATHS, $objLang, $_CONF, $objLiveUser;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    $objTpl->loadTemplatefile("menu.tpl.htm");
    //*** Parse the header links.
    $objTpl->setVariable("LOGGEDIN", $objLang->get("loggedInAs", "head"));
    $objTpl->setVariable("LOGOUT", $objLang->get("logout", "head"));
    $objTpl->setVariable("COMPANY_NAME", htmlentities($_CONF['app']['account']->getName()));
    $objTpl->setVariable("USER_NAME", $objLiveUser->getProperty('name'));
    if ($objLiveUser->checkRight(MYPUNCH_PROFILE_VIEW)) {
        $objTpl->setVariable("PROFILE_LINK", "href=\"?cid=" . NAV_MYPUNCH_PROFILE . "\"");
    }
    //*** Parse the main menu buttons.
    foreach ($_CONF['app']['msMypunch'] as $key => $value) {
        if (is_array($value)) {
            //*** Nested MyPunch menu items.
            foreach ($value as $subKey => $subValue) {
                if ($objLiveUser->checkRight($_CONF['app']['navRights'][$subValue]) == true && $_CONF['app']['account']->hasProduct(constant('PRODUCT_' . strtoupper($subKey))) == true) {
                    $objTpl->setCurrentBlock("mypunch.{$key}");
                    $objTpl->setVariable("LABEL_MYPUNCH_" . strtoupper($key), $objLang->get($subKey, "menu"));
                    $objTpl->setVariable("CID_MYPUNCH_" . strtoupper($key), $subValue);
                    if ($intCatId == $subValue || in_array($intCatId, $_CONF['app']['ms' . ucfirst($subKey)])) {
                        //*** Render product sub menu.
                        foreach ($_CONF['app']['ms' . ucfirst($subKey)] as $productKey => $productValue) {
                            if ($objLiveUser->checkRight($_CONF['app']['navRights'][$productValue]) == true) {
                                $objTpl->setVariable("LABEL_" . strtoupper($subKey) . "_" . strtoupper($productKey), $objLang->get($subKey . ucfirst($productKey), "menu"));
                                $objTpl->setVariable("CID_" . strtoupper($subKey) . "_" . strtoupper($productKey), $productValue);
                                //*** Activate sub button.
                                if ($intCatId == $productValue) {
                                    $objTpl->setVariable("ACTIVE_" . strtoupper($subKey) . "_" . strtoupper($productKey), "class=\"active\"");
                                }
                            }
                        }
                        //*** Activate main button.
                        $objTpl->setVariable("ACTIVE_MYPUNCH_" . strtoupper($key), "class=\"active\"");
                    }
                    $objTpl->parseCurrentBlock();
                }
            }
        } else {
            if ($objLiveUser->checkRight($_CONF['app']['navRights'][$value]) == true) {
                //*** Plain MyPunch menu items.
                $objTpl->setVariable("LABEL_MYPUNCH_" . strtoupper($key), $objLang->get("mypunch" . ucfirst($key), "menu"));
                $objTpl->setVariable("CID_MYPUNCH_" . strtoupper($key), $value);
                //*** Activate menu item.
                if ($intCatId == $value) {
                    $objTpl->setVariable("ACTIVE_MYPUNCH_" . strtoupper($key), "class=\"active\"");
                    //*** Render MyPunch tab button.
                    $objTpl->setVariable("LABEL_MYPUNCHSUB_" . strtoupper($key), $objLang->get("mypunch" . ucfirst($key), "menu"));
                    $objTpl->setVariable("CID_MYPUNCHSUB_" . strtoupper($key), $value);
                    $objTpl->setVariable("ACTIVE_MYPUNCHSUB_" . strtoupper($key), "class=\"active\"");
                }
            }
        }
    }
    return $objTpl->get();
}
开发者ID:laiello,项目名称:punchcms,代码行数:58,代码来源:inc.tplparse_head.php

示例11: array

<?php
require_once 'HTML/Template/IT.php';

$data = array (
    '0' => array('Stig', 'Bakken'),
    '1' => array('Martin', 'Jansen'),
    '2' => array('Alexander', 'Merz')
);

$tpl = new HTML_Template_IT('./templates');
$tpl->loadTemplatefile('main.tpl.htm', true, true);

foreach ($data as $name) {
    foreach ($name as $cell) {
        // Assign data to the inner block
        $tpl->setCurrentBlock('cell');
        $tpl->setVariable('DATA', $cell);
        $tpl->parseCurrentBlock();
    }
    // Assign data and the inner block to the
    // outer block
    $tpl->setCurrentBlock('row');
    $tpl->parseCurrentBlock();
}
// print the output
$tpl->show();
?>
开发者ID:rommelxcastro,项目名称:CRI-Online-Sales---Admin,代码行数:27,代码来源:sample_it.php

示例12:

 /**
  * Initialize a TemplateObject, add a title, and icon and add JS and CSS for DHTML 
  *
  * @param string  $file     filename of the template file
  * @param string  $title    (optional) title of the page
  * @param string  $icon     (optional) iconhandle for this page
  * @param boolean $useDHTML (optional) add JS and CSS for DHTML-features
  *
  * @access private
  *
  * @return object Object of HTML/IT - Template - Class
  */
 function _initTemplate($file, $title = '', $icon = '', $useDHTML = true)
 {
     $tpl = new HTML_Template_IT(dirname(__FILE__) . "/Web");
     $tpl->loadTemplateFile($file);
     $tpl->setVariable("InstallerURL", $_SERVER["PHP_SELF"]);
     $tpl->setVariable("ImgPEAR", $_SERVER["PHP_SELF"] . '?img=pear');
     if ($title) {
         $tpl->setVariable("Title", $title);
     }
     if ($icon) {
         $tpl->setCurrentBlock("TitleBlock");
         $tpl->setVariable("_InstallerURL", $_SERVER["PHP_SELF"]);
         $tpl->setVariable("_Title", $title);
         $tpl->setVariable("_Icon", $icon);
         $tpl->parseCurrentBlock();
     }
     $tpl->setCurrentBlock();
     if ($useDHTML && Net_UserAgent_Detect::getBrowser('ie5up') == 'ie5up') {
         $dhtml = true;
     } else {
         $dhtml = false;
     }
     if ($dhtml) {
         $tpl->setVariable("JS", 'dhtml');
         $css = '<link rel="stylesheet" href="' . $_SERVER['PHP_SELF'] . '?css=dhtml" />';
         $tpl->setVariable("DHTMLcss", $css);
     } else {
         $tpl->setVariable("JS", 'nodhtml');
     }
     if (!isset($_SESSION['_PEAR_Frontend_Web_js']) || $_SESSION['_PEAR_Frontend_Web_js'] == false) {
         $tpl->setCurrentBlock('JSEnable');
         $tpl->setVariable('RedirectURL', $_SERVER['REQUEST_URI'] . (!empty($_GET) ? '&' : '?') . 'enableJS=1');
         $tpl->parseCurrentBlock();
         $tpl->setCurrentBlock();
     }
     return $tpl;
 }
开发者ID:blowfishJ,项目名称:galaxyCode,代码行数:49,代码来源:Web.php

示例13: parseTemplates

function parseTemplates($intElmntId, $strCommand)
{
    global $_PATHS, $objLang, $_CONF, $_CLEAN_POST, $objLiveUser;
    $objTpl = new HTML_Template_IT($_PATHS['templates']);
    switch ($strCommand) {
        case CMD_LIST:
            $objTpl->loadTemplatefile("multiview.tpl.htm");
            $objTpl->setVariable("MAINTITLE", $objLang->get("pcmsTemplates", "menu"));
            $objTemplate = Template::selectByPK($intElmntId);
            if (empty($intElmntId)) {
                $strTemplateName = "Website";
            } else {
                if (is_object($objTemplate)) {
                    $strTemplateName = $objTemplate->getName();
                } else {
                    $strTemplateName = "";
                }
            }
            if (is_object($objTemplate)) {
                $objFields = $objTemplate->getFields();
                if (is_object($objFields)) {
                    //*** Initiate field loop.
                    $listCount = 0;
                    $intPosition = request("pos");
                    $intPosition = !empty($intPosition) && is_numeric($intPosition) ? $intPosition : 0;
                    $intPosition = floor($intPosition / $_SESSION["listCount"]) * $_SESSION["listCount"];
                    $objFields->seek($intPosition);
                    //*** Loop through the fields.
                    foreach ($objFields as $objField) {
                        $objFieldType = TemplateFieldType::selectByPK($objField->getTypeId());
                        $strMeta = $objLang->get("editedBy", "label") . " " . $objField->getUsername() . ", " . Date::fromMysql($objLang->get("datefmt"), $objField->getModified());
                        $objTpl->setCurrentBlock("multiview-item");
                        $objTpl->setVariable("BUTTON_DUPLICATE", $objLang->get("duplicate", "button"));
                        $objTpl->setVariable("BUTTON_DUPLICATE_HREF", "javascript:PTemplateField.duplicate({$objField->getId()});");
                        $objTpl->setVariable("BUTTON_REMOVE", $objLang->get("delete", "button"));
                        $objTpl->setVariable("BUTTON_REMOVE_HREF", "javascript:PTemplateField.remove({$objField->getId()});");
                        $objTpl->setVariable("MULTIITEM_VALUE", $objField->getId());
                        $objTpl->setVariable("MULTIITEM_HREF", "href=\"?cid=" . NAV_PCMS_TEMPLATES . "&amp;eid={$objField->getId()}&amp;cmd=" . CMD_EDIT_FIELD . "\"");
                        $strValue = htmlspecialchars($objField->getName());
                        $strShortValue = getShortValue($strValue, 50);
                        $intSize = strlen($strValue);
                        $objTpl->setVariable("MULTIITEM_NAME", $intSize > 50 ? $strShortValue : $strValue);
                        $objTpl->setVariable("MULTIITEM_TITLE", $intSize > 50 ? $strValue : "");
                        $objTpl->setVariable("MULTIITEM_TYPE", ", " . $objFieldType->getName());
                        $objTpl->setVariable("MULTIITEM_TYPE_CLASS", "field");
                        $objTpl->setVariable("MULTIITEM_META", $strMeta);
                        $objTpl->parseCurrentBlock();
                        $listCount++;
                        if ($listCount >= $_SESSION["listCount"]) {
                            break;
                        }
                    }
                    //*** Render page navigation.
                    $pageCount = ceil($objFields->count() / $_SESSION["listCount"]);
                    if ($pageCount > 0) {
                        $currentPage = ceil(($intPosition + 1) / $_SESSION["listCount"]);
                        $previousPos = $intPosition - $_SESSION["listCount"] > 0 ? $intPosition - $_SESSION["listCount"] : 0;
                        $nextPos = $intPosition + $_SESSION["listCount"] < $objFields->count() ? $intPosition + $_SESSION["listCount"] : $intPosition;
                        $objTpl->setVariable("PAGENAV_PAGE", sprintf($objLang->get("pageNavigation", "label"), $currentPage, $pageCount));
                        $objTpl->setVariable("PAGENAV_PREVIOUS", $objLang->get("previous", "button"));
                        $objTpl->setVariable("PAGENAV_PREVIOUS_HREF", "?cid=" . NAV_PCMS_TEMPLATES . "&amp;eid={$intElmntId}&amp;pos={$previousPos}");
                        $objTpl->setVariable("PAGENAV_NEXT", $objLang->get("next", "button"));
                        $objTpl->setVariable("PAGENAV_NEXT_HREF", "?cid=" . NAV_PCMS_TEMPLATES . "&amp;eid={$intElmntId}&amp;pos={$nextPos}");
                        //*** Top page navigation.
                        for ($intCount = 0; $intCount < $pageCount; $intCount++) {
                            $objTpl->setCurrentBlock("multiview-pagenavitem-top");
                            $position = $intCount * $_SESSION["listCount"];
                            if ($intCount != $intPosition / $_SESSION["listCount"]) {
                                $objTpl->setVariable("PAGENAV_HREF", "href=\"?cid=" . NAV_PCMS_TEMPLATES . "&amp;eid={$intElmntId}&amp;pos={$position}\"");
                            }
                            $objTpl->setVariable("PAGENAV_VALUE", $intCount + 1);
                            $objTpl->parseCurrentBlock();
                        }
                        //*** Top page navigation.
                        for ($intCount = 0; $intCount < $pageCount; $intCount++) {
                            $objTpl->setCurrentBlock("multiview-pagenavitem-bottom");
                            $position = $intCount * $_SESSION["listCount"];
                            if ($intCount != $intPosition / $_SESSION["listCount"]) {
                                $objTpl->setVariable("PAGENAV_HREF", "href=\"?cid=" . NAV_PCMS_TEMPLATES . "&amp;eid={$intElmntId}&amp;pos={$position}\"");
                            }
                            $objTpl->setVariable("PAGENAV_VALUE", $intCount + 1);
                            $objTpl->parseCurrentBlock();
                        }
                    }
                }
            }
            //*** Render list action pulldown.
            $arrActions[$objLang->get("choose", "button")] = 0;
            $arrActions[$objLang->get("delete", "button")] = "delete";
            $arrActions[$objLang->get("duplicate", "button")] = "duplicate";
            foreach ($arrActions as $key => $value) {
                $objTpl->setCurrentBlock("multiview-listactionitem");
                $objTpl->setVariable("LIST_ACTION_TEXT", $key);
                $objTpl->setVariable("LIST_ACTION_VALUE", $value);
                $objTpl->parseCurrentBlock();
            }
            //*** Render the rest of the page.
            $objTpl->setCurrentBlock("multiview");
            $objTpl->setVariable("ACTIONS_OPEN", $objLang->get("pcmsOpenActionsMenu", "menu"));
            $objTpl->setVariable("ACTIONS_CLOSE", $objLang->get("pcmsCloseActionsMenu", "menu"));
//.........这里部分代码省略.........
开发者ID:laiello,项目名称:punchcms,代码行数:101,代码来源:inc.tplparse_template.php

示例14: count

$tpl->loadTemplatefile("index.tpl", true, true);
// data for the news
$news_id = $walnut_db->fetchDataDB('news', 'news_id', 'desc');
$news_author = $walnut_db->fetchDataDB('news', 'news_author', 'desc');
$news_title = $walnut_db->fetchDataDB('news', 'news_title', 'desc');
$news_date = $walnut_db->fetchDataDB('news', 'news_date', 'desc');
$news_content = $walnut_db->fetchDataDB('news', 'news_content', 'desc');
$num = count($news_id);
for ($i = 0; $i < $num; $i++) {
    $tpl->setCurrentBlock("news");
    $tpl->setVariable("TIT_NEWS", $news_title[$i]);
    $tpl->setVariable("AUTHOR_NEWS", $news_author[$i]);
    $tpl->setVariable("DATE_NEWS", $news_date[$i]);
    $news_content[$i] = nl2br($news_content[$i]);
    $tpl->setVariable("CONTENT_NEWS", $news_content[$i]);
    $tpl->parseCurrentBlock("news");
}
/// data from database
// data for title and logo url
$title = $walnut_db->fetchDataDB('settings', 'title');
$logo = $walnut_db->fetchDataDB('settings', 'logo_url');
// data for the menu
$menu_id = $walnut_db->fetchDataDB('menu', 'id');
$menu_name = $walnut_db->fetchDataDB('menu', 'name');
$menu_ref = $walnut_db->fetchDataDB('menu', 'ref');
$num = count($menu_id);
for ($i = 0; $i < $num; $i++) {
    $tpl->setCurrentBlock("menu");
    $tpl->setVariable("REF", $menu_ref[$i]);
    $tpl->setVariable("NAME", $menu_name[$i]);
    $tpl->setVariable("ID", $menu_id[$i]);
开发者ID:BackupTheBerlios,项目名称:walnut,代码行数:31,代码来源:index.php

示例15: SetItemImage

function SetItemImage(&$tpl, $itemName, $itemProjectId)
{
    $itemimage_tpl = new HTML_Template_IT("./");
    $itemimage_tpl->loadTemplatefile("itemimage.tpl.html", true, true);
    if (ItemHasImage($itemName, $itemProjectId)) {
        $itemimage_tpl->setCurrentBlock("image_available");
        $itemimage_tpl->setVariable("ITEM_NAME", urlencode($itemName));
        $itemimage_tpl->setVariable("ITEM_PROJECT_ID", $itemProjectId);
        $itemimage_tpl->parseCurrentBlock("image_available");
    } else {
        $itemimage_tpl->setCurrentBlock("no_image_available");
        $itemimage_tpl->parseCurrentBlock("no_image_available");
    }
    $tpl->setVariable("ITEM_IMAGE", $itemimage_tpl->get());
}
开发者ID:amjadtbssm,项目名称:website,代码行数:15,代码来源:page_blocks.php


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