There has been some recent discussion on the symfony mailing list about cross-linking between apps within the same project. I have managed to avoid having to use complex routing rules and instead have gotten away with adding absolute URLS to my app’s settings.yml file, and then using these addresses within my templates.
First, add appropriate URLs in the project’s config/app.yml file. As there are different settings used depending on the environment, you can put the full URL here and have it automatically use the right setting.
prod: url: frontend: http://public.mysymfonyapp.com backend: http://private.mysymfonyapp.com dev: url: frontend: http://myappdev/frontend.php backend: http://myappdev/backend.php
Then, in your template, whenever you need to link to the other app, use these settings:
<?php echo link_to('Admin Site', sfConfig::get('app_url_backend')) ?> or <?php echo link_to('Public Site', sfConfig::get('app_url_frontend')) ?>




Is there anything wrong with just redirecting with a relative path from within an action? It seems rather easy.
$this->redirect(“../otherAppName”)
I think this works because the native entry file is in the same directory as your index.php file.
I have just tried it and it seems to work just fine.
By Tim on Nov 16, 2007
actually, having the directives in the app file for dev vs prod environments is defiantly helpful. I guess i would just define a global app.yml file with the relative file path defined there.
example:
prod:
url:
corp_home: ../corp.php
member_home: ../member.php
guest_home: ../guest.php
dev:
url:
corp_home: ../corp_dev.php
member_home: ../corp_dev.php
guest_home: ../guest_dev.php
By Tim on Nov 16, 2007
I do something very similar to this but i use this function in my LocalSettings as well
public static function frontend_url($url_part)
{
$proto = sfConfig::get(‘app_frontend_proto’,'http’);
$host = sfConfig::get(‘app_frontend_host’);
if ($url_part[0] != ‘/’) $url_part = ‘/’.$url_part;
return $proto.’://’.$host.$url_part;
}
Then in templates you get the convience of doing such:
getId())?>
By Wiggins on Nov 9, 2008
heh the convience of doing:
<?= link_to(“Post”,LocalSettings::frontend_url(‘post/view/id/’.$post->getId()))?>
By Wiggins on Nov 9, 2008