There is a plugin called ysfDimension. You might want to look at that. 2009/4/17 Derek Almond <iamde...@gmail.com>
> > I run three or for different set ups where the sites share common > code, but the look and feel is different to some extent. > > each of the two examples below run about 12 differnet sites, with > varying degrees of shared content - i wont post all the ULR's or it > will look like i'm link spamming, but a couple of instances are > > http://savewatersavemoney.co.uk > http://st.savewatersavemoney.co.uk > http://awdirect.savewatersavemoney.co.uk > > (these all share a common domain, and have different branding based on > the subdomain, as you will see, the first two are very similar - the > last is very different. > > a seperare set up is. > > http://www.northwestitjobs.co.uk > http://www.southeastitjobs.co.uk > > these are very similar - but have different domain names, > > i have a couple of other requirements, in that its possible to add new > domains on the fly, so i store my site data in a db table - you dont > have to, its just easier for the way i need to do things. the example > below is for symfony 1.0, and im doing this from memory, so i dont > have al the details to hand, but its enough to get started - i can > provide more details tomorow if you wanrt though. > > so a table, called site. > > id, > site_name > url_map. > branding_folder > site_title > > etc etc > > each of my actions has a preExecute method like so. (though if i was > re writing i'd probably use a filter i guess) > > public function preExecute() > { > siteBranding::getSiteBrandingDetails($this); > > } > > the method matches the current request url to the url_map column, if > it finds a match it changes the template to be a customised one. > > > $site = SitePeer::retrieveByURL($_SERVER['HTTP_HOST']); // basically > just does a simple SitePeer::doSelectOne() > > if($site){ > > $action->site=$site; // $action is the $this we passed in > above, > sfContext::getInstance()->getResponse()->setTitle($action->site- > >getSiteName()); > sfContext::getInstance()->getUser()->setAttribute("current_site", > $site); // i store this in the session so that i dont have to do the > look up every time - if the value is set, it just returns the existing > site. > $action->setLayout(sfConfig::get('sf_web_dir').$site- > >getBrandingFolder()."/layout" > ); > }else{ > $action->setLayout( > sfConfig::get('sf_web_dir'). > "/branding/sites/generic/layout"); > } > > > > sorry thats all a bit messy, but as i say - shout if you want to see > the proper code (or feel free to post about why my method of doing it > sucks - always happy to see other view points ;-) > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "symfony users" group. To post to this group, send email to symfony-users@googlegroups.com To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en -~----------~----~----~----~------~----~------~--~---