Hi AD, i'll try your suggestion and find how can i do it.
thanks Isaac On Sat, Jul 18, 2009 at 8:40 PM, AD7six <[email protected]> wrote: > > > > On Jul 18, 2:51 am, Isaac Raja <[email protected]> wrote: > > no. i'm just manipulating the the url as a string and replacing it with > the > > users selected city. Here's my code.I know the code is bad. but i'm > thinking > > of a way to overcome it. > > > > $id = $this->params['url']['city']; > > $this->Category->Post->City->id = $id; > > $this->data = $this->Category->Post->City->read(); > > $subdomain = low($this->data['City']['city']); > > $domain = Configure::read('Site.domain'); > > $urll = ''; > > $urll = 'http://'; > > $urll .= !empty($subdomain)?$subdomain.'.':'www.'; > > $urll .= $domain; > > $urll .= $this->params['url']['url_here']; > > if(!empty($this->params['url']['keyw'])) > > { > > > > $urll .= '/keyw:'.$this->params['url']['keyw']; > > } > > $this->Session->write('Current', array('id' => $id, 'city' => > > $subdomain)); > > $this->redirect($urll,null,true); > > > > Thanks > > Isaac > > You want something like $this->redirect(array_merge($this->params, > array('city' => $city))); > > since you're using subdomains - that's going to mean the url comes out > as /foo/bar/already:intheurl/city:$city . However if you > > 1) override app helper url, like > http://thechaw.com/cakebook/source/app_helper.php#37 > 2) create a component with a beforeRedirect function, like > > http://trac.assembla.com/mi/browser/branches/base/controllers/components/seo.php#L98 > > That means you can put your bespoke url logic in one (well, two) place > - and so long as you use arrays for urls, always, your code isn't tied > to your desired route 'scheme' but you can do whatever you want. > > Regards, > > AD > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---
