开发者

symfony routing problems

I'm building a site using symfony php framework.

I have a link in my page which leads to page X :

<a href="/X">test</a>

well, the problem is, under my development environment, the link works and the link points to

http://localhost/web/frontend_dev.php/X

but when Im using the production page (index.php) the link turns out to poin开发者_开发知识库t to :

http://localhost/web/X

when it should point to :

http://localhost/index.php/X

any ideas what the problem is ?

thanks!


Every link in symfony template should be generated by helper link_to() or url_for(): http://www.symfony-project.org/book/1_2/07-Inside-the-View-Layer

frontend_dev.php - is a development version of the front controller. If you are accessing a page via this controller (http://localhost/frontend_dev.php/testmodule/testaction), all links will be processed by this controller. If you will call your site via production controller (index.php, the default one), all links will point via it: (http://localhost/testmodule/testaction): http://www.symfony-project.org/book/1_2/06-Inside-the-Controller-Layer

Also, you have incorrect site layout. You shouldn't have any "web" subfolder in the site. Symfony libraries should be put into non-accessible area by browser. You should reread symfony documentation once more. And study this learning-project: http://www.symfony-project.org/jobeet/1_2/Doctrine/en/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜