本文整理汇总了PHP中eZTemplate::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP eZTemplate::factory方法的具体用法?PHP eZTemplate::factory怎么用?PHP eZTemplate::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZTemplate
的用法示例。
在下文中一共展示了eZTemplate::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: render
/**
* Renders the block (returns HTML)
*
* @return string HTML
**/
public function render()
{
$tpl = eZTemplate::factory();
$tpl->setVariable( 'localized_apps', $this->fetchApplications() );
return $tpl->fetch( 'design:presenters/block/carousel.tpl' );
}
示例2: getNextItems
/**
* Returns block item XHTML
*
* @param mixed $args
* @return array
*/
public static function getNextItems($args)
{
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$result = array();
$galleryID = $http->postVariable('gallery_id');
$offset = $http->postVariable('offset');
$limit = $http->postVariable('limit');
$galleryNode = eZContentObjectTreeNode::fetch($galleryID);
if ($galleryNode instanceof eZContentObjectTreeNode) {
$params = array('Depth' => 1, 'Offset' => $offset, 'Limit' => $limit);
$pictureNodes = $galleryNode->subtree($params);
foreach ($pictureNodes as $validNode) {
$tpl->setVariable('node', $validNode);
$tpl->setVariable('view', 'block_item');
$tpl->setVariable('image_class', 'blockgallery1');
$content = $tpl->fetch('design:node/view/view.tpl');
$result[] = $content;
if ($counter === $limit) {
break;
}
}
}
return $result;
}
示例3: sendOrderEmail
function sendOrderEmail($params)
{
$ini = eZINI::instance();
if (isset($params['order']) and isset($params['email'])) {
$order = $params['order'];
$email = $params['email'];
$tpl = eZTemplate::factory();
$tpl->setVariable('order', $order);
$templateResult = $tpl->fetch('design:shop/orderemail.tpl');
$subject = $tpl->variable('subject');
$mail = new eZMail();
$emailSender = $ini->variable('MailSettings', 'EmailSender');
if (!$emailSender) {
$emailSender = $ini->variable("MailSettings", "AdminEmail");
}
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$mail->setReceiver($email);
$mail->setSender($emailSender);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
$email = $ini->variable('MailSettings', 'AdminEmail');
$mail = new eZMail();
if ($tpl->hasVariable('content_type')) {
$mail->setContentType($tpl->variable('content_type'));
}
$mail->setReceiver($email);
$mail->setSender($emailSender);
$mail->setSubject($subject);
$mail->setBody($templateResult);
$mailResult = eZMailTransport::send($mail);
}
}
示例4: getValidItems
/**
* Returns block item XHTML
*
* @param mixed $args
* @return array
*/
public static function getValidItems($args)
{
$http = eZHTTPTool::instance();
$tpl = eZTemplate::factory();
$result = array();
$blockID = $http->postVariable('block_id');
$offset = $http->postVariable('offset');
$limit = $http->postVariable('limit');
$validNodes = eZFlowPool::validNodes($blockID);
$counter = 0;
foreach ($validNodes as $validNode) {
if (!$validNode->attribute('can_read')) {
continue;
}
$counter++;
if ($counter <= $offset) {
continue;
}
$tpl->setVariable('node', $validNode);
$tpl->setVariable('view', 'block_item');
$tpl->setVariable('image_class', 'blockgallery1');
$content = $tpl->fetch('design:node/view/view.tpl');
$result[] = $content;
if ($counter === $limit) {
break;
}
}
return $result;
}
示例5: prime
function prime( &$tr )
{
$tpl = eZTemplate::factory();
$tpl->setIsCachingAllowed( true );
eZTemplateCompiler::setSettings( array( 'compile' => true,
'comments' => false,
'accumulators' => false,
'timingpoints' => false,
'fallbackresource' => false,
'nodeplacement' => false,
'execution' => true,
'generate' => true,
'compilation-directory' => 'benchmarks/eztemplate/compilation' ) );
$expected = $tpl->fetch( 'benchmarks/eztemplate/mark.tpl' );
eZTemplateCompiler::setSettings( array( 'compile' => true,
'comments' => false,
'accumulators' => false,
'timingpoints' => false,
'fallbackresource' => false,
'nodeplacement' => false,
'execution' => true,
'generate' => false,
'compilation-directory' => 'benchmarks/eztemplate/compilation' ) );
$tpl->reset();
$this->TPL = $tpl;
}
示例6: run
protected static function run()
{
self::checkIfLoggedIn();
$ini = eZINI::instance('cookielaw.ini');
if (self::$isActive) {
$message = ezpI18n::tr('extension/occookielaw', "I cookie ci aiutano ad erogare servizi di qualità. Utilizzando i nostri servizi, l'utente accetta le nostre modalità d'uso dei cookie.");
if ($ini->hasVariable('AlertSettings', 'MessageText')) {
$message = $ini->variable('AlertSettings', 'MessageText');
}
$dismiss = ezpI18n::tr('extension/occookielaw', "OK");
if ($ini->hasVariable('AlertSettings', 'DismissButtonText')) {
$dismiss = $ini->variable('AlertSettings', 'DismissButtonText');
}
$info = ezpI18n::tr('extension/occookielaw', "Maggiori informazioni");
if ($ini->hasVariable('AlertSettings', 'InfoButtonText')) {
$info = $ini->variable('AlertSettings', 'InfoButtonText');
}
$tpl = eZTemplate::factory();
$tpl->setVariable('message', $message);
$tpl->setVariable('dismiss_button', $dismiss);
$tpl->setVariable('info_button', $info);
return $tpl->fetch('design:inject_in_page_layout.tpl');
}
return '';
}
示例7: render
/**
* Renders the block (returns HTML)
*
* @return string HTML
**/
public function render()
{
$tpl = eZTemplate::factory();
$tpl->setVariable( 'name', $this->name );
$tpl->setVariable( 'banners', $this->fetchBanners() );
$tpl->setVariable( 'cluster_identifier', ClusterTool::clusterIdentifier() );
return $tpl->fetch( 'design:presenters/block/channel.tpl' );
}
示例8: render
/**
* Renders the block (returns HTML)
*
* @return string HTML
**/
public function render()
{
$tpl = eZTemplate::factory();
$tpl->setVariable( 'articles', $this->getSolrArticles() );
$blockResult = $tpl->fetch( 'design:presenters/block/congressreport.tpl' );
eZTemplate::resetInstance();
return $blockResult;
}
示例9: displayForm
function displayForm($Result, $errors = null)
{
$tpl = eZTemplate::factory();
$tpl->setVariable('errors', $errors);
$Result['path'] = array(array('url' => '/', 'text' => ezpI18n::tr('mailchimp/subscribe', 'Home')), array('url' => false, 'text' => ezpI18n::tr('mailchimp/subscribe', 'Subscribe')));
$Result['title'] = 'Subscribe';
$Result['content'] = $tpl->fetch("design:mailchimp/subscribe.tpl");
return $Result;
}
示例10: render
/**
* Returns string with rendered content
*
* @return string
*/
public function render()
{
$tpl = eZTemplate::factory();
$ini = eZINI::instance('rest.ini');
$nodeViewData = eZNodeviewfunctions::generateNodeViewData($tpl, $this->content->main_node, $this->content->main_node->attribute('object'), $this->content->activeLanguage, 'rest', 0);
$tpl->setVariable('module_result', $nodeViewData);
$routingInfos = $this->controller->getRouter()->getRoutingInformation();
$templateName = $ini->variable($routingInfos->controllerClass . '_' . $routingInfos->action . '_OutputSettings', 'Template');
return $tpl->fetch('design:' . $templateName);
}
示例11: render
/**
* Renders the block (returns HTML)
*
* @return string HTML
**/
public function render()
{
$tpl = eZTemplate::factory();
$page = $this->fetchStaticPage();
$tpl->setVariable( 'core_content', str_replace( '/bundles/static-data/', '/esibuild/static/', $page->attribute('core_content') ) );
$renderResult = $tpl->fetch( 'design:presenters/block/content.tpl' );
eZTemplate::resetInstance();
return $renderResult;
}
示例12: displayAttribute
/**
* Invoca il template per il form di attributo
*
* @see SearchFormOperator::modify
* @param OCClassSearchFormHelper $instance
* @param OCClassSearchFormAttributeField $field
*
* @return array|null|string
*/
public static function displayAttribute(OCClassSearchFormHelper $instance, OCClassSearchFormAttributeField $field)
{
$keyArray = array(array('class', $instance->getContentClass()->attribute('id')), array('class_identifier', $instance->getContentClass()->attribute('identifier')), array('class_group', $instance->getContentClass()->attribute('match_ingroup_id_list')), array('attribute', $field->contentClassAttribute->attribute('id')), array('attribute_identifier', $field->contentClassAttribute->attribute('identifier')));
$tpl = eZTemplate::factory();
$tpl->setVariable('class', $instance->getContentClass());
$tpl->setVariable('attribute', $field->contentClassAttribute);
$res = eZTemplateDesignResource::instance();
$res->setKeys($keyArray);
$templateName = $field->contentClassAttribute->attribute('data_type_string');
return $tpl->fetch('design:class_search_form/datatypes/' . $templateName . '.tpl');
}
示例13: templateInit
/**
* Abstract method to initialize a template and eventually takes advantage of new 4.3 TPL API
* @return eZTemplate
*/
public static function templateInit()
{
$tpl = null;
if (eZPublishSDK::majorVersion() >= 4 && eZPublishSDK::minorVersion() < 3) {
include_once 'kernel/common/template.php';
$tpl = templateInit();
} else {
$tpl = eZTemplate::factory();
}
return $tpl;
}
示例14: doGetAll
public function doGetAll()
{
$result = new ezpRestMvcResult();
// Header
$tpl = eZTemplate::factory();
$tpl->setVariable('current_user', eZUser::currentUser());
$result->variables['menu'] = $tpl->fetch('design:page_topmenu.tpl');
$result->variables['news'] = $tpl->fetch('design:parts/news_header.tpl');
$result->variables['styles_ie'] = $tpl->fetch('design:page_head_style_ie.tpl');
$result->variables['footer'] = $tpl->fetch('design:page_footer.tpl');
return $result;
}
示例15: testIssue15852
/**
* Regression test for issue #15852
*
* indent() operator throws a warning when count parameter is negative
*/
public function testIssue15852()
{
set_error_handler( 'testErrorHandler' );
$tpl = eZTemplate::factory();
$templateDirectory = dirname( __FILE__ ) . DIRECTORY_SEPARATOR;
// Static variable test
$templateFile = "file:$templateDirectory/eztemplatetextoperator_regression_testIssue15852_static.tpl";
$tpl->compileTemplateFile( $templateFile );
try
{
$result = $tpl->fetch( $templateFile );
}
catch( Exception $e )
{
restore_error_handler();
if ( strstr( $e->getMessage(), "str_repeat" ) !== false )
{
$this->fail( 'Static variable, warning thrown: ' . $e->getMessage() );
}
else
{
throw $e;
}
}
$this->assertEquals( "This is a string", $result, "The original, unindented string should have been returned" );
// Dynamic variable test
$templateFile = "file:$templateDirectory/eztemplatetextoperator_regression_testIssue15852_dynamic.tpl";
$tpl->compileTemplateFile( $templateFile );
$tpl->setVariable( 'indent', -1 );
try
{
$result = $tpl->fetch( $templateFile );
}
catch ( Exception $e )
{
restore_error_handler();
if ( strstr( $e->getMessage(), "str_repeat" ) !== false )
{
$this->fail( 'Dynamic variable, warning thrown: ' . $e->getMessage() );
}
else
{
throw $e;
}
}
$this->assertEquals( "This is a string", $result, "The original, unindented string should have been returned" );
restore_error_handler();
}