Variable Modifiers :

Variable modifiers can be applied to variables, custom functions or strings. To apply a modifier, specify the value followed by the | (pipe) and the modifier name. A modifier may accept additional parameters that affect its behavior. These parameters follow the modifer name and are separated by : (colon).

Example:
{$smarty.now|date_format:"%Y/%m/%d"}
		
Demo:

Some of the variable modifiers are given below.

capitalize
count_characters
cat
date_format
lower
upper
explode
string_format
truncate

Question for Smarty

  1. I have an array $smarty->assign('a', array(1=>array('subha','amar'),4=>array('nibedita','harapriya'))); Write the smarty code to capitalize the first letter of each element of the array and should show two elements in a row.
  2. Write the code to display the date of the day which will come after 5 days from today's date.
  3. I have an array $smarty->assign('a', array(1=>array('Subha','aMar','biShnu'),4=>array('nibEdita','haRapriya','pReeti'))); Write the smarty code to write each element of the array in lower and upper case separately and should show three elements in a row.
  4. Make a text field for inputing number and and a button . When the button will be pressed then if the number is a integer then show the next number to it and if the number is a floating point number then display the number rounded up after the three digits after the decimal point.
  5. Make a text box for inserting the address and a button when I will press the button then the address should show me up to 10 characters the "...." will appear.
  6. Make registration form having fields for inputing name,city,state,country,date of birth,gender,hobbies,and an image .
    Here date of birth should be in dd/mm/yyyy format and city,state and country should be drop down,and hobbies should be check box. Insert the value to the data base
    List the data as follows
    Sl.no NamecityStateCountryGenderDobHobbiesAddressOperations
    1. Nibedita(put the avtar image)cuttackOdishaIndiaFemale7-6-1988SingingNakhara,cuttack
    2. Amar(put the avtar image)tataBiharIndiaMale7-5-1988Cricket,EatingBaxi bazar, cuttack
    Put the address up to 30 characters
    After that put a option for edit and then edit in the corresponding data base and give the option to delete it.
After editing Click here:
Php Code :
Output:
Hello World
Smarty Code :