routing

Intermediate route optional parameters in Symfony 2

99封情书 提交于 2019-12-01 23:34:27
Problem to solve Is it possible in Symfony 2, define routes with ' intermediate ' optional parameters. I'll use other question data , for supporting me using the same style, for example: localhost /param 1/param 2/param 3/param 4 Example localhost /param 1/param 4 localhost /param 2/param 4 Because I have a problem where none of my parameters should be mandatory, and different logics come into play, subordinated to those activated parameters. Until now if I don't set like this: - localhost /param 1/param 2/... ( missing: param 3/param 4 ) I can't play with intermediate parameters and it's a

Can I have a variable number of URI parameters or key-value pairs in Laravel 4?

非 Y 不嫁゛ 提交于 2019-12-01 22:02:40
I've got a shopping cart that I'd like to be able to pass a variable amount of optional parameters. Things like: sort by, filter by, include/exclude etc. So the URL may be: /products /products/sort/alphabetically /products/filter/cloths /products/socks/true /products/sort/alphabetically/socks/true/hats/false/ Etc. I suppose I could have a route with placeholders for all of the possible parameters and set default values in the URL, so something like: Route::get('products/sort/{$sort?}/filter/{$filter?}/socks/{$socks?}/hats/{$hats?}/...', function($sort = 'alphabetically', $filter = false,

Determine if path exists as route in Rails controller

放肆的年华 提交于 2019-12-01 21:06:50
I want to know if an arbitrary path can be mapped to a route recognized_request_for accomplishes what I want, but I can't get it to work in my controller. Specifically, how can I execute recognized_request_for or something that accomplishes the same task from my controller? swrobel For Rails 3 the call is Rails.application.routes.recognize_path Instead of ActionController::Routing::Routes.recognize_path Example: def path_exists?(path) begin Rails.application.routes.recognize_path(path) rescue return false end true end SOLUTION: @related_page_path = '/' + @page.path begin ActionController:

CodeIgniter site in subdirectory, htaccess file maybe interfering with htaccess file in main directory?

狂风中的少年 提交于 2019-12-01 20:49:55
In my CodeIgniter site (hosted on GoDaddy), navigating to any page but the index gives me this error: No input file specified. Googling around, it seems like the cause must have something to do with my .htaccess situation. The way this is set up, and maybe this can eventually change, is that my CI site is in a subdirectory of the main domain. The CI site and main domain each have their own .htaccess files. The CI htacess file is located in the applications folder: <IfModule mod_rewrite.c> Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %

How to send object from 1 $state into another $state with ui-router

一曲冷凌霜 提交于 2019-12-01 20:37:06
https://plnkr.co/edit/nqyBTcBgBimjkrpf2oYo?p=preview Expected After Login Selecting a Ticker button should make the Tags module display the matching Tags for that Ticker. Results After Login Selecting a Ticker button will replace the entire app in the index's ui-view with the Tags $state object. App's current state path: -> login > container > tags The ticker button click in the Tickers component: $scope.clickTicker = function(ticker) { console.log(' Ticker clicked!', ticker) $state.go('tags', { ticker: ticker }); } app.container.html (We go here after login) container state <div> <dashboard

ASP.net web api 2 Route-Attribute not working

主宰稳场 提交于 2019-12-01 20:02:05
问题 I've the following problem, my route attribute is not working. I have the following action: [HttpGet] [Route("~api/admin/template/{fileName}")] public HttpResponseMessage Template(string fileName) { return CreateHtmlResponse(fileName); } and i want to access the action like .../api/admin/template/login.html , so that Template get login.html passed as the file name. But i alsways get: No HTTP resource was found that matches the request URI 'http://localhost:50121/api/admin/template/login.html'

Yii2 - subdomain routing

房东的猫 提交于 2019-12-01 18:34:57
I want to use subdomain as id, and I need dynamic router to do this. In urlManager , I added this line: "http://<user:\w+>.local.dev/<controller:\w+>/<action>" => '<controller>/<action>', When I try any action, for example: function actionMyAccount($user){ echo $user;... } I am not getting anything - the var isn't printed, and script stops working (screen is white). When I remove $user, the page is loading without any problems How can I achieve subdomain router? I think your router mapping setting is OK. If you want it to be more precise: "http://<user:[^www]\w+>.local.dev/<controller:\w+>/

ASP.NET MVC Get Route values from a URL

橙三吉。 提交于 2019-12-01 17:24:15
问题 I want to work out what the route values for the UrlReferrer in the controller action would be. I can't figure out at what part in the MVC pipeline the incoming URL is converted into RouteValues, what I'm trying to achieve is close to that. 回答1: You need call RouteTable.Routes.GetRouteData with a mocked HttpContextBase which returns your URL in its Request . The routes are matched internally using the request's AppRelativeCurrentExecutionFilePath . However, this functionality is not exposed,

ASP.NET MVC Get Route values from a URL

假装没事ソ 提交于 2019-12-01 17:14:05
I want to work out what the route values for the UrlReferrer in the controller action would be. I can't figure out at what part in the MVC pipeline the incoming URL is converted into RouteValues, what I'm trying to achieve is close to that. SLaks You need call RouteTable.Routes.GetRouteData with a mocked HttpContextBase which returns your URL in its Request . The routes are matched internally using the request's AppRelativeCurrentExecutionFilePath . However, this functionality is not exposed, so you need to pass an HttpContextBase . You need to create an HttpContextBase class which returns an

How To Set Startup Route In ASP.NET Core

…衆ロ難τιáo~ 提交于 2019-12-01 17:06:37
My ASP.NET core app startup route is set as: /api/values I want to change this startup route to be: / Looking through the documentation there is lots of specification on route constraints but I'm not sure I see how to set the route that gets run on startup... It's calling the wrong controller on startup. If I remove the controller (ValueController), I get a 404. Where is it specified to use this controller at runtime? I'm seeing hope in the hidden launchSettings.json but editing http://localhost:5000/api/value to http://localhost:5000/ does not help Adam Weitzman is right, but you can also