Autor Thema: config2/childwp.inc.php  (Gelesen 321 mal)

oliver

  • Gast
config2/childwp.inc.php
« am: 10. Juli 2011, 18:13:20 »
Hi,

is there any problem to move the content of childwp.inc.php to the database like the table cache_attrib?
(parking and reference point is not detected for translation by translate.php)


Kind regards,
Oliver

Offline sva_cacher

  • Aktive User
  • *
  • Beiträge: 5
Re: config2/childwp.inc.php
« Antwort #1 am: 11. Juli 2011, 10:42:15 »
Hi,

I'm not too keen on the idea of putting things in the database just for the sake of translation. I would opt for a different solution. How about adding a translate comment before the string and have translate.php look for the comment? For example:

ChildWp_Type(1, /*tr*/'Parking');

Regards,
Kristian

oliver

  • Gast
Re: config2/childwp.inc.php
« Antwort #2 am: 11. Juli 2011, 12:35:03 »
Hm, okay ... i think there are several advantages of having the values in the database.
- we can include the description in sql queries like we do it with the attributes
- we can check the consistency with simple sql queries

Where is the disadvantage of the lookup table?
We do it with many tables and there are no problems with it.
(cache_status, cache_attrib, cache_type etc.pp.)

We also have a php-cache-file the fills this tables in an php-array (pre-translated).
So performance is also no issue.

Translation could be done by ChildWp_Type(1, $translate->t('Parking'));

But this is "the realy last option".

Offline sva_cacher

  • Aktive User
  • *
  • Beiträge: 5
Re: config2/childwp.inc.php
« Antwort #3 am: 12. Juli 2011, 00:20:07 »
I strive to keep things simple. Creating a small configuration file was the simplest thing I could imagine.

One disadvantage of having the information in the database is that you cannot know the current state unless you explicitly look at the data in the database. If the information is stored in a file in the repository there are never any questions. Get the latest files and you have the latest information, whether it is on the server or your local development computer.

I prefer to place data in a database only when it is needed in the database, not just because it possible to place it there. Yes, there are advantages of having the values in the database. But it's only an advantage if you actually use it. Otherwise it might become a liability instead.

I've stopped trying to anticipate future needs. I've realized that I'm not good at it. Instead I try to write code that's easy to modify. And then modify the code when a new need emerges. With that said, I don't think there is any problem with moving the values to the database. The code should be able to handle it. And I've already said what I think about the suggested change, so I won't repeat it.

oliver

  • Gast
Re: config2/childwp.inc.php
« Antwort #4 am: 17. Juli 2011, 21:55:06 »
Okay, i realy tried to get translation running with config2/childwp.inc.php
But due to the (unsupported) mix of "old" and "new" template system inside one PHP-file, i got various errors ...

So i changed it to the database which works well.

I think its important not to mix too many design patterns.
After we dropped the old template system we can do "cleanup of bad patterns".