iGeek Blog

Jignesh Patel's Blog


recent posts

recent comments

Its the last day of the year 2008. I m confused, I should be happy or not!
So many things happened for me in the last year. Some of the things from those, I will not get in future.. that's sure. If today one can restart the year 2008, I will be agreed. Doing that I want to enjoy it again, want to fix the mistakes I did in that span of a year. But unfortunately, its not possible.

Today I want to decide, anyhow I will make the year 2009 more enjoyable than the 2008 for me. Bye.. 2008..

Welcome.. 2009. Let me be a part of all happiness you going to give you the world.

Its simple and sober to assign value to a variable in Smarty. However assign an array to a variable in .tpl file is not simply available. You can create ab array in PHP and assign it to the variable to be used in smarty template, but its on PHP side.

But what if you want to do something like this ?

{assign var=$col_width value=array('2%','10%','17%','13%','20%','10%','19%')}

No, we cant do that. For doing the same thing you have to put a compiler.set.php file inside smarty directory. Can be downloaded from here : http://smarty.incutio.com/?page=set
Put it here: smarty/libs/plugins

To create array use the syntax below:

{set var=$col_width value=array('2%','10%','17%','13%','20%','10%','19%')}