Thanks! That is exactly what I'm after. Michal.
On Tue, May 18, 2010 at 12:49 PM, David Zülke <[email protected]> wrote: > On 18.05.2010, at 13:11, Michal wrote: > >> Passing a hostname for AgaviWebRouting::gen() isn't ideal for me, as >> the hostnames will be different depending whether I will be developing >> locally or on the server. I also would like it to remain fairy simply >> to change the subdomain names later if possible. Or indeed *not* use >> subdomains if I desire later without having to go through all of the >> code for the app. >> >> The routing callback: would there have to be a different Callback >> class for each subdomain? >> >> <route name="sub1" pattern="^sub1" source="_SERVER[SERVER_NAME]"> >> <callbacks> >> <callback class="SubdomainCallbackSub1" /> >> </callbacks> >> <route> >> ... routes for sub1 domain >> </route> >> </route> > > No. You can do: > <callback class="SubdomainCallback"> > <ae:parameter name="host">foobar</ae:parameter> > </callback> > And grab the parameter with $this->getParameter() in your callback. > > You could then also do: > <callback class="SubdomainCallback"> > <ae:parameter name="host">%com.myapp.hosts.sub1%</ae:parameter> > </callback> > > And configure all hostnames in settings.xml per environment (this is assuming > that you'll need them elsewhere as well, so that'll be much simpler). > > - David > > >> >> Although I can subclass the Callback class, and then subclass again >> for each subdomain, so the code for SubdomainCallbackSub1 would >> essentially just contain a string parameter "sub1", it seems mildly >> hackish to me to have a class just for a string parameter. Also, >> although I will have a fixed set of subdomains, if at some point the >> subdomains were to be generated dynamically, it doesn't seem posisble >> to do that. >> >> Is there another way? >> >> Michal. >> >> >> 2010/5/18 Niklas Närhinen <[email protected]>: >>> 18.5.2010 11:19, Michal kirjoitti: >>>> >>>> Hi, >>>> >>>> I'm currently developing a site that will run on multiple subdomains >>>> (with different content on each), and so I would like to >>>> >>>> 1) Route based on the "bottom" subomain, e.g. sub1 in sub1.domain.com, >>>> sub2 in sub2.domain.com >>>> >>>> 2) Not be dependent on the top domain levels (For example to be able >>>> to develop on sub1.domain.localhost) >>>> >>>> 3) Generate URLs *between* domains. >>>> >>>> For 1 and 2, using _SERVER[SEVER_NAME] as routing source, and just >>>> testing the left hand portion of the server name seems to work fine. >>>> However, I realise that I would like to gerate URLs between the >>>> domains. How would I go about doing this? >>>> >>>> Thanks, >>>> >>>> Michal. >>>> >>> >>> Hi, >>> you can define the hostname in AgaviWebRouting::gen() >>> example: >>> $ro->gen('routename', array(), array('host' => 'mysubdomain.domain.tld')); >>> >>> take a look at all the available options from here: >>> http://trac.agavi.org/browser/branches/1.0/src/routing/AgaviWebRouting.class.php#L68 >>> >>> Cheers, >>> Niklas >>> >>> _______________________________________________ >>> users mailing list >>> [email protected] >>> http://lists.agavi.org/mailman/listinfo/users >>> >> >> _______________________________________________ >> users mailing list >> [email protected] >> http://lists.agavi.org/mailman/listinfo/users >> > > > _______________________________________________ > users mailing list > [email protected] > http://lists.agavi.org/mailman/listinfo/users > > _______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
