smarty

Is it possible to limit available tags/functions in Smarty templates?

we have a web application (you could say it's a CMS) where we allow users to edit their own templates We have e.g.: article.template page.template now we want to limit what users can or cannot do in their templateS. Of course, using PHP will be forbidden and that's possible with smarty. But is it possible to define what smarty functi...

php smarty loop multidimensional array

I'm using smarty for my site, and I'm trying to loop through an array to print out table rows... The array looks like this: Array ( [TM98800G] => Array ( [zid] => Array ( [0] => 90001 [1] => 90002 [2] => 90003 [3] =...

Minimalistic PHP template engine with caching but not Smarty?

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 resul...

still need smarty syntax highlighting in Eclipse PDT

How do I get smarty syntax highlighting in Eclipse PDT? The only project I was able to find is SmartyPDT, but it's outdated and isn't working with my current Eclipse install (PDT All in one, with Eclipse 3.5). EDIT: I recently found this post asking the same question from a long time ago. But the plugin linked in the accepted answer ...

How to detect the use of smarty template framework?

Besides the existence of Smarty.class.php (which is also arguable), how do we know that a php project is using smarty template framework just by looking at its file structure? ...

How to calculate totals with smarty php

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="listP...

Smarty multiple random numbers list

Hey Stackoverflow-Folks, is there any smart way to post random numbers (e.g. 1-4) in a list by using the smarty tpl-engine? standart list sorted 1-5: <ul> <li>1</li> <li>2</li> <li>3</li> <li>4</li> <li>5</li> </ul> Here's my solution (PHP): <ul> {foreach from=randomNumbers} <li>{smarty.randomNumbers}</li> {/foreach} </ul>...

Smarty issues with Fckediter

Hello all, I'm new to this forum , i hope u do not mind questions even if its stupid. i m trying to post a value from the fckeditor embedded in smarty template.The value submitted is, a b c d however when echo the posted value i get , a b c d which is very irritating because i want the actual value submitted....

How do I access variables with hyphenated names in Smarty?

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 synt...

Is there any advantages to integrate Smarty with Zend?

Hi, i am quite familiar with Smarty and recently decided to use Zend framework in implementation. because i am aware of the various advantages of Smarty, i insisted my contractor to integrate Smarty in. But now, i am questioning my assumptions. Should I integrate Smarty in with Zend framework? simply because I am familiar with Smart...

Smarty: Display a random sentence from array

I have a smarty template, that I want to display a random sentence on each reload. I could do it with this: in php file: $sentences = array('Hello you', 'Hi mate', 'Welcome'); shuffle($sentences); $smarty->assign('sentence', $sentences[0]); in template file: <h1>{$sentence}</h1> Is it possible to do all this in the template instea...

Assigning Object to View, big MySQL resultset.

Hello (Sorry for my bad English) Is it bad practice to assign object to view and call its methods in there? I use smarty as my template engine. In my controller I could do like this 1# $this->view->assign("name", $this->model->getName); and in my view <p>{$name}</p> OR 2# $this->view->assign("Object", $this->model); and in m...

Shopping Portal based on XML Data - XSLT or PHP?

For my bachelor thesis I want to implement a shopping (price comparison) portal prototype based on XML Data. The main requirement is to get a very clear and customizable HTML template, which should be hosted by the customer on his own webserver. I'm not very sure if XSLT meets this requirements, as it generates a lot of xsl-related cod...

tiny mce pop ups blank in smarty

I am using tiny mce with smarty but it shows blank pop ups such as in image,anchor,preview buttons. The code i have used in my tpl file is `{literal} tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepo...

Something like Smarty in ASP.NET ?

Recently, I was working with PHP. In PHP we have a powerful template engine like Smarty. Do we have something like Smarty in ASP.NET ? ...

How to include static html in php/smarty.

I have been asked to include some html snippet in this php/smarty page. It's basically a sales agreement at the end of an overview page before you pay. What is the code to include static html into my php/smarty template? Thanks... ...

foreach iteration in smarty?

How could i get two records in one iteration of foreach loop using smarty? OR should i use section? ...

Truncate a HTML formatted text with SMARTY.

Hi there! I've got a variable which is formatted with random HTML code. I call it to {$text} and i truncate it. The value is for example: <div>Lorem <i>ipsum <b>dolor <span>sit </span>amet</b>, con</i> elit.</div> If i truncate the text's first ~30 letters, I'll get this: <div>Lorem <i>ipsum <b>dolor <span>sit The problem is, I ...

how can I determine the path of a site using php/smarty?

Ok, say I have a page with the url: URL.com/checkout/completed, how can I setup an if statemet to perform: <if "This page has url of checkout/completed"> No Content <else> Content </if> Is there a way? A simple way, my php/smarty-fu lacks.. A lot. EDIT: {if $smarty.server.REDIRECT_URL eq 'http://www.euroworker.no/checkout/comple...

Checkbox show error.

Hi, I need to make this show an error if the user tries to leave the page without checking this tickbox. It has no other use other than visual, is there a way to implement such a thing? <span> <input value="1" type="checkbox" name="salgsvilkar" ID="checkbox2" style="float:left;" onclick="document.getElementById('scrol...