Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 15 matches
Smarty Forum Index
Author Message
  Topic: How to throw custom exception on runtime
DerRebell

Replies: 0
Views: 3327

PostForum: General   Posted: Fri Sep 16, 2016 9:46 am   Subject: How to throw custom exception on runtime
When {foreach} fails to compile, it throws a SmartyCompilerException.
Syntax error in template "file:/snippet.tpl" on line 5 "{foreach}{/foreach}" missing "from" attribu ...
  Topic: Fetch sub templates like include (without output filters)
DerRebell

Replies: 8
Views: 7272

PostForum: General   Posted: Thu Sep 15, 2016 9:42 pm   Subject: Fetch sub templates like include (without output filters)
smarty_function_render_something($params, $template) {
$smarty = clone $template->smarty;
unset( $smarty->registered_filters['output']);
$code = '';
...
  Topic: Fetch sub templates like include (without output filters)
DerRebell

Replies: 8
Views: 7272

PostForum: General   Posted: Thu Sep 15, 2016 2:43 pm   Subject: Fetch sub templates like include (without output filters)
Are you sure your templates architecture is sane? O.o
It's highly professional.
May be I'm not so much a professionalů I can't imagine the circumstances, under which I'd be running an output filter ...
  Topic: Fetch sub templates like include (without output filters)
DerRebell

Replies: 8
Views: 7272

PostForum: General   Posted: Thu Sep 15, 2016 6:31 am   Subject: Fetch sub templates like include (without output filters)
It seems i fixed that by overriding the default template class.


<?php
class TemplateRenderer extends \Smarty {
public function __construct() {
$this->template_class ...
  Topic: Fetch sub templates like include (without output filters)
DerRebell

Replies: 8
Views: 7272

PostForum: General   Posted: Thu Sep 15, 2016 4:53 am   Subject: Fetch sub templates like include (without output filters)
Are you sure your templates architecture is sane? O.o
It's highly professional.
  Topic: Fetch sub templates like include (without output filters)
DerRebell

Replies: 8
Views: 7272

PostForum: General   Posted: Wed Sep 14, 2016 8:04 pm   Subject: Fetch sub templates like include (without output filters)
Since Smarty > 3.1.17, there were many changes in template caching, compiling, rendering sub templates via fetch () and running output filters.

And since the method fetch () doesn't support the ...
  Topic: Allow caching of output filters
DerRebell

Replies: 3
Views: 8774

PostForum: Feature Requests   Posted: Fri Jul 08, 2016 11:00 am   Subject: Allow caching of output filters
It seems that is finally possible to cache the result of output filters as in Smarty v3.1.29: See the example on my github fork: https://github.com/mreiche/smarty/tree/test/caching-output-filters/demo
  Topic: An output-kinda plugin
DerRebell

Replies: 15
Views: 25782

PostForum: Smarty 3   Posted: Fri Jul 08, 2016 11:00 am   Subject: An output-kinda plugin
It seems that is finally possible to cache the result of output filters as in Smarty v3.1.29: See the example on my github fork: https://github.com/mreiche/smarty/tree/test/caching-output-filters/demo
  Topic: Fetch sub template and keep the {nocache} section program.
DerRebell

Replies: 7
Views: 6383

PostForum: General   Posted: Mon Aug 24, 2015 11:01 am   Subject: Fetch sub template and keep the {nocache} section program.
Many thanks to U.Tews. Your tip solved my problem. It's still a little templating issue, but the feature I've implemented works now as expected:


{area id="test" assign="area&q ...
  Topic: Fetch sub template and keep the {nocache} section program.
DerRebell

Replies: 7
Views: 6383

PostForum: General   Posted: Mon Aug 24, 2015 7:38 am   Subject: Fetch sub template and keep the {nocache} section program.
Just another thought.

You could assign an array with the snippet files names and
{nocache}
{foreach $snippets as $name}
{include file=$name}
{/foreach} ...
  Topic: Fetch sub template and keep the {nocache} section program.
DerRebell

Replies: 7
Views: 6383

PostForum: General   Posted: Sun Aug 23, 2015 3:29 pm   Subject: Fetch sub template and keep the {nocache} section program.
I don't see, why would you want to do that programmatically.
Please provide a use case.

The use case is quite simple: In my CMS, the editor can select from a list of snippets and add them to the s ...
  Topic: Allow caching of output filters
DerRebell

Replies: 3
Views: 8774

PostForum: Feature Requests   Posted: Fri Aug 21, 2015 7:41 am   Subject: Allow caching of output filters
I modified Smarty to being able to write the output created by output filters. The patch is quiet simple, thats why I wonder that this feature is still not available.

I want to contribute that as a ...
  Topic: Fetch sub template and keep the {nocache} section program.
DerRebell

Replies: 7
Views: 6383

PostForum: General   Posted: Fri Aug 21, 2015 7:15 am   Subject: Fetch sub template and keep the {nocache} section program.
I want to fetch a sub template inside a template being rendered, which has a {nocache} section.

main.tpl:

<html>
<body>
{load_sub_template}
</body>
</html> ...
  Topic: An output-kinda plugin
DerRebell

Replies: 15
Views: 25782

PostForum: Smarty 3   Posted: Thu Sep 06, 2012 12:54 pm   Subject: An output-kinda plugin
Hi U.Tews. Im sorry, I've simplified my code and made errors. Typically, the variable $name is defined in this context.

My problem is simple to describe: the result after processing the output filt ...
  Topic: An output-kinda plugin
DerRebell

Replies: 15
Views: 25782

PostForum: Smarty 3   Posted: Tue Sep 04, 2012 12:54 pm   Subject: An output-kinda plugin
Could it be that this feature has been rejected? The result of my output filter test is not included in the cache file created by Smarty.

Im using Smarty 3.1.11.

Example code:



function sm ...
 
Page 1 of 1
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP