Questions tagged [smarty3]

Smarty is a template engine for PHP. It enables programmers and web-designers to implement the MVC architecture pattern. The templates created can be re-used very easily.

Smarty3 is the most up-to-date branch of Smarty template engine. It requires PHP 5.2+

Last Smarty3 version is 3.1.31 and was released on Dec 14, 2016

Links

373 questions
4
votes
2 answers

Smarty: How to fix "unknown modifier 'rewrite'" exception?

After upgrading Shopware from 5.2 to 5.3 the following exception occured: Smarty: unknown modifier "rewrite" The error happens in a template-file. Obviously the "rewrite" modifier was removed. How can i substitute it in the template files? {*…
delete
  • 18,144
  • 15
  • 48
  • 79
4
votes
1 answer

How to integrate PHP smarty template with Vue.js?

Am working with Smarty templating engine in PHP and want to integrate VUE.js into my application but seems like Smarty doesn't understand Vue.js syntax (double curly braces) Code Below: home.tpl {include file="partials/header.tpl" title="Home"}…
Zeeshan
  • 165
  • 1
  • 13
4
votes
2 answers

Smarty, use template functions from included template

I have a Smarty (version 3.1.21) template like this:
{include file='includes/test.tpl'} {pagebuilder data=$data.top_description}
includes/test.tpl content is: {function name=pagebuilder} {foreach $data as $row} ... …
David Auvray
  • 288
  • 1
  • 3
  • 20
4
votes
1 answer

How can I use set of PHP functions in Smarty

I’m really new to smarty. I would like to know how to use set of PHP functions in smarty. I understand that some functions can be used straight away. Ex: {$my_string|strip_tags} I’m using PDO along with smarty. Please see below code where I get my…
Jordyn
  • 1,133
  • 2
  • 13
  • 28
4
votes
3 answers

Put CSS parts together with SMARTY + PHP

How to separate css file completely I’m thinking how to place CSS parts together in html file generated by Smarty + php. CSS should be included within the header, but what if the page does have some individual CSS style? I use a template engine…
Toshi
  • 6,012
  • 8
  • 35
  • 58
4
votes
1 answer

How to make Smarty automatically escape all template variables but ignore captures

I want to automatically escape all template variables, that is, I want them to be escaped without having to write |escape all the time. Thus I enabled the $escape_html option. However, apparently Smarty treats variables created using {capture} the…
Jens Ljungblad
  • 566
  • 1
  • 5
  • 11
3
votes
2 answers

Can I combine Smarty tpl and HTML highlighting, hinting, snippets, autocomplete in VS Code

Using VS Code, I have "Smarty syntax highlighting" installed, works fine. I also set "emmet.includeLanguages": { "smarty": "html" }, so I can use emmet abbreviations, but I do not get the hinting/autocomplete for HTML. I can add…
Chad
  • 1,139
  • 17
  • 41
3
votes
2 answers

Smarty3 block append in included template

I have some templates written with Smarty 3: A layout page An index page An include page layout.tpl: {block "css"}{/block} {block "js"}{/block} {block "content"}{/block} index.tpl: {extends "layout.tpl"} {block "content"} content text {include…
Dong
  • 911
  • 2
  • 9
  • 25
3
votes
1 answer

Switch and case with Smarty templates?

I’m new to smarty. I’m trying to use switch and case function with smarty. This is the php code I use $i=1; while ($row = mysqli_fetch_array($sql)){ switch($i%8){ case 1: case 2: //DO Something Here …
Jordyn
  • 1,133
  • 2
  • 13
  • 28
3
votes
1 answer

Smarty : round up to decimal

I have been looking for few hours now and can't figure out a solution. I need a way to round up a price to it's upper decimal, in my template (smarty, I can't edit any php file) I tried with the round function, but can't figure out how to give the…
Cypc
  • 177
  • 1
  • 9
3
votes
1 answer

Can Smarty read only one block instead of in template?

For the beginning I'm really new to Smarty. I got some template files that need to be parsed sometimes first. So it would be interesting to know if Smarty can parse only one special block instead of the whole file with many blocks. There is a…
Timo.Klement
  • 655
  • 1
  • 11
  • 31
3
votes
3 answers

Smarty total amount sum

how can I count the final price to pay if I have the following code $Total : {foreach from=$items key=k item=item} {$item.Title}
Fortran
  • 593
  • 4
  • 14
3
votes
2 answers

How to turn off html escape in Smarty

I am using html_checkboxes for generating select menu. The problem is that in the checkbox name I have some html code and Smarty escapes it. I have: {html_checkboxes name='select_menu' values=$user_data[1] output=$user_data[2]} I get: Status:
Andresh Podzimovsky
  • 1,511
  • 4
  • 13
  • 17
3
votes
2 answers

Upgrading Smarty from Smarty v2 to v3

I am in the process of upgrading a PHP-based site from Smarty2 to Smarty3. I have managed to get most everything working on both versions by replacing require_once('Smarty.class.php' with the following: @ include_once('SmartyBC.class.php'); if…
undefined
  • 6,208
  • 3
  • 49
  • 59
3
votes
2 answers

How to fetch() sub-parts of a Smarty template

Background Smarty is a templating engine that separates the presentation layer from the logic layer of web applications. It is well-suited for the Model-View-Control approach to developing web applications. The View can be represented by Smarty…
Hamman Samuel
  • 2,350
  • 4
  • 30
  • 41
1
2
3
24 25