What about just a new helper, e.g. email_link_to() which calls link_to but adds the hostname on the front? Store the hostname in your app.yml to make it a little more flexible.
On Fri, Jun 11, 2010 at 12:30 PM, Olivier LOYNET <[email protected]> wrote: > Hi, > > Is any solution has been found to get absolute links has Tom request ? > > Thanks, > Olivier > > >> -----Message d'origine----- >> De : [email protected] [mailto:symfony- >> [email protected]] De la part de Tom Boutell >> Envoyé : vendredi 13 novembre 2009 23:35 >> À : [email protected] >> Objet : [symfony-users] Forcing a canonical hostname for absolute links >> without clobbering the entire context: possible? >> >> >> I need to send emails from tasks, with valid links in them. Out of the >> gate, link_to produces bad absolute URLs because of course it has no >> idea what the site is called. >> >> I have read that this can be solved in the following fashion in >> factories.yml: >> >> prod: >> routing: >> class: sfPatternRouting >> param: >> context: >> host: www.pogil.org >> >> Unfortunately this seems to be a hard override of the entire context >> hash. Once it's done, Symfony won't populate it with runtime >> information like 'method'. >> >> The end result (perhaps among others) is that Doctrine routes break >> for users who are browsing the prod frontend controller. >> >> I guess I could work around this by creating duplicate environments >> just for command line work on each server: prod_cli, dev_cli, >> staging_cli, etc. But that requires a large amount of very error-prone >> duplication, in many configuration files. >> >> Is there an alternative way to fix the URLs generated by link_to which >> will work without overriding everything else in context and therefore >> making it an unusable technique in an environment that does get used >> in web controllers? >> >> I'd think being able to force a canonical site name in links would be >> a good feature anyway. >> >> Thanks! >> >> -- >> Tom Boutell >> P'unk Avenue >> 215 755 1330 >> punkave.com >> window.punkave.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 symfony- >> [email protected] >> For more options, visit this group at >> http://groups.google.com/group/symfony-users?hl=en >> -~----------~----~----~----~------~----~------~--~--- > > -- > If you want to report a vulnerability issue on symfony, please send it to > security at symfony-project.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 > -- If you want to report a vulnerability issue on symfony, please send it to security at symfony-project.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
