smarty

Is there a specific smarty function to order alphabetically an array?

Hi, I'm using a smarty template for a multi-language website. I got an array of country that is order by country code, which is ok for the english version as country name are in the right order but no ok for other languages (for example United Kingdom stay in the "U" whereas in French it prints "Royaume Uni". Is there a smarty function...

What is the best way to cache files in php?

hi , i'm using Smarty with my php code and i like to cache some of website pages so i used the following code : // TOP of script ob_start(); // start the output buffer $cachefile ="cache/cachefile.html"; // normal PHP script $smarty->display('somefile.tpl.html') ; $fp = fopen($cachefile, 'w'); // open the cache file for writing fwri...

Can sIFR work with Smarty templates?

I have WHMCS installed, and am editing the templates (Smarty). I cannot get the sIFR js to work. I have read all the relevant questions here, and I've read the tutorials on sIFR v. 2 and v.3. Right now I'm on hte latest nightly build with sIFR so that I can use the font. I did however, generate the font online stead of using a flash ...

Is there a way to use PHP code inside a smarty template?

I searched google, but coulding find anything. Checked the documentation too... I thought Smarty allowed PHP to be written inside the template itself if you escaped the template engine? ...

How to load new images, when changed in a web application

How to push new images in a web application, so that the cached is not taken? When I am having a new JS or CSS file, it's easy. Because they are in smarty templates, and I am having a version number in the URL (like a.js?v=9). Now, the problem with images are: - They are referred from the CSS files, and I can not have a version variabl...

solve apache problem when more clients connect the site

I have a php web application on web server connect with two oracle db server in loadbalance between them... we use in web application smarty template engine ..and ajax jquery the problem in - when more clients connect the web application the site stop or apache not running so we make restart to apache. - some web pages is slow. i want ...

PHP, Smarty: Check for template in different folders

Hi, for our latest project we used Django, where one can specify a list of folders, that are searched for a template, say, with name example.html. Now, we switched back to Smarty (PHP) and are wondering, if there is something similar. Smarty version: Can be cutting-edge. Behaviour: Feed Smarty with an array of folders. Call a templa...

Smarty - difference between register_object and assign_by_ref

These are two of the options I have for exposing a PHP object to a Smarty template. I know that there are syntax differences between the two, but I can't find any information on why you would use one over the other. Can anyone explain the differences? Thanks, James. ...

500 Internal Server Error?

Hi,everyone, Recently, I put my project which is php+smarty+mysql in my httpd server. But I encountered an error that says: 500 Internal Server Error My OS is archlinux, and the httpd server and php were installed like this: sudo pacman -S apache php If I use a test native php file which contains the following: <html> <head...

Setting up Smarty directories and paths

Hey all, Just a general question for those of you working with the Smarty templating engine. How are you setting up your file structure? I'd like to follow an MVC format, but I'm not sure how to include all the CSS, Javascript, etc. with the Smarty controller and templates without including these ridiculous paths. Has anyone worked wi...

smarty php CMS error

hi when i open my site (made in smarty) i got this error plz resolve im very new in smarty Smarty error: unable to read resource: "pagetemplate.tpl" in /var/www/vhosts/example.com/htdocs/includes/smarty/Smarty.class.php on line 1083 Warning: Smarty error: unable to read resource: "pagetemplate.tpl" in /var/www/vhosts/example.com/htdocs...

How do I write Smarty Block Plugins that loop over database records

Given a Category (parent) and Product (child) tables in a database, say, I want to create Smarty Block Plugins that would enable template snippets similar to this: {products category="Some Category"} <h1>{products_name}</h2> <p>{products_description}</p> {/products} I believe plugins like these would help avoid repeated chunks...

Conditionally setting a javascript function after posting of a form

Apologies for the very basic question - crash course in javascript coming up! But before that, I have a javascript function: function toggle(request) The function simply toggles a div as visible/invisible. I can trigger the behaviour I want from this function using an onclick event as follows: <input type="radio" name="complete" val...

Reload Smarty Template with New Variables?

Hey all, I'm messing with using AJAX to fetch "partial templates" from the server and echoing them back to the browser. This will cause all this HTML to have to be sent back to the browser. I was wondering if there is a way to simply change the variables but leave all the html there. Something like this: $smarty->assign("fruit", "apple...

Selections and localization with Smarty

I'm trying to implements selection lists using Smarty and I'm aware of the {html_options}. The application must support localization (which I implemented as described in this post). Is it possible to combine the two? I'm currently handling it by parsing through the items with {section name=i loop=$list} and "manually" generating the HT...

how to assign a javascript variable to a smarty variable

Hello all, I got a problem regarding how to assign a java script variable to a smarty variable. Here is the code snippet. function getDateInfo(date, wantsClassName) { var as_number = Calendar.dateToInt(date); //This as_number is the variable which should be assigned to smarty variable } How can i accomplish t...

Need to display all the Countries List in ASC order With a line break at end of Every Alphabets

Hello all, I am in need to display all the Countries List in ASC order. But with a line inbetween every end of alphabets. This is by using PHP and SMARTY Example: America Australia Belgium India Like the above i need to display the O/P. My query is $str = 'A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,Y,Z'; $let=explode(',',...

Howto parse json with smarty?

Hi, In Smarty, is there a standard function or an easy way to parse json from an array, as json_encode() does in php? Actually It seems there is not in smarty documentation but wanted to ask anyways. Thanks, Sinan. ...

Is it possible to use smarty functions outside the smarty template?

If in a php file you had: $smarty->assign('content','<p>This is some test content</p>'); and in a template file I hadb (just for example purposes): <html> <head></head> <body>{$content}{config_load file='settings.conf'}{#setting1#}</body> </html> Would it be possible to load the setting from the config file, from the php file inste...

In Smarty-PHP can I cache a registration/sign-up web form ?

I'm using a Smarty template for my web application Registration / Sign-up form. The form is slow to load, can I cache the registration form in order to speed up the loading of the page? On the form page, I use SESSION and do lots of PHP error checking to ensure that the form fields are completely & correctly inputted. If not, I redis...