|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
BenFromTokyo Smarty Rookie
Joined: 15 Oct 2004 Posts: 12 Location: Japan
|
Posted: Fri Jan 07, 2005 9:48 am Post subject: Error message in conf file... best practice ? |
|
|
Hi all,
I would like to use the following pattern:
index.php:
[php:1:fc9112d864]<?php
$smarty->assign("msg_code","TOO_BIG");
?>[/php:1:fc9112d864]
message.conf:
Code: |
TOO_BIG = "The file size is limited to 10 Mb."
NO_FILE = "Please select a file."
WRONG_TYPE = "Only SVG files please."
|
index.tpl:
Code: |
{config_load file="messages.conf"}
{* *some magic code* *}
error = {$msg}
|
I would like to convert my variable {$msg_code} to {$msg} using the message.conf file...
Any idea on how to do this ??
Any magic would be greatly appreciated _________________ Ben |
|
Back to top |
|
BenFromTokyo Smarty Rookie
Joined: 15 Oct 2004 Posts: 12 Location: Japan
|
Posted: Fri Jan 07, 2005 10:42 am Post subject: and the magic code is: |
|
|
ok it was not so terrible:
Code: |
{config_load file="messages.conf"}
{assign var=msg value=$smarty.config.$msg_code}
error = {$msg}
|
hope it will help somebody else...
I think it's quite a good trick finally _________________ Ben |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
Posted: Fri Jan 07, 2005 2:55 pm Post subject: |
|
|
or just:
Code: | {config_load file="messages.conf"}
error = {$smarty.config.$msg_code} |
|
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|