From: Chris W. <ch...@cw...> - 2003-10-30 17:46:47
|
forehead wrote: > Maybe in the future, there will has ShopCart pkg in OI2 system. > of course we need a new session to save the cart's info. and need a different > SESSION_COOKIE to set cookie and logout handler. Actually there is a 'cart' package in the 'extra_packages' directory of CVS. I haven't visited it in quite some time but it should work ok. (I'll rewrite it for OI2 and actually release it once OI2 is final.) > so my new idea is split the SESSION_COOKIE value into a Session Name which indcate > which session is to be handle. I'm not sure I understand this. You can put anything you want in the session, including a shopping cart object. (That might not be smart for high-volume sites, in those cases you'll want to just put a key and maybe frequently accessed data like number of items in the cart.) Anyway, you can do something like: my $cart = My::ShoppingCart->new(); $cart->add( $product, 2 ); $cart->add( $product_other, 1 ); # OI 1.x: $R->{session}{cart} = $cart; # OI 2.x: my $request = CTX->request; $request->session->{cart} = $cart; And then retrieve it later: # OI 1.x my $cart = $R->{session}{cart}; # OI 2.x my $request = CTX->request; my $cart = $request->session->{cart}; my $products = $cart->list_products; ... > Another idea about the OI is, init conf with different $ENV{'HTTP_HOST'} , and load > some site's own configure. that's like the apache's vitual host stuff. Since many > sites maybe in almost the same. Actually one of the reasons OI 1.x is a bit overengineered is to accommodate this -- running multiple instances of OI inside a single Apache server. The problem is that very few people actually want to do this, and the engineering necessary to make this happen (juggling namespaces, etc.) really gets in the way of normal usage. So that's not around in OI 2.x. > Another idea about Theme: > and the template with theme maybe look like thus: > > pkg > \-- [StyleName_1] \ templates\[some html template files] > \ [SkinName_1]\[some images or flash or anything associate with this skin] > \ [SkinName_2]\[some images or flash or anything associate with this skin] > \ [SkinName_3]\[some images or flash or anything associate with this skin] > ... > > and in top level there is a theme object which defines which package use which Style and use > which Skin for this style. This is interesting. So this allows you to change component templates by theme as well as fetch resources (images, movies, etc.) by theme. I'll have to noodle over this. > futher more, we can build some global template widgets , for meet the pkg template use, eg: > button, navigation, bar, box, tabbed_box, and so on, anything. Right. > and all the Style and Skin should be build as a little module or package and some tools could > manage them ( install, uninstall, upgrade, and so on) There's already some support for standalone themes ('themeballs') that you can manipulate with oi2_manage. (mostly untested of course...) > btw, every pkg's template may use some language define file to satisfy with multi-language sites. This goes along with the separate i18n discussion going on right now. I hadn't thought about this approach -- using an entirely separate template instead of message tags.... Very useful, thanks. Chris -- Chris Winters (ch...@cw...) Building enterprise-capable snack solutions since 1988. |