[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-general
Subject:    [SMARTY] defining arrays in config files
From:       81.57.31.91
Date:       2004-02-21 12:31:12
Message-ID: 20040221123106.61741.qmail () pb1 ! pair ! com
[Download RAW message or body]

Hello,

I have a little question that is : what is the syntax for defining arrays in
configs files ? I tried multiples syntax like :

var[0] = "blabla"
var.key = "hello"

without success
---
The aim of using arrays is defining errors message strings, with one config
file as well as one template per language, my php scripts works with errors
int and then pass them to smarty. Then by doing something like :

php :

enum("Ok", "NotFound", "NoRights");
/* set Ok = 0, NotFound = 1, NoRights = 2 */
...
$error = NoRights;
...
$smarty = new Smarty;
$smarty->assign("Ok", Ok);
$smarty->assign("NotFound", NotFound);
$smarty->assign("NoRights", NoRights);
$smarty->assign("error", $error);
$smarty->display("step1.tpl");

errmsgs.conf :

errmsg[$Ok] = "everything ok"
errmsg[$NotFound] = "file not found"
errmsg[$NoRights] = "needs read rights on the file"

step1.tpl :

{config_load file="errmsgs.conf"}
{#errmsg[$error]#}


Thank you very much for showing me how to make that work or an other nice
method to managing error messages.

Tarik
-- 
http://perso.efrei.fr/~ansari/

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic