|
Posted by C. on 09/29/10 12:00
On 16 Jan, 13:41, adam.timberl...@gmail.com wrote:
> hello everybody
>
> i have been reading the article below in case you are wondering, but i
> have myself a question about how good the structure really is, and if
> there are any better ways to do this.
>
> article:http://www.talkphp.com/vbarticles.php?do=article&articleid=46
>
> i do like how that site has done it but as i dont know alot about php,
> i cant tell whether its a good solution or not, so could somebody
> please tell me if it is ?? if it is accepable then i shall it :)
>
> thank you and good night!
The code structure is OK but the pattern of directories an mapping one
page to one datafile seems like overkill and introduces a lot of
redundancy. Also, having to parse XML for every page hit is an
overhead. Certainly it makes like simple if you use your native
language versions of phrases to index other languages.
Personally, I've preferred going for a relational database to hold the
structures in, say something like...
create table phrases (
phrase_id integer not null,
language varchar(5),
phrase clob,
primary key phrase_id,
index language
}
then....
SELECT IFNULL(target.phrase, native.phrase)
FROM phrases native LEFT JOIN phrases target ON
native.phrase_id=target.phrase_id
WHERE native.phrase='$search_phrase'
AND native.language='en_GB';
(this is a rough hack - assumes you can allocate phrase_ids and link
them, also, without a CLOB index it won't scale well)
C.
[Back to original message]
|