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


PHP template::replace方法代码示例

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


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

示例1: isset

\t "author":"[+json_author+]",
\t "description":"[+json_description+]",
\t "introtext":"[+json_introtext+]"
\t},

TPL;
$json_tpl_last = <<<TPL
\t{
\t "title":"[+json_pagetitle+]",
\t "link":"[(site_url)][~[+id+]~]",
\t "date":"[+json_createdon+]",
\t "guid":"[(site_url)][~[+id+]~]",
\t "author":"[+json_author+]",
\t "description":"[+json_description+]",
\t "introtext":"[+json_introtext+]"
\t}
TPL;
$json_footer = <<<TPL

 ]
}
TPL;
// ---------------------------------------------------
// Pass JSON Templates To Snippet
// ---------------------------------------------------
$header = isset($header) ? $header : template::replace($json_placeholders, $json_header);
$tpl = isset($tpl) ? $tpl : "@CODE:" . $json_tpl;
$tplLast = isset($tplLast) ? $tplLast : "@CODE:" . $json_tpl_last;
$footer = isset($footer) ? $footer : $json_footer;
// set emptytext
$noResults = "      ";
开发者ID:radist,项目名称:modx.evo.custom,代码行数:31,代码来源:json.format.inc.php

示例2: isset

[+xml_xsl+]
<xml version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
\t\t<channel>
\t\t\t\t<title>[*pagetitle*]</title>
\t\t\t\t<link>[+xml_link+]</link>
\t\t\t\t<description>[*description*]</description>
\t\t\t\t<language>[+xml_lang+]</language>
\t\t\t\t<copyright>[+xml_copyright+]</copyright>
\t\t\t\t<ttl>[+xml_ttl+]</ttl>
TPL;
$xml_tpl = <<<TPL
\t\t<item>
\t\t\t<title>[+xml_pagetitle+]</title>
\t\t\t<link>[(site_url)][~[+id+]~]</link>
\t\t\t<summary><![CDATA[ [+xml_introtext+] ]]></summary>
\t\t\t<date>[+xml_createdon+]</date>
\t\t\t<createdon>[+xml_createdon+]</createdon>
\t\t\t<author>[+xml_author+]</author>
\t\t\t[+tags+]
\t\t</item>
TPL;
$xml_footer = <<<TPL
\t\t\t</channel>
</xml>
TPL;
// set template values
$header = isset($header) ? $header : template::replace($xml_placeholders, $xml_header);
$tpl = isset($tpl) ? $tpl : "@CODE:" . $xml_tpl;
$footer = isset($footer) ? $footer : $xml_footer;
// set emptytext
$noResults = "      ";
开发者ID:radist,项目名称:modx.evo.custom,代码行数:31,代码来源:xml.format.inc.php

示例3: isset

      xml:lang="[+atom_lang+]"
      xml:base="[(site_url)]">
\t<id>[(site_url)][~[*id*]~]</id>
\t<title>[*pagetitle*]</title>
\t<link rel="self" type="text/xml" href="[+atom_link+]" />
\t<author><name>[(site_name)]</name></author>
\t<updated>[+atom_lastmodified+]</updated>
\t<generator>Ditto 2.0 running on MODx</generator>
TPL;
$atom_tpl = <<<TPL

\t<entry>
\t\t<title>[+atom_escaped_pagetitle+]</title>
\t\t<link rel="alternate" type="text/html" href="[+url+]" />
\t\t<author><name>[+atom_author+]</name></author>
\t\t<id>[+url+]</id>
\t\t<updated>[+atom_editedon+]</updated>
\t\t<published>[+atom_createdon+]</published>
\t\t<content type="xhtml"><div xmlns="http://www.w3.org/1999/xhtml">[+summary+]</div></content>
\t</entry>
TPL;
$atom_footer = <<<TPL

</feed>
TPL;
// set template values
$header = isset($header) ? $header : template::replace($atom_placeholders, $atom_header);
$tpl = isset($tpl) ? $tpl : "@CODE:" . $atom_tpl;
$footer = isset($footer) ? $footer : $atom_footer;
// set emptytext
$noResults = "      ";
开发者ID:jgrau,项目名称:MODx-CMS,代码行数:31,代码来源:atom.format.inc.php

示例4: isset

\t<channel>
\t\t\t<title>[*pagetitle*]</title>
\t\t\t<link>[+rss_link+]</link>
\t\t\t<description>[*description*]</description>
\t\t\t<language>[+rss_lang+]</language>
\t\t\t<copyright>[+rss_copyright+]</copyright>
\t\t\t<ttl>[+rss_ttl+]</ttl>
TPL;
$rss_tpl = <<<TPL

\t\t\t<item>
\t\t\t\t<title>[+rss_pagetitle+]</title>
\t\t\t\t<link>[(site_url)][~[+id+]~]</link>
\t\t\t\t<description><![CDATA[ [+summary+] ]]></description>
\t\t\t\t<pubDate>[+rss_date+]</pubDate>
\t\t\t\t<guid isPermaLink="false">[(site_url)][~[+id+]~]</guid>
\t\t\t\t<dc:creator>[+rss_author+]</dc:creator>
\t\t\t\t[+tagLinks+]
\t\t\t</item>
\t\t
TPL;
$rss_footer = <<<TPL
\t</channel>
</rss>
TPL;
// set template values
$header = isset($header) ? $header : template::replace($rss_placeholders, $rss_header);
$tpl = isset($tpl) ? $tpl : "@CODE:" . $rss_tpl;
$footer = isset($footer) ? $footer : $rss_footer;
// set emptytext
$noResults = "      ";
开发者ID:rthrash,项目名称:evolution,代码行数:31,代码来源:rss.format.inc.php

示例5: tagLinks

 function tagLinks($tags, $tagDelimiter, $tagID = false, $format = "html")
 {
     global $ditto_lang, $modx;
     if (count($tags) == 0 && $format == "html") {
         return $ditto_lang['none'];
     } else {
         if (count($tags) == 0 && ($format == "rss" || $format == "xml" || $format == "xml")) {
             return "<category>" . $ditto_lang['none'] . "</category>";
         }
     }
     $output = "";
     if ($this->sort) {
         ksort($tags);
     }
     // set templates array
     $tplRss = "\r\n" . "\t\t\t\t<category>[+tag+]</category>";
     $tpl = $this->tpl == false ? '<a href="[+url+]" class="ditto_tag" rel="tag">[+tag+]</a>' : $this->tpl;
     $tpl = ($format == "rss" || $format == "xml" || $format == "atom") && $templates['user'] == false ? $tplRss : $tpl;
     if ($this->displayMode == 1) {
         foreach ($tags as $tag) {
             $tagDocID = !$tagID ? $modx->documentObject['id'] : $tagID;
             $url = ditto::buildURL("tags={$tag}&start=0", $tagDocID);
             $output .= template::replace(array('url' => $url, 'tag' => $tag), $tpl);
             $output .= $format != "rss" && $format != "xml" && $format != "atom" ? $this->displayDelimiter : '';
         }
     } else {
         if ($format != "rss" && $format != "xml" && $format != "atom" && $this->displayMode == 2) {
             $tagList = array();
             foreach ($tags as $tag) {
                 $tagDocID = !$tagID ? $modx->documentObject['id'] : $tagID;
                 $url = ditto::buildURL("tags={$tag}&start=0", $tagDocID);
                 $tagList[] = template::replace(array('url' => $url, 'tag' => $tag), $tpl);
             }
             $output = $modx->makeList($tagList, $ulroot = 'ditto_tag_list', $ulprefix = 'ditto_tag_', $type = '', $ordered = false, $tablevel = 0);
         }
     }
     return $format != "rss" && $format != "xml" && $format != "atom" ? substr($output, 0, -1 * strlen($this->displayDelimiter)) : $output;
 }
开发者ID:radist,项目名称:modx.evo.custom,代码行数:38,代码来源:tagging.extender.inc.php

示例6: getDefaultEndTags

        eval("?>" . $this->out);
    }
    private function getDefaultEndTags()
    {
        //Custom
    }
    private function getDefaultBeginTags()
    {
        $this->replace('TPL_TITLE', 'Website Title !');
        $this->replace('TPL_CSS', $this->TPLDIR . $this->model . '/design/' . $this->design . '/css/' . $this->css . '.css');
        //$this->replace('TPL_CHARSET', CHARSET);
        $this->replace('TOP3', '<a href="?lang=fr"><img src="templates/default/design/default/icones/langs/french.png"></a> <a href="?lang=en"><img src="templates/default/design/default/icones/langs/english.png"></a>');
    }
}
$Init = new template();
//$Init->setModel('default(2)');
$Init->replaceBoucle('MENUCONTENU,TMENU', 5, 'BOUCLEM');
$Init->replace('MENUCONTENU.1', '{TMENU}');
$Init->replace('MENUCONTENU.2', '{TMENU}');
$Init->replaceBoucle('MENUCONTENU.5,TMENU.5', 2, 'BOUCLEM.5');
$Init->replaceBoucle('TCONTENU,CONTENU', 3, 'BOUCLEC');
$Init->replaceBoucle('CONTENU.2', 2);
$Init->replaceBoucle('CONTENU.3', 3);
$Init->replaceBoucle('CONTENU.3.1', 2);
$Init->replace('CONTENU.1', "Hello world");
$Init->getPage('pro');
$array['error1'] = "My firest error";
$array['error2'] = "My second error";
$Init->replace('TMENU.5.1', 'Messages');
$Init->replace('MENUCONTENU.5.1', $Init->getMessages($array));
$Init->getDisplay(false);
开发者ID:laubosslink,项目名称:lab,代码行数:31,代码来源:template.class.php


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