开发者

Separate SQL queries per word for dynamic pages?

I am creat开发者_StackOverflowing multilang pages for a dynamic site 9ocial network) so all the page text is database driven. Question is if there are say 100 different words on the page in different places does that mean I need to include 1000 select SQL statements for each work to read it from the database? I have never worked with multi lang dynamic pages just pure hardcoded English only pages which was easy so not sure. There are stuff like page title bar, page meta data, page text, menu labels, footer etc. so each is a separate sql query I assume to pull the word?


There wouldn't necessarily be a SELECT statement for each item. If your schema has related items in the same table, these could be returned in a single call. [e.g. making some assumptions about your table structure]

SELECT page_title, page_text, page_footer, page_blah 
FROM page_table
WHERE page_id = 123 AND lang = 'FR'

For your collection (1-to-many) items, e.g. page meta data, you could consider views, pivots and/or unions to reduce the number of calls further (or live with a higher number of calls if the performance/maintainability is ok). To know whether views etc. are suitable you should post more details of your schema. hth, R

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜