By: ScoobieKW
Date: 2006-07-02
Time: 01:18
|
Using the same query for multiple blocks in a pageI'm building a page that will display a product detail, and in a sidebar will display the other products. I see a few ways to do this, and am wondering which is optimal. I'm using ezSql so disc caching of queries is involved.
1. do two queries when with a Where product_id = $id and the other with a WHERE NOT clause. 2. one query, and use conditionals in TBS, not sure of details 3. some brilliant way I haven't concieved of yet. Thanks, Steve Kennedy-Williams |
By: TomH
Date: 2006-07-02
Time: 01:39
|
Re: Using the same query for multiple blocks in a pageDepends mostly on the volumes of data involved in various results...
Think in terms of caching everything... but with a strategy based on your particular data records. (a) there are a lot of products to be listed, maybe even categories of products: in this case I would cache a subscript that is just for the sidebar content - using TBS caching, and only update this cached sidebar when database updates are made. (b) if the product details are heavy pages then I would use TBS with that product contant cached by prod id. For specific examples of these and other caching strategies take a look at <a href="http://tomhenry.us/tbs3/" target="_Blank">TBS/ezSQL</a> --pay particular attention to model (1) and model (3) HTH |
By: Skrol29
Date: 2006-07-03
Time: 10:32
|
Re: Using the same query for multiple blocks in a pageHi,
Does product detail display as much information as the other product list ? If it's so, I would try your solution #2. |