smarty

A problem with using Smarty & Mysql & Jquery

Hi all .. I have a problem in using Samrtm Mysql and Jquery or Ajax and if I use a div auto reloader it shows a php error .. these are my files: accept.html (Template) {literal} <script type="text/javascript"> var auto_refresh = setInterval( function () { $('#invite').load('accept.php').fadeIn("slow"); }, 1000); </script> {/literal} <d...

How to find last index of foreach loop in smarty

How to get last index value of foreach loop in smarty,i m new for smarty I have used this code but its not working {foreach from=$cityList key=myId item=i name=foo} {$i.location_name}{if $main_smarty.foreach.foo.last}<hr>{else}-{/if} {/foreach} i want that when their is last city name after this its come horizontal line otherwise i...

How to convert a numeric number into string ?

Hi, I need to test if two variables are equals. But one is in string format and the other is a number. So, I try to convert the variable in text, but without success. Have you an idea ? ...

If IE then include file [A] else include file [B]

Hello, I have page for which I want to load different content for different browsers. Example : IF Internet explorer {include file="/content1.tpl"} ELSE if any other browser {include file="/content2.tpl"} {/if} Content1.tpl & Content 2.tpl are two different files having their respected Html & CSS. How can I achieve this usi...

Smarty: multidimensional array

I need to loop into a multidimensional array in smarty and {section} is giving me a hard time This is the array called $brands: Array (26) A => Array (4) 0 => "Alienation" 1 => "Alligator" 2 => "Amoeba" 3 => "Animal" B => Array (2) 0 => "Bell" 1 => "Bontrager" C => Array (9) 0 => "C...

Smarty 3 trusted_dir?

Hey Guys I cannot seem to figure out where to set the trusted_dir variable in Smarty 3. Now anytime I use a {insert name="func_name" script="thescript"} I get the error "missing script file". Does anyone out there know how to allow this? $smarty->security is set to false. Thank you. EDIT: As of the posting of this question, this func...

Assign custom function return value and use in loop

I'm using the CodeIgniter framework with Smarty and use a custom Smarty function which returns config items: {ci_config name='sitemap'} This call returns an multidimensional array containing the websites sitemap: $config['sitemap'] = array('dashboard' => array('uri'=>'dashboard', 'titl...

Formatting numbers with thousands separator Smarty PHP

Im trying to format numbers with thousands separator Smarty. So for example 1000 becomes 1,000. Thanks. ...

internet explorer 7 css problem

Hi I am modifiying a cs-cart theme which uses smarty template engine. I am able to move the shoping cart links to above the top menu and it shows Ok with IE8 firefox etc. Hovewer IE7 make an empty space. How could I make IE7 happy. I added the necessary style-sheets and tpl files. Main css files are style.css and stle.base.css. IE8 ...

Best way to include view within view in Codeigniter template using Dwoo?

I am using Codeigniter 1.7.2 and Phil Sturgeon's wonderful Dwoo wrapper which allows me to use the Dwoo template library in Codeigniter - http://philsturgeon.co.uk/code/codeigniter-dwoo I have a small question regarding the inclusion of other view template files within my template files. Say for example I have a dashboard.php file and I...

smarty {cycle}, and three values

Hi, how use {cycle} with three values? Whats wrong with this code: <table> <tr bgcolor="{cycle values='#aaaaaa,#bbbbbb'}"> <td bgcolor="{cycle values='#1112233,#334455'}">value</td> <td bgcolor="{cycle values='#998811,#334466'}">value1</td> </tr> </table> Thanks ...

variable read from text file and passed to smarty shows up like "Home<i>\r</i><i>\n</i>"?

I have a code that look like this. $language = "eng"; $append = "_sidebar.txt"; $read_text_file = "languages\\$language$append"; $sidebar = file($read_text_file); $smarty->assign("sidebar_link",$sidebar); Why does all variables in smarty all look like this: Smarty_Variable Object (3) ->va...

Smarty array with dot in key

I have an array in PHP that looks like this: $config['detailpage.var1'] $config['detailpage.var2'] $config['otherpage.var2'] $config['otherpage.var2'] ... To access it in Smarty I would do $smarty->assign('config', $config); With this template: {$config.detailpage.var1} Unfortunately this does not work, due to the dot in my arra...

How does Smarty work when I define my Cache Function Handler?

I am trying to use my Smarty Cache Handler Function. At the beginning, I use the same example function that is posted in the Smarty manual. function mysql_cache_handler($action, &$smarty_obj, &$cache_content, $tpl_file=null, $cache_id=null, $compile_id=null, $exp_time=null); The problem is that, when I try to do $sma...

smarty and date

Hi, i get date with: {$smarty.now|date_format:'%Y-%m-%d %H:%M:%S'} But how get 20 day after? If now: 2010 05 05 12:12:12, i wish show 2010 25 05 12:12:12 ...

javascript and smarty

Hi, how in javascript insert smarty variables ? var info = { us: 'User: {$UserName}', ad: 'Address: {$Address}', img: 'Image: {$URL}' } And now show: User: {$UserName}, how show values? For example: User: Peter Thanks ...

Call smarty plugin function directly from PHP

So I can use the Smarty plugin html_options within a template like this: {html_options options=$arr } But what I want to do is call the function behind this plugin (smarty_function_html_options) directly from PHP. I'm sure this must be possible, has anyone got any ideas on how to achieve this? ...

function call 'clear_all_cache' and 'clear_assign' is unknown or deprecated. error in smarty?

I need to remove the cache when a user change language, but I get an error message. $smarty = new Smarty; //$smarty->force_compile = true; $smarty->debugging = true; $smarty->caching = false; $smarty->cache_lifetime = 120; if (isset($_COOKIE['country'])) { $country = $_COOKIE['country']; $language = "eng"; if ($country ...

PHP/Smarty - How to check an array for objects with specific values, and create temp array of those objects

First-timer here, I hope I explain this well enough... PHP/Smarty, I'm working on a section of a page that displays bullet lists of notes associated with either the general page, or individual places on that page. Some places don't have notes. Something like: General note 1 New York note 2 note 3 Boston note 4 I have two a...

Smarty template question

hi, i am new to smarty template and i am trying to do this. I have a html form in the tpl file and in that form action is for a php email function email.php. I am not able to get it to work. if i have the complete code(html form + php email code) and save as a php file, it works fine. is there any way to call the php code from email.p...