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
0
votes
1 answer

Call of unknown method '_compile_source'. Smarty 3

Hopefully someone can help me with this. I am using smarty within CMSMS and have something called a User Defined Tag running within my page. This contains the following code: $db = cmsms()->GetDb(); $menu = $smarty->get_template_vars('page');…
user1098178
  • 697
  • 3
  • 9
  • 25
0
votes
1 answer

plugins directory conflict

I have been struggling since I started developing my own modifier functions to get my Smarty environment working the way it should. Specifically I seem to have to choose between being able to use the "built-in" functions or my own but not both. I'm…
ken
  • 8,763
  • 11
  • 72
  • 133
0
votes
1 answer

smarty custom modifier with sprintf, passing multiple params into function

How would I extend the $insert so that I can pass multiple parameters into the function e.g {"Sample text %s this more %s."|inject:$foo:$foo2}. At the moment it only works with 1 param. /** * Smarty inject modifier plugin * * Type: …
John Magnolia
  • 16,769
  • 36
  • 159
  • 270
0
votes
3 answers

Using default modifiers

I am trying to step a bit beyond the basic usage of Smarty and ran into a small problem using the default "capitalize" modifier. I am operating with the assumption that no explicit calls need to be made to use this operator so in my template I have…
ken
  • 8,763
  • 11
  • 72
  • 133
0
votes
1 answer

Smarty - assigning too many variables?

I'm using Smarty and trying to implement multi-language support on my CodeIgniter site. Is it OK to assign all the possible language variables in one place such that it is available to all pages, regardless of whether the language variable is used…
StackOverflowNewbie
  • 39,403
  • 111
  • 277
  • 441
0
votes
1 answer

List products for specific category

I am trying to list 4 products based on the category of the product I am in, so if I were viewing "Cool product" which has the category "Awesome category", I would like to view 4 of the latest "Awesome category" products within that product. I know…
Odyss3us
  • 6,457
  • 18
  • 74
  • 112
0
votes
1 answer

What is wrong in my smarty loop

{section name=i loop=(($data|count)/2) start=0}
{section name=ii loop=i start=(i+2)}
user1692333
  • 2,461
  • 5
  • 32
  • 64
0
votes
1 answer

Modify array contents in smarty?

We are using smarty, In one of our views we have: {if $header.showNav}...{/if} and if we want to set that we use: $header = $smarty->getTemplateVars('header'); $header['showNav'] = true; $smarty->assign('header', $header); Which works, But it seems…
Hailwood
  • 89,623
  • 107
  • 270
  • 423
0
votes
1 answer

Trouble with Smarty Template Engine

I am Having Trouble with Smarty. I need to do some calculations, Assignments, and Deletions in the .tpl file i.e. smarty. But the problem I am facing is that when ever I do {$idlist[$iSum+1]} It gives Error. here $idlist is an array and $iSum is a…
Nagri
  • 3,008
  • 5
  • 34
  • 63
0
votes
1 answer

Smarty modifer/plugin to get a labels from an array

This is the example array I get sent from the CMS to Smarty. [field] => Array ( [value] => 19 [options] => Array ( [labels] => Array ( [0] => --- Select --- [1] =>…
John Magnolia
  • 16,769
  • 36
  • 159
  • 270
0
votes
1 answer

Smarty subtemplate blocks break when updated

I am attempting to create a template using Smarty for php. I would like the template to be reusable so I inheriting it and substituting values using blocks. This works fine except when I need to access these block values in sub-templates. I am…
Krejko
  • 901
  • 1
  • 9
  • 23
0
votes
2 answers

Take away the first word from the string

How to remove the first word away in Smarty from a string, that looks like: $variable = "Word Quick brown fox"; And make it look like this afterwards on the output: $variable = "Quick brown fox"; Is there a way to do this without modifiers? I…
Ilia Ross
  • 13,086
  • 11
  • 53
  • 88
0
votes
1 answer

Array assign in smarty

Array ( [0] => Array ( [name] => willt [username] => willt ) [1] => Array ( [name] => Adam [username] => adamb ) ) I have an array and am assigning it to…
user1564141
  • 5,911
  • 5
  • 21
  • 18
0
votes
1 answer

Do I always need isset inside an if?

Is the following acceptable, even if $my_flag may not be set? {if ( $my_flag )} // Vrooom {/if} Do I always need isset to ensure notices aren't thrown, or does Smarty3 take care of things?
TheDeadMedic
  • 9,948
  • 2
  • 35
  • 50
0
votes
1 answer

Smarty Postfilters / Prefilters how to apply on template before output

I am rather confused about how to use post / pre filters with smarty. What I need to do, is to search and replace certain elements in the page before it is displayed. I would rather like to do this right before $smarty->display is called. That…
mspir
  • 1,664
  • 2
  • 21
  • 34
1 2 3
24
25