smarty

smarty displaying only first character from foreach

谁说我不能喝 提交于 2019-12-24 19:26:52
问题 I am just starting to use Smarty templates and have this very simple query: $result = mysql_query("SELECT `name`, `min_price` FROM `tblproductgroups` WHERE `hidden` != 'on' ORDER BY `order` ASC"); $data = mysql_fetch_array($result); $ca->assign('products', $data); And tempate file is like this: {foreach from=$products key=key item=product} {$product.name} - {$product.id}<br/> {/foreach} And the outcome comes out like this: V - V V - V 6 - 6 6 - 6 V is the first character for VPS (name) and 6

PrestaShop - How to retrieve Carrier ID in Smarty during the checkout process

本秂侑毒 提交于 2019-12-24 15:18:52
问题 I am using PrestaShop 1.5.3.1 and I want to retrieve the Carrier ID during the Payment step in the checkout process. In PrestaShop 1.4 I was using {$id_carrier} and it was working just fine, but it is not working in PrestaShop 1.5.x I want to show one payment method depending on selected carrier. For example: {if $id_carrier == 1} my content {/if} 回答1: On the payment page, you can retrieve the selected Carrier ID using the following Smarty variable: {$cart->id_carrier} This will work anywhere

Smarty Object Function with Associative Array Unexpected “=>”, expected one of: “”,“” , “)”'

霸气de小男生 提交于 2019-12-24 13:29:45
问题 I am having a problem with Smarty passing a PDO Object to Smarty it just doesn't like => . Is there a trick to get around this problem? Here is he error: {assign var='brgdatas' value="{$brgObj->fetchOneBrg(array('id'=>{$ststres[ststval].to_id}'))}"}" - Unexpected "=>", expected one of: "","" , ") Here is the code I am working with: {section name=ststval loop=$ststres} {if $ststres[ststval].type == 2} {assign var='brgdatas' value="{$brgObj->fetchOneBrg(array('id'=>{$ststres[ststval].to_id}'))}

Pagination (Previous | Next) with Smarty

为君一笑 提交于 2019-12-24 08:18:05
问题 I'm making a catalogue of clubs and I'd like to limit every page to 10 clubs for example, but I can't wrap my head around it. I've tried SmartyPaginate, but it doesn't work (spoke to the developer, told me not to use it). clubs.php <?php include('configs/pdo.inc.php'); include('libs/Smarty.class.php'); // create object $smarty = new Smarty; // Clubs ophalen try { $query = $oPDO->prepare("SELECT * FROM V_clubs WHERE Zichtbaar = 1 ORDER BY ID ASC LIMIT 10"); $query->execute(); $t = array();

Is there anything like Dwoo-s {with} or {loop} in Smarty 3 or earlier?

折月煮酒 提交于 2019-12-24 04:03:04
问题 {with} and {loop} plugins in Dwoo template engine change default context for variable name resolution. If in Dwoo you feed template: {$arr.foo} {with $arr} {$foo} / {$arr.foo} {/with} with data: array('arr' => array( 'foo' => 'bar' )) it will output: bar bar / because second {$arr.foo} actually means {$arr.arr.foo} in global context. Do you know how can I achieve similar effect in Smarty? Is there some builit in functionality or third party plugin that might allow me to have this? Do you have

Using regex replace with smarty template system?

痴心易碎 提交于 2019-12-24 03:33:03
问题 Here's what I currently have in my Smarty template: <div class="tbl_pagination"> {if $pager}{$pager->links}{/if} <div> My {$pager->links} will output this HTML: <div class="tbl_pagination"> <ul><li><a href="javascript:toPage(3)" title="previous page">Back</a></li> <li><a href="javascript:toPage(1)" title="page 1">1</a></li> <li><a href="javascript:toPage(2)" title="page 2">2</a></li> <li><a href="javascript:toPage(3)" title="page 3">3</a></li> <li class='active'>4</li> <li><a href="javascript

Strict Standards: Non-static method STemplate::assign() should not be called statically

白昼怎懂夜的黑 提交于 2019-12-24 01:44:37
问题 i Upgrade my old xampp (1.7.3) localhost server to 1.8.0 . now, not work smarty template engine (2.6.6) in my all page and i see Strict Standards error. what's problem? how to fix this ? NOTE : This Wroked Fine In Old Xampp(1.7.3). Section of Error : Strict Standards: Non-static method STemplate::assign() should not be called statically in C:\xampp\htdocs\tube\include\config.php on line 88 Strict Standards: Non-static method STemplate::create() should not be called statically in C:\xampp

Smarty: how to cache properly?

耗尽温柔 提交于 2019-12-24 00:34:40
问题 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 nocache tags around the dynamic data? Somehow tell Smarty not to cache the dynamic data? The dynamic data is assigned as a Smarty variable (e.g. via assign ). I think I need to try to maximize caching, but am struggling a bit at what needs to be cached,

Joomla to Static HTML website

☆樱花仙子☆ 提交于 2019-12-24 00:24:42
问题 I have a Hindi magazine website hosted on Joomla. Though helpful from publishing point of view the site was a maintenance nightmare. Joomla is so much susceptible to hacker attacks. My host will often shut down my site due to bots attacking my website. Recently I relaunched the site as a new Wordpress based site on a different name. The Joomla based website would therefore never be updated anymore. However, I do want to maintain the old content. I have used PHP but hardly am a power user. I

Is it possible to put variables inside config files?

流过昼夜 提交于 2019-12-23 22:20:06
问题 I use smarty to allow different languages on my site, which works OK so far. I store the texts in config files in different sections. But then there are sentences like this: " You have 6 new mails! ", which would be in german " Sie haben 6 neue Mails! " Now there's text before the number and behind the number, which is loaded from the database. And I would like to put it into the config file and just load the number on its own. so I have this in my "text.conf" [en] mail_count = "You have