where to put the foo.conf??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

where to put the foo.conf??

Post 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>
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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..
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
User avatar
pleigh
Forum Contributor
Posts: 445
Joined: Wed Jan 19, 2005 4:26 am

Post 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
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post 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.
Post Reply