Why not use your frontend controller to set a constant.

I use it to set the application based on the subdomain, but I've used it 
to set other info for a project. I needed a different Google Map API Key 
for two formats of the same application. I'm not sure if this is the 
'right' way to do it but it works.

/**
   * Check subdomain name and define category accordingly:
   */
if ( isset($_SERVER) &&
      is_array($_SERVER) &&
      isset($_SERVER['HTTP_HOST']) &&
      preg_match('/categoryone/', $_SERVER['HTTP_HOST'])
    )
{
   define('CATEGORY', 'one');
}
elseif (
      isset($_SERVER) &&
      is_array($_SERVER) &&
      isset($_SERVER['HTTP_HOST']) &&
      preg_match('/categorytwo/', $_SERVER['HTTP_HOST'])
        )
{
   define('CATEGORY', 'two');
}
else
{
   define('CATEGORY', 'default');
}

HTH

Tom

Damien wrote:
> Hi!
> 
> I have a website built with symfony, organized with categories. I
> would like to have a subdomain for each category. For example:
> 
> mymcategory.mywebsite.com
> 
> I made my subdomain and catch it in my apache webserver, but I don't
> know how to make it available in my website.
> I tought to build a new route in my routing.yml like:
> 
> subdomain:
>   host: mycategory.mywebsite.com
>   url:    /
>   param: {module: category, action: show, name: mycategory}
> 
> It doesn't work. Should I use it or make a filter ? But I don't know
> how to make this type of filter.
> 
> I hope you will be able to help me.
> 
> Thank you
> 
> Damien Gougeon
> > 
> 

-- 
Tom Haskins-Vaughan
Temple Street Media: Design and Development for the Web
[EMAIL PROTECTED] | www.templestreetmedia.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony users" 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/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to