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
3
votes
3 answers

dynamic array key in smarty

I just want to know how to access an array in SMARTY that have generated index via smarty. I want to access it later. Got something like this: {if $smarty.get.{param_{$k.id}_{$p.num}} eq $key} and I like to access $smarty.get.(dynamic generated…
pawel-kuznik
  • 437
  • 4
  • 11
2
votes
1 answer

Smarty Paginate Plugin and Twitter Bootstrap

I try to implement Twitter Bootstrap pagination with Smarty Paginate plugin. Thats my problem: when I create paginate block, looks like:
Julika
  • 109
  • 1
  • 1
  • 8
2
votes
3 answers

Remove extra HTML spaces in Smarty

We heavily use Smarty for all our front end templating. I have observed the following situation: When my Smarty template is similar to as follows:
  • {if $a == 'A'} {$var1} {else} {$var2} {/if} …
  • Sparsh Gupta
    • 2,163
    • 5
    • 19
    • 21
    2
    votes
    2 answers

    How do you get Smarty3 to work with Symfony2?

    I'm trying to get Smarty 3 to work as a template engine for Symfony 2. I'm trying to install this bundle to get smarty 3 to work: https://github.com/noiselabs/SmartyBundle It installs just fine, but when I add it to the AppKernal as it says in the…
    ContextSwitch
    • 2,830
    • 6
    • 35
    • 51
    2
    votes
    1 answer

    Smarty {if $foo} equivalent to isset()

    Is there a way to change the smarty core {if $foo} so that it uses the isset() and $foo|default:$foo2? The reason I ask this is because I am getting PHP warning messages. I understand that I can do {if isset($foo)} although it is a lot clean to…
    John Magnolia
    • 16,769
    • 36
    • 159
    • 270
    2
    votes
    1 answer

    Smarty: how to cache properly?

    Say I have a page that contains dynamic content (e.g. search results). What is the proper caching technique? Put nocache tags around the entire page? Put nocache tags around the segment of mark up that actually contains the dynamic data? Put…
    StackOverflowNewbie
    • 39,403
    • 111
    • 277
    • 441
    2
    votes
    1 answer

    my smarty got unknown tag , but it is a legal tag

    currently i change smarty 2 -> version 3 but after i change got problem as below. SmartyCompilerException: Syntax Error in template "/home/test/engine/mobile9/template/t_footer.tpl" on line 28 "{php}" unknown tag "php" in…
    Leon
    • 413
    • 2
    • 9
    • 23
    2
    votes
    4 answers

    How to combine two string in Smarty?

    Why doesn't this work in Smarty? {my_function($test.'a1')} It's showing following error: Fatal error: Uncaught exception 'SmartyCompilerException' with message 'Syntax Error in template "test.tpl" on line 1 "{my_function($test.'a1')}" Unexpected…
    user861587
    • 69
    • 1
    • 2
    • 9
    2
    votes
    1 answer

    return a smarty template to a html text box

    I want to use smarty to return some html to a text box in the back end of my web site. I am already using smarty to render the backend itself. Whats the best way to do this? I'm assigning a single array to smarty in the usual way, but not sure how…
    Matthew
    • 596
    • 1
    • 8
    • 29
    2
    votes
    1 answer

    Smarty allow_php_tag reports 'Undefined property: Smarty::$allow_php_tag'

    So I have an old website which uses an older version of smarty, as today I wanted to upgrade to latest version, and it hit's me with an error: [Fri Aug 19 11:21:19 2011] [error] [client ***.***.***.***] PHP Notice: Undefined property:…
    Mihai Iorga
    • 39,330
    • 16
    • 106
    • 107
    2
    votes
    2 answers

    Smarty::$_tpl_vars - Undefined property - Support for _tpl_vars in Smarty 3

    I am migrating my old PHP 5.2.14 and Smarty 2.6.19 to PHP 7.3.25 + Smarty 3.1.34. The PHP code base is quite huge and I have used Smarty::_tpl_vars array to access assigned variables. $smarty->assign("myvar","var-value"); $myvar =…
    RJ.
    • 332
    • 5
    • 16
    2
    votes
    3 answers

    How can i check if image file exists on smarty using URL?

    I want to check if the webp image is exists on the server on smarty. The URL is an absolute URL like this. i tried {if file_exists("https://example.com/image.webp")} {/if} and {if 'https://example.com/image.webp'} {/if} But none is working. Can…
    2
    votes
    4 answers

    How to add object to smarty without error: undefined extension class 'Smarty_Internal_Method_Register_Object'

    I added Smarty 3.1.33 to my project with composer. The basic functionality works fine, but now to my I want to add an object to Smarty. For this I follow the documentation and have this code: class My_Object { function meth1($params,…
    Ted
    • 83
    • 1
    • 10
    2
    votes
    1 answer

    How to Enable Php code in Smarty 3.1.31

    I downloaded a system and apparently it was created using Smarty Template Engine. I am not familiar with this template engine and i am having a hard time achieving what i want. I want to add text on an image and i found this code:
    Ronald Torres
    • 199
    • 2
    • 4
    • 19
    2
    votes
    1 answer

    PHP file with accompanying compiled file

    I have inherited a php system written using Smarty. The code is split into class files and templates which I can work my way through. However, for each template file, there is another file written similarly to the template file but with a strange…
    Jimcee
    • 21
    • 2
    1 2
    3
    24 25