Welcome Guest, Not a member yet? Register   Sign In
SqlLang (sql like methods for Language library)
#1

[eluser]xwero[/eluser]
I'v added a page to the wiki : MY_Language. The code is still in alpha phase but it's a more complete class with update and delete methods. At first i was thinking what would be a valid use of an update method in the language class. And then i was thinking about a topic i read about using variables in the language strings so that functionality is added using the set and update methods.

the statement for the update method can be build using the like and select methods in the same manner they are used with the get method.
The delete method is a stand alone method.

Examples are provided in the code.
#2

[eluser]xwero[/eluser]
It seems i'm not the only one sqlizing (yes i made it up) things : PHPLinq. The funny thing is he's a Belgian too Smile I also have knowledge of asp.net but i didn't look into the 3.5 framework yet.

edit : Thank you admin
#3

[eluser]xwero[/eluser]
I've tested the wiki page code, fixed errors, changed the code a bit and the examples.

The biggest changes are the added parameter for the select method that makes it possible to shorten the select by defining a prefix.
Code:
$this->lang->select('one,two','some_long_common_prefix');
And the possibility to replace one placeholder with different values per line
Code:
$this->lang->select('test_var_six,test_var_seven');
$this->lang->set(array('[0]'=>array('me','you'),'[1]'=>array('day','night')));
$this->lang->update();

It would be great if others test it too and report their findings.
#4

[eluser]xwero[/eluser]
I've added another function, insert, to complete the sql statements. The language library only allows adding lines from a file but what if you want to store the language lines in a database or files with another structure.

To delete these lines i added an in method to select the lines that need to be deleted and changed the delete method to work with 'random' lines.

I guess that's all the functionality the language library needs. Now up to the sqlisation of the config class.




Theme © iAndrew 2016 - Forum software by © MyBB