smarty

Quitting Smarty to do it manually

大城市里の小女人 提交于 2019-12-01 15:15:14
I am facing the problem that I'm not really sure how to develop without a framework or a template engine. I started coding that way and now I want to go to basics. I used to work with this MVC schema, using Codeigniter and Smarty as a template engine. What I want to do now is to use raw php without both tools mentioned. I don't know how to "copy" the concept of Smarty's "block" and "extends". I used to define a base.tpl file which had html head, only the body tag, and the base css and js files (the ones that are always used in every page of the site), like this: (snippet) <!DOCTYPE html> <head

Pure PHP/HTML views VS template engines views

左心房为你撑大大i 提交于 2019-12-01 14:51:21
问题 I would like to know which approach is faster, using the pure PHP in the HTML files or using a template engines like Smarty,Twig, ... What I would particularly like to know is next: which is parsed faster, is the Smarty cache for example faster than using pure PHP? Which of the template engines is the fastest? I'm about to rewrite simple application where speed is on the first place. 回答1: "Depends" is the answer to all your questions. What is "faster"? Execution time? Development time?

Edit Prestashop current orders view

为君一笑 提交于 2019-12-01 13:19:38
问题 I'm using Prestashop 1.6.0.9. I wish to edit the raw HTML for this part. Full size image link: http://i.stack.imgur.com/hazQp.png I wish to add an extra colum to the filters but I can't actually find the code for it... I have searched through the adminXXXX/themes/default/template/ directory. Specifically the orders files but they only seem to be relevant for the view you get when you actually click on one of the orders listed below. (Below meaning the orders below the filters that you can't

What to use for localization (php/smarty/pear application)?

99封情书 提交于 2019-12-01 09:34:27
问题 I have a php/smarty/pear app that has it's own localization implementation that involves using ids for strings and the strings are stored in a db. currently the app is only in English but I will start adding other languages. The current implementation is very poor and basically I'm not a big fan of re-inventing the wheel. Can anybody recommend what to use for localization? I had used gettext years ago, is that still used or is there something newer and better ? thanks in advance. 回答1: I would

convert smarty array to javascript array

℡╲_俬逩灬. 提交于 2019-12-01 08:40:42
问题 I have a smarty array $promoFormData Smarty_Variable Object (3) ->value = Array (1) deliveryDates => Array (3) 0 => Array (2) startDate => "2013/06/05" endDate => "2013/06/28" 1 => Array (2) startDate => "2013/07/05" endDate => "2013/07/28" 2 => Array (2) startDate => "2013/08/05" endDate => "2013/08/28" I want to use this array deliveryDates as available dates in datepicker. So trying to convert the above as the following Javascript array var ranges = [ { start: new Date(2013, 06, 05), end:

Smarty (and other tpl ngins): assign and assign_by_ref

岁酱吖の 提交于 2019-12-01 08:07:30
This is not just about Smarty, but I guess most template engines that have variables assigned. It's more a theoretical question, than a practical. I have no use case. What happens in PHP when you assign a big array $a to another variable $b ? PHP copies the array? Maybe, just maybe, internally it creates a pointer. Then what happens when you alter $a slightly? $b shouldn't be changed, because no & was used to create $b . Did PHP just double the memory usage?? More specifically: What happens when you assign a big array from you Controller ( $a ) to your template engine ( $tpl->vars['a'] ) and

Smarty (and other tpl ngins): assign and assign_by_ref

ぐ巨炮叔叔 提交于 2019-12-01 06:47:23
问题 This is not just about Smarty, but I guess most template engines that have variables assigned. It's more a theoretical question, than a practical. I have no use case. What happens in PHP when you assign a big array $a to another variable $b ? PHP copies the array? Maybe, just maybe, internally it creates a pointer. Then what happens when you alter $a slightly? $b shouldn't be changed, because no & was used to create $b . Did PHP just double the memory usage?? More specifically: What happens

How to parse/decode JSON object in smarty template?

﹥>﹥吖頭↗ 提交于 2019-12-01 05:42:51
I have the following code in my template file: {foreach from=$items item=entry} <pre> {$entry->nb_persons|@print_r} </pre> {/foreach} The output is (json string): {"ip":"12.12.12.12","date":1375616434,"cartitems":["foo:1"],"company":"dsad","FirstName":"sad","LastName":"asdsad","street":"","postcode":"","city":"","country":"Andorra","phone":"456456","fax":"","email":"sad@sad.com","comefrom":"google","request":"","message":"sadads"} I would like to print each element seperated, for example : {$entry->nb_persons.company} Should give me -> "dsad" But this is not working and I'm not sure why. JSON

Smarty getting substring of a var with strpos as start and strlen as end

非 Y 不嫁゛ 提交于 2019-12-01 03:31:18
I am having issue formatting variables in smarty. I was wondering what is the best way to do it. Basically i have a string "ABC | DEFGH" i want smarty to get the substring of "DEFGH" How would i go about doing this? {$var|substr:strpos:"|":strlen} doesn't work Just solved this without setting var back in PHP, and by using the built-in function wrappers. Assuming that: $var = "ABC|DEFGH"; {assign var="bar_at" value=$var|strpos:"|"} <li>{$var}</li> <li>{$var|substr:0:$bar_at}</li> <li>{$var|substr:$bar_at+1}</li> This will print: ABC|DEFGH ABC DEFGH Some info about Smarty 3 in case if someone

How to parse/decode JSON object in smarty template?

与世无争的帅哥 提交于 2019-12-01 03:19:08
问题 I have the following code in my template file: {foreach from=$items item=entry} <pre> {$entry->nb_persons|@print_r} </pre> {/foreach} The output is (json string): {"ip":"12.12.12.12","date":1375616434,"cartitems":["foo:1"],"company":"dsad","FirstName":"sad","LastName":"asdsad","street":"","postcode":"","city":"","country":"Andorra","phone":"456456","fax":"","email":"sad@sad.com","comefrom":"google","request":"","message":"sadads"} I would like to print each element seperated, for example : {