smarty

CodeIgniter + Smarty = Error

谁说我不能喝 提交于 2019-12-13 06:19:23
问题 Here's what I did: Downloaded and unzipped CI Downloaded and unzipped Smarty in /application/libraries/Smarty-3.1.4 Saved https://github.com/kzhiwei/codeigniter-smarty/blob/master/application/libraries/Smartylib.php to /application/libraries/Smartylib.php (also fixed line 2 to point to the correct folder) Added Smartylib in autoload libraries Created a test.tpl and called it from the controller: $this->Smartylib->display('test.tpl'); Now, I'm getting the following error: Fatal error: Call to

php inside literal script - .tpl

谁说胖子不能爱 提交于 2019-12-13 05:45:58
问题 How can i make a json_encode inside a literal javascript block? Basically this is smarty template. {literal} <script> function openWin() { var O = {php} echo json_encode($obj);{/php}; // syntax error alert(O); } </script> {/literal} 回答1: It's been a while since I had to fiddle with a Smarty template but I think you'd have to close the literal tag to run your php code. If you get an error, try removing the echo too - I can't remember if it's implicit or not when inside a smarty tag. {literal}

Checkbox not being sent in POST using PHP

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-13 05:03:30
问题 I have a checkbox and it is not being sent to the call back page using POST. I've read that it needs a value, and I supplied that, but am not sure what else could be wrong. Here's the checkbox code I am currently using. Smarty is being used here. {foreach from=$all_splash_carriers item=item} <tr> <td class="evp">{$item.carrier}:</td> <td><input name="{$item.splash_carriers_id}.splashcarrier.{$item.carrier_id}" value="{$item.url}"/><input type="checkbox" name="{$item.carrier_id}.checkbox"

Smarty using foreach

半城伤御伤魂 提交于 2019-12-13 04:59:17
问题 {foreach from=$last_comments item=lastcomment name=myLoop} <dt class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"><a href="{$lastcomment.link}" title="{$lastcomment.name|escape:html:'UTF-8'}">{$lastcomment.name|strip_tags|escape:html:'UTF-8'|truncate:25:'...'}</a></dt> <dd class="{if $smarty.foreach.myLoop.first}first_item{elseif $smarty.foreach.myLoop.last}last_item{else}item{/if}"> <div class="star_content clearfix"> {section name

How to access smarty variable and assign to jquery variable?

断了今生、忘了曾经 提交于 2019-12-13 04:43:39
问题 I just need your help about my code. My problem is how can I access smarty variable within jquery or javascript file? Becuase my smarty variable is a URL request from my controller. And I need to use that variable for creating validation. Here's my code. {$get.search_by} {**works without error**} {literal} <script type="text/javascript"> $(document).ready(function(){ var dispatch = "{$get.search_by}"; //can't access var new_class = "it3 ir3 il3 jt10 jr05 jl05 kt03 kr04 kl04"; var old_class =

Prestashop custom field in Product Feature not saving on Edit

99封情书 提交于 2019-12-13 04:34:06
问题 I have created a custom field for Product Feature in my module override. Custom field for Feature is not saving in the database on edit. But on Add new feature it works fine. Here is the code for my AdminFeaturesController.php file: <?php class AdminFeaturesController extends AdminFeaturesControllerCore { public function __construct() { $this->table = 'feature'; $this->className = 'Feature'; $this->list_id = 'feature'; $this->identifier = 'id_feature'; $this->lang = true; $this->fields_list =

How to edit Front Address form - Prestashop

旧城冷巷雨未停 提交于 2019-12-13 03:29:53
问题 I'm trying to use drop down list instead of textbox for 'City' field.(Like country list).I tried to edit address-form.tpl file.but it's contain smarty values.I don't know which .tpl/Controller i want to edit. address-form.tpl <section class="form-fields"> {block name='form_fields'} {foreach from=$formFields item="field"} {block name='form_field'} {form_field field=$field} {/block} {/foreach} {/block} </section> 回答1: finally i got a solution 1) add form type to city field classes/form

Fatal error: Uncaught CurlException: 26: couldn't open file “” thrown in

狂风中的少年 提交于 2019-12-13 03:08:25
问题 <?php ob_start(); include("/home/coversco/public_html/include/config.php"); ini_set('display_errors', 1); error_reporting(E_ALL); require 'src/facebook.php'; $facebook = new Facebook(array( 'appId' => "xxxxxxxxxxxx", //Facebook App ID 'secret' => "xxxxxxxxxxxx", // Facebook App Secret "cookie" => true, 'fileUpload' => true )); $user_id = $facebook->getUser(); if($user_id == 0 || $user_id == "") { $login_url = $facebook->getLoginUrl(array( 'redirect_uri' => 'http://18covers.com/upload/index

How to highlight active tab on the website menu?

蹲街弑〆低调 提交于 2019-12-13 02:23:18
问题 My question is : I have a menu items, and I want to highlight the active tab that users switch to that points to another page for sure . stackover flow use : .nav { float: left; font-size: 125%; } .nav ul { margin: 0; } .nav li { background: none repeat scroll 0 0 #777777; display: block; float: left; margin-right: 7px; } **.nav .youarehere { background: none repeat scroll 0 0 #FF9900; }** .youarehere a { color: #FFFFFF; } .nav li:hover { background-color: #FF9900; } .nav a { color: #FFFFFF;

Generate distinct smarty random numbers

。_饼干妹妹 提交于 2019-12-13 02:19:42
问题 I'm using smarty v2.6 and I want to generate random distinct numbers. I'm looking for an efficient, fast way to do it using already provided Smarty functions. This is my code for generating 5 random numbers (but not distinct): {assign var=min value=1}{assign var=max value =5} {section name=val start=$min loop=$max+1} {assign var=random value=1|mt_rand:15} {$random} {/section} 回答1: if you really need to do it in smarty templates method 1 {assign var="distinct_numbers" value=array_fill(1,15,'x'