routing

Multiple pattern in single symfony routing

梦想的初衷 提交于 2019-12-18 12:54:38
问题 How to make multiple pattern in single Symfony routing? Normally we have a routing as blog: pattern: / defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } Is it possible to have two routing patterns? Something like blog: #Below pattern to match with '/' or '/index' pattern: {/ , /index} defaults: { _controller: AcmeBlogBundle:Blog:index, page: 1 } 回答1: Are you using Symfony2? If you are and can use annotations for your routing instead of yml or xml then it's possible to have

Passing a {sitename} parameter to MVC controller actions

拜拜、爱过 提交于 2019-12-18 12:49:04
问题 How can I retrieve a site-wide URL parameter in a route without cluttering each controller action with a parameter? My question is similar to this question, but I want to avoid the ModelBinder clutter. Ie. in Global.asax.cs : routes.MapRoute( "Default", // Route name "{sitename}/{controller}/{action}/{id}", new { sitename = "", controller = "SomeController", action = "Index", id = "" } ); So, instead of the following in SomeController class: public ActionResult Index(string sitename) {

Can I send data via express next() function?

99封情书 提交于 2019-12-18 12:28:52
问题 I'm working on a webapp that requires atuhentication process and session management with express. I've done with the backend sessions stuff. Now i want to show on the UI the user who is signed in. privateContent is a function that verify if someone is logged in, Like so: ... app.get( '/authRequired', queries.privateContent , routes.tasks ); ... Here is queries.privateContent: ... exports.privateContent = function ( req, res, next ) { if ( req.session.user ) { var username = req.session.user

ASP.NET MVC routing and areas

末鹿安然 提交于 2019-12-18 12:21:48
问题 I am messing around with ASP.NET MVC 2 Preview 2 and am trying to figure out how routing works with areas and such. In a single project implementation of areas, I want an area named "admin". I am trying to be able to have urls like this: (root)/admin/apples/search (root)/admin/apples/edit/3 (root)/admin/apples/add (root)/admin/oranges/search (root)/admin/oranges/edit/5 (root)/admin/oranges/add (root)/admin I have the area created. I have the controllers created with their respective views,

Can I group multiple domains in a routing group in Laravel?

人走茶凉 提交于 2019-12-18 10:53:02
问题 Let's say I have the following: Route::group(array('domain' => array('admin.example.com')), function() { ... }); Route::group(array('domain' => array('app.example.com')), function() { ... }); Route::group(array('domain' => array('dev.app.example.com')), function() { ... }); Is there any way to have multiple domains share a routing group? Something like: Route::group(array('domain' => array('dev.app.example.com','app.example.com')), function() { ... }); 回答1: Laravel does not seem to support

Can I group multiple domains in a routing group in Laravel?

和自甴很熟 提交于 2019-12-18 10:52:35
问题 Let's say I have the following: Route::group(array('domain' => array('admin.example.com')), function() { ... }); Route::group(array('domain' => array('app.example.com')), function() { ... }); Route::group(array('domain' => array('dev.app.example.com')), function() { ... }); Is there any way to have multiple domains share a routing group? Something like: Route::group(array('domain' => array('dev.app.example.com','app.example.com')), function() { ... }); 回答1: Laravel does not seem to support

asp.net mvc localization

有些话、适合烂在心里 提交于 2019-12-18 10:38:36
问题 I'm trying to implement localization with routes I have the following: routes.MapRoute( "DefaultLocalized", "{lang}/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "", lang = "en" } ); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); When I call my page domain/en/home/index , it works fine but when i call domain/home/index I get error 404: resource cannot be found. Also when I'm at domain/en/home

asp.net mvc localization

守給你的承諾、 提交于 2019-12-18 10:38:14
问题 I'm trying to implement localization with routes I have the following: routes.MapRoute( "DefaultLocalized", "{lang}/{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "", lang = "en" } ); routes.MapRoute( "Default", "{controller}/{action}/{id}", new { controller = "Home", action = "Index", id = "" } ); When I call my page domain/en/home/index , it works fine but when i call domain/home/index I get error 404: resource cannot be found. Also when I'm at domain/en/home

My Routes are Returning a 404, How can I Fix Them?

微笑、不失礼 提交于 2019-12-18 10:17:53
问题 I've just started learning the Laravel framework and I'm having an issue with routing. The only route that's working is the default home route that's attached to Laravel out of the box. I'm using WAMP on Windows and it uses PHP 5.4.3, and Apache 2.2.22, and I also have mod_rewrite enabled, and have removed the 'index.php' from the application.php config file to leave an empty string. I've created a new controller called User : class User_Controller extends Base_Controller { public $restful =

Default segment name in rails resources routing

三世轮回 提交于 2019-12-18 08:59:04
问题 I want to create a route in my rails application along the lines of /panda/blog /tiger/blog /dog/blog where panda, tiger, and dog are all permalinks (for an animal class) The normal way of doing this map.resources :animals do |animal| animal.resource :blog end would create routes along the lines of /animals/panda/blog /animals/tiger/blog /animals/dog/blog But i do not want the first segment, as it will always be the same. I know I could do this by manual routing, but I want to know how to do