smarty

Can I alter the way Bootstrap places columns?

六眼飞鱼酱① 提交于 2019-12-11 15:48:51
问题 I am looking for a way to make a row with 8 col-md-6 divs display in a different way than usual. How bootstrap normally does it: How I want it: The number columns is dynamic so it can exceed 20 for example and be a uneven number. Code: <div class="row"> {foreach from=$item.Opties|default:array() name=optie item=optie key=key} <div class="col-md-6"> test {$optie@iteration} (normally there is more code in here) </div> {/foreach} </div> I have tried: order-md-* but for this solution i need to

Server displays old version of site

旧巷老猫 提交于 2019-12-11 15:47:02
问题 Good day to all. I have a site (created with zend framework and smarty) hosted on a virtual machine (vmware) with centOS 5.2. Everything worked fine for about 2 month, but a problem occurred now. I am trying to modify some .tpl files and after I save and upload on server (the one on the virtual machine) the server gives me the old version of the page. Already cleared cache, change browser, etc... is not browser related. I tried on different computers and all have the same result. I also

Generating {$num} inside {foreach}

六月ゝ 毕业季﹏ 提交于 2019-12-11 13:07:09
问题 I working on smarty template. I need to have numbers to my list array So I tried {foreach} {$num} {/foreach} Which prints 0 1 2 3 4 5 ........ I want my numbers to starts from 1 & not 0 How can I achieve this? OR Is there any other way to do it ? Thanks 回答1: {foreach} {$num|assign:$num+1} {$num} {/foreach} or {foreach}{assign var=newnum value=$num+1} {$newnum} {/foreach} 来源: https://stackoverflow.com/questions/3395439/generating-num-inside-foreach

How do I add a new member variable in PHP?

天涯浪子 提交于 2019-12-11 10:45:42
问题 I want to do something like: class Name{ function assign($name,$value){ } } Which is pretty much the same as assign in smarty: $smarty->assign('name',$value); $smarty->display("index.html"); How do I implement this? 回答1: class Name { private $values = array() function assign($name,$value) { $this->values[$name] = $value; } } 回答2: The question's a little vague. If you want to keep the $value of $name around for future use you could do something like: class Name { protected $_data= array();

unknown tag “l” in smarty prestashop

五迷三道 提交于 2019-12-11 09:15:34
问题 We are developing a module in prestashop. At a place, we need to define new smarty object to create and fetch new template. This is working fine but when we using language variable in that custom smarty template then its giving us error for unknown tag "l" in tpl file. Below are code in which we are getting error: In module controller: class MymoduleTestModuleFrontController extends ModuleFrontController { function initContent(){ $this->context->smarty->assign('temp', $this->test()); $this-

Smarty: How to read a {$var} stored in the database?

蓝咒 提交于 2019-12-11 08:34:47
问题 I use codeigniter with smarty. I have a variable stored in the db called $serverName . I want to expand it to its actual value "Pedrosite" . But when the page is loaded, it displays exactly {$serverName} and not the value. So I found this solution on stackoverflow, using smarty's fetch function: $data['content'] contains the text from the database. $data['content'] = $this->CI->smarty->fetch('string:'.$data['content']); With that, I can display the smarty vars, like: {$smarty.const.FCPATH}

If IE then include file [A] else include file [B]

回眸只為那壹抹淺笑 提交于 2019-12-11 08:14:54
问题 I have page for which I want to load different content for different browsers . Example : IF Internet explorer {include file="/content1.tpl"} ELSE if any other browser {include file="/content2.tpl"} {/if} Content1.tpl & Content 2.tpl are two different files having their respected Html & CSS. How can I achieve this using Javascript OR php ? Thanks, Mandar EDIT What I want is, IE to completely neglect content2.tpl & Mozilla or Other to completely neglect content1.tpl 回答1: Don't use PHP for this

How can I use such statement in smarty?

女生的网名这么多〃 提交于 2019-12-11 06:55:05
问题 {assign var=tmp_url value=setURI(array('page' => 1))} It seems array() can't be used in smarty ? I tried various ways ,but none work. Anyone knows the trick? 回答1: try this, In php file, write a function <?php function getSetUri(){ return setURI(array('page' => 1)); } ?> In template file, just call the function {assign var=tmp_url value=getSetUri()} 回答2: as far as I can tell there is no native way of setting an array in smarty you could assign the array to smarty templete in your php and call

use } into smarty string

为君一笑 提交于 2019-12-11 06:29:09
问题 Im trying to use the key sign '}' inside a string of smarty template but it generate an error. The problem only ocurrs with '}' and not with '{´. I need print: var naciones = [{label:'Country', value:'1'}, {label:'Country', value:'2'}]; solution: var naciones = [{/literal}{foreach from=$paises item=pa}{literal}{label:"{/literal}{$pa->getNacionalidad()}{literal}", value:"{/literal}{$pa->getId()}{literal}"},{/literal}{/foreach}{literal}]; example: {literal} <script type="text/javascript"> var

Smarty/PHP Regex replace

孤者浪人 提交于 2019-12-11 05:48:44
问题 I have the next string: countries_united_states_ohio sometimes it can be countries_spain_madrid How can I remove the word Countries and have the next output: United States, Ohio or Spain, Madrid I'm using Smarty and I tried something like this: {$string|replace:"_":", "|capitalize} The problem is that it returns United,States(as expected) and I guess I could remove the word 'countries' using substr. Anyone has any idea? Thank you! 回答1: I think I found a way. You will need a list of all