title: Symfony2 / Twig : Generate Alternate Absolute URL Path for use with CDN?
body: <p>This <a href="https://stackoverflow.com/questions/7358470/twig-asset-with-cdn-using-symfony-2">stackoverflow solution</a> almost answers my question. But I want to generate CDN urls in <code>Twig</code> to more than just resources. I'd like to generate them for dynamic content. So I don't think an Assetic tweak is the right area to be looking.</p>
  
  <p>For now, I can set CDN_url in <code>parameters.ini</code> and use that in my urls. My code would look like this : <code>{{CDN_Url}}{{url('route',{'param1':'value'}}</code> .. Code maintenance is one major reason I don't like this option. Then you could do things like check the route for <code>/cdn/</code> to generate the CDN url and everything else to be based on the domain. I wouldn't have to run around changing a lot of variables. AND if I wanted to stop the CDN url from generating. I could just modify the route. So there's a lot of benefits to figuring out if there's a clean solution to this.</p>
  
  <p>If, there's not a solution already - how would I start to extend the <code>{{ url() }}</code> functionality so that I could use it like <code>path</code> and <code>url</code>.</p>