I’m working in some php web apps that are almost identic, except content database, texts, and themes. Let’s think in some similar like could be stackexchange sites.
The objective is mantain only one project in the same repository, so if I introduce a new feature, I only have to implement once, and not for every site.
For the themes and database is not a problem, but for the texts I don’t know how can I proceed (now the texts are hardcoded in the php files).
I’ve googled and searched in SO, and I’ve find some questions similars like this where the answer was using gettext for i18n.
But in my case, it’s not exactly i18n, because some of the sites are in the same language but the texts are different.
How can I store these strings?
There are tons of ways to get this done. I have a fitting project-scenario where I archive different things in different ways:
In addition to that, every project has its own:
I use my own translation-system to distribute the textbase over my instances. You can use some of php’s build in functions: http://verens.com/2008/04/03/translation-in-php/
The Templateset is just done by a config-variable that sets the root directory for the template-engine:
./templates/instance-x/...The content could also referenced by a config-variable. In my case, I have a shop-system, that uses a product-base, which is used by all instances identically. To make a product available/visible to the public, you have to assign it to a category. Categories and instance-dependent.
Categories got a instance-specific ID (in my case its the
shop_id).