Questions tagged [smarty-plugins]

making plug-ins for the Smarty PHP template system. Also consider using appropriate smarty version tag.

17 questions
7
votes
1 answer

Smarty registerPlugin function as argument

In Smarty, it is possible to register an plugin in this way: $smarty->registerPlugin("function","date_now", "print_current_date"); function print_current_date($params, $smarty) { if(empty($params["format"])) { $format = "%b %e, %Y"; } else…
tiefenb
  • 732
  • 3
  • 16
  • 32
4
votes
1 answer

Where to register global smarty modifier in PrestaShop?

I'm creating a store based on PrestaShop (v 1.6), and I want to register my custom modifier plugin to be accessible from any templates (includinf front and back-officetemplates). The question is where to place the registration code? Now I use a…
AlexandrX
  • 806
  • 8
  • 18
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
1
vote
0 answers

My smarty-gettext 'Hello world' sample is not working

Using Smarty 2.6.28 over PHP 5.6.11, I'm trying to create a Multi-language website. For that, I'm trying to use 'smarty-gettext' (https://github.com/smarty-gettext/smarty-gettext). The root directory of my web server is '/foo'. I followed the…
Hookstark
  • 1,097
  • 3
  • 11
  • 23
1
vote
1 answer

Smarty Template Engine - Unload/Disallow plugins while using $smarty->fetch

How can I unload or disallow smarty core plugins from a template when using $smarty->fetch('mytemplate.tpl') method For example the template mytemplate.tpl contains {html_options} and {html_table} When using $smarty->fetch('mytemplate.tpl') only the…
Ole K
  • 754
  • 1
  • 9
  • 32
1
vote
1 answer

smarty plugin to get the first image from a text

I have a smarty variable that outputs an array like this: $article = Array(10) id => "103" categoryid => "6" title => "¿Cuánto espacio necesito para mi siti..." text => "
1
vote
0 answers

Smarty plugin, pass by reference

I need to write a custom recursive function for displaying a tree structure. The function signature is as follows: function smarty_function_categories($params, &$smarty) My problem is that I cannot declare $params as &$params as this is not…
pankal
  • 124
  • 13
0
votes
1 answer

Smarty is not expiring or overwriting its compiled and cached templates

I am using Smarty (latest version v4.3.0) for my PHP project. is not expiring or overwriting its compiled and cached templates. I have explicitly defined a NO-CACHE behaviour. The code for that is: // Smarty & configuration $this->smarty = new…
Kladskull
  • 10,332
  • 20
  • 69
  • 111
0
votes
1 answer

in smarty version3 I see in folder structure we have 2 plugin directory which should use for create custom plugin function?

see file structure in screenshot atachment Hello Friends, I see in smarty template version3 two plugin directory. one into project folder and other into libs. In libs folder we have plugins and sysplugins directory. My question is I need to…
0
votes
1 answer

Upgrade from smarty 2 to 3 Unexpected "|"

I am sorting out issues in a smarty upgrade from 2 to 3 and I am getting this error and I can't figure out why: Fatal error: Uncaught --> Smarty Compiler: Syntax error in template {$item.content_group_name | htmlspecialchars} - Unexpected…
kgrondell
  • 177
  • 2
  • 8
0
votes
1 answer

How to create plugin on Smarty?

{php} $ssa = array(3,4,5,6,7,8); $sl = array(); $this->assign('shoe_sizes', $ssa); $this->assign('sl', $sl); {/php} I have this php code in smarty template but smarty doesn't allow/recommend {php} tag using in templates…
0
votes
1 answer

Why did smarty registerPlugin() stop workgin somewhere around v3.1.30?

I migrated from smarty v3.1.29 to v3.1.33 and my registered plugins stopped working. Why? I used this syntax: $this -> registerPlugin ( "function", "tpl_func", "php_func" ); The behaviour goes wrong only with php 7.0. With php 7.3.14 it still works…
Csongor Halmai
  • 3,239
  • 29
  • 30
0
votes
0 answers

Is there a way of parsing information from smarty?

I have three files, a weather.php file which contacts an API and returns weather to my weather.tpl file. However I want to take the contents of the weather.tpl file (which only contains the api response) and post it to another page, any ideas about…
CoderHarry
  • 13
  • 6
0
votes
0 answers

Audit Log Module For Smarty

We are using smarty 3.x for one of our project. Now we need to log each and every action. Also we have to save the existing data and new data in log table in database. So Is there any module available in smarty for audit log ? If yes then can you…
Prashant
  • 7
  • 2
0
votes
1 answer

Working with smarty template engine for WHMCS. Need to use php function from external php file in .tpl file

Trying to fetch output in A.tpl but not getting any output. I think i'm doing something wrong to call php function in tpl file. A.tpl {myModifier} B.php class Geolocation{ public function sm_loc($params, Smarty_Internal_Template $template) …
1
2