Search Results

Search found 173 results on 7 pages for 'smarty'.

Page 3/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • How to calculate totals with smarty php

    - by Kyle Sevenoaks
    Hi, I have a list of "before discount" prices on my checkout, I want to calculate the total amount of these in a new div at the bottom.. Any ideas? What I want to calculate: {if $item.Product.formattedListPrice} <div id="salg" title="Rabatt"></div> {/if} <div id="cart2Salg"> {if $item.Product.formattedListPrice} <span class="listPrice" title="Opprinnelige prisen"> {$item.Product.formattedListPrice.$currency} </span> {else} <span class="listPrice"> </span> {/if} </div> And how I tried to calculate it: {foreach $item.Product.formattedListPrice.$currency as $savedtotal} <div id="savedtotals"> {$savedtotal.formattedAmount.$currency}</div> {/foreach} Thanks.

    Read the article

  • Smarty: Tags Matching and Unpaired Tags Errors

    - by Martin Fousek
    Hello, today we would like to show you other improvements we have prepared in PHP Smarty Framework. Let's talk about highlighting of matching tags and error reporting of unpaired ones. Tags Matching Some of your enhancements talked  about paired tags matching to be able to see matching tags at first glance.We have good news for you that this feature you can try out already in our latest PHP Development builds and of course later in NetBeans 7.3. Unpaired Tags Errors To make easier detecting of template syntax issues, we provide basic tags pairing. If you forgot to begin some paired Smarty tag or you end it unexpectedly you should get error hint which complains about your issue. That's all for today. As always, please test it and report all the issues or enhancements you find in NetBeans BugZilla (component php, subcomponent Smarty).

    Read the article

  • This PHP/Smarty doesn't work in IE

    - by Kyle Sevenoaks
    I'm starting to get sick of IE's random problems. Page link. (Add things to the cart with the kjøp button and handlevogn) I have this little tiny code here, {foreach $cart.taxes.$currency as $tax} <div id="subTotalCaption2"><p style="width:100px;">{$tax.name_lang}:</p></div> <div id="taxAmount2"><p>{$tax.formattedAmount}</p></div> {/foreach} That's meant to display the amount of total tax for each of the items in the basket. (MVA 25%) This works in every other browser but not IE. Why? Why not? Just why? Any help at all would be very much appreciated.

    Read the article

  • Include a tpl file with variables (Smarty)

    - by user1640660
    I have a "links.tpl" file which contains lines with many variables such as below {assign var=link_main value="index.php"} {assign var=link_login value="?a=login"} but when i include this file in home.tpl using {include file="file.tpl"} the variables {$link_main}, {$link_login} are not included i put the {assign var=link_main value="index.php"} in home.tpl and it works but not from included file i have tried adding scope=global to variable and parent to include but nothing happened I tried the last few hours finding a solution, any help is appreciated

    Read the article

  • How do I access variables with hyphenated names in Smarty?

    - by abeger
    I've got a PHP page that parses an XML file with SimpleXml, then passes that object to a Smarty template. My problem is that the XML file has hyphens in its tag names, e.g. video-player. In PHP, this is no problem, I just use $xml->{'video-player'} and everything's fine. Smarty, on the other hand, throws a fit when I try to use that syntax. The only solution I've come up with so far is to use a variable to store the name, e.g., { assign var=name value="video-player" } { $xml->$name } But this isn't terribly graceful to say the least. Is there another, better, approach to referring to a hyphenated variable name in Smarty?

    Read the article

  • Minimalistic PHP template engine with caching but not Smarty?

    - by Pekka
    There are loads of questions for "the right" PHP template engine, but none of them is focused on caching. Does anybody know a lightweight, high-quality, PHP 5 based template engine that does the following out of the box: Low-level templating functions (Replacements, loops, and filtering, maybe conditionals) Caching of the parsed results with the possibility to set an individual TTL per item, and of course to force a reload programmatically Extremely easy usage (like Smarty's) Modest in polluting the namespace (the ideal solution would be one class to interact with from the outside application) But not Smarty. I have nothing against, and often use, Smarty, but I am looking for something a bit simpler and leaner. I took a look at Fabien Potencier's Twig that looks very nice and compiles templates into PHP code, but it doesn't do any actual caching beyond that. I need and want a template engine, as I need to completely separate code and presentation in a way that a HTML designer can understand later on, so please no fundamental discussions about whether template engines in PHP make sense. Those discussions are important, but they already exist on SO.

    Read the article

  • Find where a variable is defined in PHP (And/or SMARTY)?

    - by Jon
    I'm currently working on a very large project, and am under a lot of pressure to finish it soon, and I'm having a serious problem. The programmer who wrote this last defined variables in a very odd way - the config variables aren't all in the same file, they're spread out across the entire project of over 500 files and 100k+ lines of code, and I'm having a hell of a time figuring out where a certain variable is, so I can fix an issue. Is there a way to track this variable down? I believe he's using SMARTY (Which I can not stand, due to issues like this), and the variable is a template variable. I'm fairly sure that the variable I'm looking for was initially defined as a PHP variable, then that variable is passed into SMARTY, so I'd like to track down the PHP one, however if that's impossible - how can I track down where he defined the variable for SMARTY? P.S. I'm in Vista, and don't have ssh access to the server, so 'grep' is out of the question.

    Read the article

  • Smarty iteration: is there a similar function when not in a foreach loop?

    - by Kyle Sevenoaks
    Hi, I'm trying to add a JS fly to basket plugin to the site I'm working on, but the plugin needs unique productID numbers, is there a way to iterate this in Smarty when not in a foreach loop? Something like: {$smarty.foreach.foo.iteration} Here's the code I need to itrate: <span id="slidingProd57404045"> <a href="{link controller=order action=addToCart id=$product.ID returnPath=true}" rel="nofollow" class="addToCart" title="Bestill" onclick="addToBasket(57404045); return false;" id="fly_to_basket">&nbsp;</a> </span> The 57404045 needs to be iterated. Thanks.

    Read the article

  • php smarty not passing to browser unless logged in.

    - by Kyle Sevenoaks
    I'm not the best at understanding these things with php and smarty, but this is really annoying. On: http://www.euroworker.no/order, there is meant to be a display of the amount of tax included in the price like: Tax (25%): 772,- Totalt: 3861,- But unless the user has logged in or created a new account, the tax doesn't display. Here is the Smarty code: <tr id="taxtr"> <td>&nbsp;</td> <td>&nbsp;</td> {foreach $cart.taxes.$currency as $tax} <td>&nbsp;</td> <td colspan="4" class="subTotalCaption2">{$tax.name_lang}:&nbsp;</td> <td class="amount taxAmount2">{$tax.formattedAmount}&nbsp;</td> {$cart.formattedTotal.$currency {$GLOBALS.cartUpdate|@array_shift} {/foreach} </tr> I don't know about all the inner workings of this system (Livecart), but is there anything I can do or look through to make it force the calculation/display. Thanks..

    Read the article

  • Smarty html_options

    - by SeanJA
    For smarty's html_options function, is there a way to avoid having to do this (other than not using smarty that is)? {if $smarty.post} {html_options name=option_1 optins=$options selected=$smarty.post.option_1} {else} {html_options name=option_1 optins=$options} {/if} I realize that it won't show up in the template, but it seems like a bad practice to leave something that is not defined in the template (it also fills up my error logs with noise about undefined indexes).

    Read the article

  • Using a :default for file names on include templates in SMARTY 3 [closed]

    - by Yohan Leafheart
    Hello everyone, Although I don't think the question was as good as it could be, let me try to explain better here. I have a site using SMARTY 3 as the template system. I have a template structure similar to the below one: /templates/place1/inner_a.tpl /templates/place1/inner_b.tpl /templates/place2/inner_b.tpl /templates/place2/inner_c.tpl /templates/default/inner_a.tpl /templates/default/inner_b.tpl /templates/default/inner_c.tpl These are getting included on the parent template using {include file="{$temp_folder}/{$inner_template}"} So far great. What I wanted to do is having a default for, in the case that the file "{$temp_folder}/{$inner_template}" does not exists, it uses the equivalent file at "default/{$inner_template}". i.e. If I do {include file="place1/inner_c.tpl"}, since that file does not exists it in fact includes "default/inner_c.tpl" Is it possible?

    Read the article

  • How do I know which include path will be used in PHP?

    - by Joe Majewski
    When I run phpinfo() and look by the Configuration category under PHP Core, I see a directive titled include_path, with a local value and a master value. In this case, my local value is set to .: ./include: ../include: /usr/share/php: /usr/share/php/smarty: /usr/share/pear and my master value is set to .: /usr/share/php: /usr/share/pear: /usr/share/php/pear: /usr/share/php/smarty The reason I am trying to learn how this works is because there is a file in the system I am working on titled Smarty.class.php, which I'm sure sounds very familiar to anyone who uses Smarty Templating Engine. One of the PHP files has the following includes: require_once("Smarty.class.php"); require_once("user_info_class.inc"); The file user_info_class.inc is in the same directory as the file making the include, which makes perfect sense to me, and is the way that I've always referenced files. I decided that I wanted to open up the Smarty.class.php file and had assumed it would be in the same directory, but it was not. After doing a bit of digging, I discovered those php_ini variables, and was finally able to locate the file in the directory usr/share/php/smarty/. So it would seem that when making an include, it follows some sort of order between the Local and Master values for the include_path. Assuming that my deductions were correct thus far, can someone explain the order in which PHP searches for the files to be included?

    Read the article

  • Tooltips problem, making this javascript work with my smarty foreach loop, help pelase!

    - by Kyle Sevenoaks
    I am using an example of tooltips from http://www.dynamicdrive.com/dynamicindex5/stickytooltip.htm on www.euroworker.no/order I have this code here to work with, but it just doesn't seem to work correctly, I've tried everything I can think of (not a lot of things) Here's the code. {foreach from=$cart.cartItems item="item" name="cart"} <div class="{zebra loop="cart"}"> <div id="sgproductview"> <div id="cart2Varekode"> <p> {if $product.sku} <span class="param">{$item.product.sku}</span> {else} <span>{img src=$item.Product.DefaultImage.paths.1 alt=$item.Product.name_lang|escape}</span> {/if} </p> </div> <div id="cart2Produkt"> <p>{if $item.Product.ID} <a href="{productUrl product=$item.Product}" data-tooltip="sticky{$smarty.foreach.cart.iteration}" target="_blank">{$item.Product.name_lang|truncate:20}</a> {else} <span>{$item.Product.name_lang|truncate:20}</span> </a> {/if} </p> <p> {include file="order/itemVariations.tpl"} {include file="order/block/itemOptions.tpl"} {if $multi} {include file="order/selectItemAddress.tpl" item=$item} {/if} </p> </div> {if $item.Product.DefaultImage.paths.3} <div id="mystickytooltip" class="stickytooltip"> <div style="padding:5px;"> <div id="sticky1" class="atip" style="width:200px;"> <img src="{$item.Product.DefaultImage.paths.3}" alt="{$item.Product.name_lang|escape}"><br> {$item.Product.name_lang} </div> <div id="sticky2" class="atip" style="width:200px;"> <img src={$item.Product.DefaultImage.paths.3} alt="{$item.Product.name_lang|escape}"><br> {$item.formattedPrice} </div> <div id="sticky3" class="atip" style="width:200px;"> <img src="{$item.Product.DefaultImage.paths.3}" alt="{$item.Product.name_lang|escape}"><br> {$item.Product.name_lang}PRODUCT 3 </div> <div id="sticky4" class="atip" style="width:200px;"> <img src="{$item.Product.DefaultImage.paths.3}" alt="{$item.Product.name_lang|escape}"><br> {$item.Product.name_lang} </div> </div> </div> {/if} <div id="cart2Price"> <p class="actualPrice"> {$item.formattedPrice} </p> </div> <div id="salg"></div> <div id="cart2Salg"> <p></p> </div> <div id="antallbox"> <p class="cartQuant"> {textfield name="item_`$item.ID`" class="text"} </p> </div> <div id="cart2Total"> <p> {if $item.count == 1} <span class="basePrice">{$item.formattedBasePrice}</span><span class="actualPrice">{$item.formattedPrice}</span> {else} {$item.formattedDisplaySubTotal} <div class="subTotalCalc"> {$item.count} x <span class="basePrice">{$item.formattedBasePrice}</span><span class="actualPrice">{$item.formattedPrice}</span> </div> {/if} </p> </div> <div id="delete"> {if 'ENABLE_WISHLISTS'|config} <a href="{link controller=order action=moveToWishList id=$item.ID query="return=`$return`"}">{t _move_to_wishlist}</a> {/if} <a id="slett" href="{link controller=order action=delete id=$item.ID query="return=`$return`"}" title="Slett"><!--{t _remove}--></a> </div> </div> </div> {/foreach} Anyone can help? {html_image} doesn't work, by the way and all the extensions are present and correct.

    Read the article

  • Returning a reference from a Class member?

    - by nebukadnezzar
    Hi, I've a class that basically looks like this: class App { public function newTemplate($filename, $vars=array()) { $smarty = new Smarty; $smarty->compile_dir = $this->template_compile_path; if(count($vars) > 0) { foreach($vars as $v_key => $v_name) { $smarty->assign($v_key, $v_name); } } return $smarty; } } However, when I create a Instance of 'App', the reference to $smarty seems broken, as every call to the membermethods don't seem to do anything: $app = new App; $tpl = $app->newTemplate("index.tmpl"); $tpl->assign("foo", "bar"); // {$foo} does not appear with "bar" in the template Now I wonder why? Of course I tried to use references: ... public function &newTemplate() ... ... But that doesn't work. Variable references don't seem to work either: ... $tpl = &$app->newTemplate("index.tmpl"); ... What is causing PHP here not to return a proper reference? Help is very appreciated!

    Read the article

  • Smarty Tag help [closed]

    - by ntechi
    I am using an engine, where for forums Vbulletin is used and for Other thiiings social engine 3 is used, This was done by some professionals In one of the page I am having popular tags(In Social Engine) Its too long I want shortened it, How can I do it? here is my code {* SHOW POPULAR TAGS START *} <tr> <td align="left" valign="top"><img src="images/spacer.gif" alt="" width="1" height="10" /></td> </tr> <tr> <td align="left" valign="top"><table width="220" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td width="12" align="left" valign="top"><img src="images/blog_belowtl.jpg" alt="" width="12" height="10" /></td> <td width="196" align="left" valign="top" background="images/blog_belowtbg.jpg"><img src="images/spacer.gif" width="1" height="10" /></td> <td width="12" align="right" valign="top"><img src="images/blog_belowtr.jpg" alt="" width="12" height="10" /></td> </tr> <tr> <td align="left" valign="top" background="images/blog_belowlbg.jpg" style="background-repeat: repeat-y;">&nbsp;</td> <td align="left" valign="top"><table width="196" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <td align="left" valign="top" > {*<div class="articletags" > {foreach from=$popular_tags item=poptag} <a class="tag{$poptag.class}" href="articles.php?tag={$poptag.name}">{$poptag.name}</a> {/foreach} </div>*} {foreach from=$popular_tags item=poptag} {if $poptag.count == '1' } {assign var=cssClass value='tahoma15_cloud'} {elseif $poptag.count == '2' } {assign var=cssClass value='tahoma12bold_cloud'} {elseif $poptag.count == '3'} {assign var=cssClass value='tahoma13bold_cloud'} {elseif $poptag.count == '4'} {assign var=cssClass value='tahoma14bold_cloud'} {elseif $poptag.count == '5'} {assign var=cssClass value='tahoma15_cloud'} {else} {assign var=cssClass value='tahoma18bold_cloud'} {/if} <span class="{$cssClass}"><a href="articles.php?tag={$poptag.name}" class="{$cssClass}">{$poptag.name}</a></span> {/foreach} </td> </tr> </table></td> <td align="left" valign="top" background="images/blog_belowrbg.jpg" style="background-repeat: repeat-y;">&nbsp;</td> </tr> <tr> <td align="left" valign="top"><img src="images/blog_belowbl.jpg" alt="" width="12" height="10" /></td> <td align="left" valign="top" background="images/blog_belowbbg.jpg"><img src="images/spacer.gif" alt="" width="1" height="10" /></td> <td align="right" valign="top"><img src="images/blog_belowbr.jpg" alt="" width="12" height="10" /></td> </tr> </table></td> </tr> {* SHOW POPULAR TAGS END *} You can check the lenght of this tag, on this link http://www.managementparadise.com/articles.php Currently it is displaying very long on the widget area I am new on this, so any help will be appreciated :)

    Read the article

  • jQuery toggle show XHTML Smarty some clahes maybe? It doesn't show..

    - by Kyle Sevenoaks
    Hi, at this page new customer, there is something that it doesn't like, my boss asked me to make a show function that shows the new customer registration when the user clicks on the "ny kunde" button. Here is an example of the code I got working (I'm a jQuery noob). I guess there is some clash between this and the functions already installed on the page, but what? #roundbigboxnykunde is meant to be hidden on the page as on the jsfiddle example, but I have shown it to let you see what else is on the page. Code on my .tpl <button id="button1">&nbsp;</button> {literal} <script src="http://code.jquery.com/jquery-latest.js"></script> <script type="text/javascript"> $(function() { //checkbox $("#button1").click(function()1 $(".newCustomer").toggle("show"); }); });? </script> {/literal} <div class="newCustomer">... Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >