| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | # capitalize
 | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | This is used to capitalize the first letter of all words in a variable. | 
					
						
							| 
									
										
										
										
											2023-02-03 22:31:59 +01:00
										 |  |  | This is similar to the PHP [`ucwords()`](https://www.php.net/ucwords) | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | function. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ## Basic usage
 | 
					
						
							|  |  |  | ```smarty | 
					
						
							|  |  |  | {$myVar|capitalize} | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ## Parameters
 | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | | Parameter | Type    | Required | Description                                                                                           | | 
					
						
							|  |  |  | |-----------|---------|----------|-------------------------------------------------------------------------------------------------------| | 
					
						
							|  |  |  | | 1         | boolean | No       | This determines whether or not words with digits will be uppercased                                   | | 
					
						
							|  |  |  | | 2         | boolean | No       | This determines whether or not Capital letters within words should be lowercased, e.g. "aAa" to "Aaa" | | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ## Examples
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```php | 
					
						
							|  |  |  | <?php | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $smarty->assign('articleTitle', 'next x-men film, x3, delayed.'); | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |         | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Where the template is: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ```smarty | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     {$articleTitle} | 
					
						
							|  |  |  |     {$articleTitle|capitalize} | 
					
						
							|  |  |  |     {$articleTitle|capitalize:true} | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |         | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Will output: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     next x-men film, x3, delayed. | 
					
						
							|  |  |  |     Next X-Men Film, x3, Delayed. | 
					
						
							|  |  |  |     Next X-Men Film, X3, Delayed. | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |         | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | See also [`lower`](language-modifier-lower.md) and | 
					
						
							|  |  |  | [`upper`](language-modifier-upper.md) |