[Xerte-dev] Re: 1.9 thinking
Pat Lockley
patrick.lockley at googlemail.com
Wed Jul 4 11:57:45 BST 2012
Yep, was just going to roughly copy wordpress' option table
No need to return one object
On Wed, Jul 4, 2012 at 11:52 AM, David Goodwin <david at palepurple.co.uk> wrote:
>> <snip/>
>>
>> 1) Restructure / replace the sitedetails table with a more logical structure
>>
>
>
> I'd suggest you use the 'config' table which already has name/value pairs :
>
> e.g.
>
> SELECT value FROM config WHERE name = "site_name"
> SELECT value FROM config WHERE name = "site_email"
> SELECT value FROM config WHERE name = "ldap_server1"
>
>
> This will allow you to easily add in additional fields/values later on.
>
> Retrieval would be easiest through something like :
>
> _get_config('some_name') => returns "fish fingers";
>
> _set_config('key_name', 'value')
>
> or
>
> Config::getValue('some_name') => returns 'fish fingers'
>
> Config::setValue('key_name', 'value')
>
> It would be relatively easy to add in an additional method which would return a data structure like what your legacy code expects -
>
> e.g.
>
> _get_config_all() => …. (as below)
>
> Config::getAllInOne() => returns array('site_name' => 'xxx', 'site_email' => 'xxxx at xxx') and so on.
>
>
> Whether you want it to be OOified or just a "boring" procedural function is up to you / whoever writes it.
>
> I'm not sure there's any need for a Config object as such (e.g. $c = new Config(); $c->setName('xx'); $c->setValue('yy'); $c->save()).
>
>
> David.
>
>
> Pale Purple Ltd. (Company No: 5580814)
> 'Business Web Application Development and Training in PHP'
>
> http://www.palepurple.co.uk
> Office: 0845 0046746 Mobile: 07792380669
>
> Follow us on Twitter: @PalePurpleLtd
>
>
> _______________________________________________
> Xerte-dev mailing list
> Xerte-dev at lists.nottingham.ac.uk
> http://lists.nottingham.ac.uk/mailman/listinfo/xerte-dev
> This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.
>
> This message has been checked for viruses but the contents of an attachment
> may still contain software viruses which could damage your computer system:
> you are advised to perform your own checks. Email communications with the
> University of Nottingham may be monitored as permitted by UK legislation.
More information about the Xerte-dev
mailing list