| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | # Variables loaded from config files
 | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | Variables that are loaded from the [config files](../config-files.md) are | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | referenced by enclosing them within `#hash_marks#`, or with the smarty | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | variable [`$smarty.config`](language-variables-smarty.md#smartyconfig-languagevariablessmartyconfig). The | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | later syntax is useful for embedding into quoted attribute values, or | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | accessing variable values such as `$smarty.config.$foo`. | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ## Examples
 | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | Example config file - `foo.conf`: | 
					
						
							|  |  |  | ```ini | 
					
						
							|  |  |  | pageTitle = "This is mine" | 
					
						
							|  |  |  | bodyBgColor = '#eeeeee' | 
					
						
							|  |  |  | tableBorderSize = 3 | 
					
						
							|  |  |  | tableBgColor = "#bbbbbb" | 
					
						
							|  |  |  | rowBgColor = "#cccccc" | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | A template demonstrating the `#hash#` method: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ```smarty | 
					
						
							|  |  |  | {config_load file='foo.conf'} | 
					
						
							|  |  |  | <html> | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     <title>{#pageTitle#}</title> | 
					
						
							|  |  |  |     <body bgcolor="{#bodyBgColor#}"> | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  |         <table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"> | 
					
						
							|  |  |  |             <tr bgcolor="{#rowBgColor#}"> | 
					
						
							|  |  |  |                 <td>First</td> | 
					
						
							|  |  |  |                 <td>Last</td> | 
					
						
							|  |  |  |                 <td>Address</td> | 
					
						
							|  |  |  |             </tr> | 
					
						
							|  |  |  |         </table> | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     </body> | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | </html> | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |          | 
					
						
							|  |  |  | A template demonstrating the | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | [`$smarty.config`](language-variables-smarty.md#smartyconfig-languagevariablessmartyconfig) method: | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ```smarty | 
					
						
							|  |  |  | {config_load file='foo.conf'} | 
					
						
							|  |  |  | <html> | 
					
						
							|  |  |  | <title>{$smarty.config.pageTitle}</title> | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     <body bgcolor="{$smarty.config.bodyBgColor}"> | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  |         <table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}"> | 
					
						
							|  |  |  |             <tr bgcolor="{$smarty.config.rowBgColor}"> | 
					
						
							|  |  |  |                 <td>First</td> | 
					
						
							|  |  |  |                 <td>Last</td> | 
					
						
							|  |  |  |                 <td>Address</td> | 
					
						
							|  |  |  |             </tr> | 
					
						
							|  |  |  |         </table> | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     </body> | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | </html> | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Both examples would output: | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | ```html | 
					
						
							|  |  |  | <html> | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     <title>This is mine</title> | 
					
						
							|  |  |  |     <body bgcolor="#eeeeee"> | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  |         <table border="3" bgcolor="#bbbbbb"> | 
					
						
							|  |  |  |             <tr bgcolor="#cccccc"> | 
					
						
							|  |  |  |                 <td>First</td> | 
					
						
							|  |  |  |                 <td>Last</td> | 
					
						
							|  |  |  |                 <td>Address</td> | 
					
						
							|  |  |  |             </tr> | 
					
						
							|  |  |  |         </table> | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  |     </body> | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | </html> | 
					
						
							|  |  |  | ``` | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							|  |  |  | Config file variables cannot be used until after they are loaded in from | 
					
						
							|  |  |  | a config file. This procedure is explained later in this document under | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | [`{config_load}`](../language-builtin-functions/language-function-config-load.md). | 
					
						
							| 
									
										
										
										
											2021-12-03 11:59:22 +01:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-02-06 14:42:31 +01:00
										 |  |  | See also [variables](../language-basic-syntax/language-syntax-variables.md) and [$smarty reserved | 
					
						
							|  |  |  | variables](language-variables-smarty.md). |