Page 1 of 1

where to put the foo.conf??

Posted: Tue Apr 25, 2006 12:37 am
by pleigh
i've seen this code over the net...i just want to know where to put the foo.conf file for the smarty templating..i am really new in smarty...tnx..

Code: Select all

foo.conf:

pageTitle = "This is mine"
bodyBgColor = "#eeeeee"
tableBorderSize = "3"
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"

index.tpl:

{config_load file="foo.conf"}
<html>
<title>{#pageTitle#}</title>
<body bgcolor="{#bodyBgColor#}">
<table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}">
<tr bgcolor="{#rowBgColor#}">
	<td>First</td>
	<td>Last</td>
	<td>Address</td>
</tr>
</table>
</body>
</html>

index.tpl: (alternate syntax)

{config_load file="foo.conf"}
<html>
<title>{$smarty.config.pageTitle}</title>
<body bgcolor="{$smarty.config.bodyBgColor}">
<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>
</body>
</html>

Posted: Tue Apr 25, 2006 1:02 am
by RobertGonzalez
Have you checked out the Smarty docs?

Oh yeah, and have you checked out Template Lite? It is a nice, fast replacement for Smarty.

Posted: Tue Apr 25, 2006 1:05 am
by pleigh
yup...im sori, but i really can't understand...should i name it foo.conf or foo.conf.php/tpl??i have a config directory /smarty/configs and saved my file as foo.conf, but when i view the page, nothing happens..

Posted: Tue Apr 25, 2006 1:11 am
by RobertGonzalez
OK. Visit the Smarty web site and read their online documentation. I am sure they will explain somewhere in their docs where you can place config files.

Posted: Tue Apr 25, 2006 2:53 am
by pleigh
hi, tnx, run through the documentation, but i really can't find out how to configure the .conf

i just like to know where to put it or what filename to use, or is there any other configurations...i really need a tutorial on this one.

thanks

Posted: Tue Apr 25, 2006 11:18 am
by RobertGonzalez
What I did was go to the Smarty Manual. Then I scrolled section III. Smarty for Programmers, Subsection 12. Smarty Class Variables and clicked on $config_dir. It took me to the section of the manual that discusses where to put config files.

I would seriously recommend that you spend some time in the Smarty manual. Smarty is a feature-rich application but almost everything you need to know about can be found in the manual.