|
From: Rene <re...@gr...> - 2002-07-15 09:41:19
|
On Mon, 2002-07-15 at 09:26, Joe zacky wrote: > I've been looking hard at your suggestions and code this weekend. I'm > very impressed with your ini parsing to create html pages in > class_config, and class_tree.php. > > I see what you want to do by converting the ini file to php, but I don't > understand the "depends" part of it: > > $server_defs["nfs_share"]["depends"]["value"]["0"] = "nfs"; > $server_defs["nfs_share"]["depends"]["value"]["1"] = "nfs"; > $server_defs["nfs_share"]["depends"]["rule"]["0"] = "0:TRUE"; > $server_defs["nfs_share"]["depends"]["rule"]["1"] = "1:TRUE"; These two lines are the names of the rules $server_defs["nfs_share"]["depends"]["name"]["0"] = "backup_method"; $server_defs["nfs_share"]["depends"]["name"]["1"] = "restore_method"; the "value" of the rule is that is must be == "nfs" the ruleset states that rule number 0 must be TRUE or rule number 1 must be TRUE For rule number 0 to be true the value of $backup_method must be == "nfs" A more complex rule could be: $server_defs["nfs_share"]["depends"]["rule"]["0"] = "0:TRUE|1:FALSE"; The correct settings for this rule would be: $backup_method = "nfs" $restore_method = "anything but nfs" The reason I proposed a php file instead of the ini file is that to ini file must be parsed and then the data in it must be parsed. Ini files are not as flexible as php. This is especially true with arrays. > But I don't know if I can turn this line > > depends = "$backup_method == nfs || $restore_method == nfs" > > into an executable statement that will return TRUE or FALSE. > > Do you think it can work? Think it's a good idea? It would not be that hard to do. The eval() function can do this. My concern with ini files is that every time add a special settings, we will need to parse that setting on its own. That adds complexity to the code. I initially found ini files to be easy to work with. But as bobs has progressed and more options are added, the complexity increases and I don't think that is going to stop soon. I can imagine a small set of commands doing the same as is being done now by a complex set of commands. I would go for the php method and then add the ini parser at a later if it seems like a good idea to use it. Please let me know what you work out. -Rene > > I'll work on rewriting admin.php and class_config.php. It will be a > worthy challenge with my limited php experience, and it's only the two > files affected, so I'm pretty safe. > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > Bobs-devel mailing list > Bob...@li... > https://lists.sourceforge.net/lists/listinfo/bobs-devel |