url-routing

Using `__destruct` to implement default routing?

跟風遠走 提交于 2019-12-25 07:30:12
问题 I'm updating a PHP framework I've written. It used to just use a default behavior for routing. For example consider a case where the request goes to domain.com/package/controller/method ... $url = ["package", "controller", "method"]; //Check if package exists... //Check if controller exists in package... //Check if method exists in controller... This is all well and good, and works perfectly. However, I wanted to add some additional functionality to my router. That functionality being the

how to set the Cordova configuration?

假装没事ソ 提交于 2019-12-25 06:46:32
问题 When I build applications by Cordova, for example for browser: "cordova run browser" I get a blank page "Not found", and the path in the address bar as follows: localhost:8000/index.html But if I remove from the address bar index.html and address bar is a localhost:8000/ everything works perfect. I tried in the config cordova to change the string for the src attribute - i write null string. Then everything from the start worked perfectly. But when I run the build for Android by cordova -this

Symfony: why is my main page example.com/web instead of example.com (as it should be?)

左心房为你撑大大i 提交于 2019-12-25 03:55:38
问题 My directory tree looks something like this: public_html example.com(containing symfony files) lib web app etc... example.net example1.com example1.net When I access my site via example.com it just shows my directory tree under the folder example.com, instead of routing to my actual homepage. How do I fix this? 回答1: You should place all files (except the web directory) in the directory directly above the web directory. Then create a symlink public_html to your web directory, or add the files

Yeoman vs UrlRouting

你离开我真会死。 提交于 2019-12-25 02:32:46
问题 I see how Yeoman work perfectly for a single-page webapp, but I struggle when I try to make it work for a simple php webpage. I have a simple problem: yeoman deals with caching, by renaming the assets, which is cool. Now let's assume, that your webpage is using UrlRouting, so an url like "/news/12/Puppies" would get redirected to the index.php file. Let's also assume, that you have a function, that will set a correct absolute url to the assets, based on the project root: absoluteUrl(). Your

With the route generated by the Vanity gem, what is the Rails route helper I can use?

久未见 提交于 2019-12-25 02:25:41
问题 This is the route the Vanity gem generates: controller :vanities do match ':vname' => :show, :via => :get, :constraints => {:vname => /[A-Za-z0-9\-\+]+/} end This is the rake routes: GET /:vname(.:format) {:vname=>/[A-Za-z0-9\-\+]+/, :controller=>"vanities", :action=>"show"} How do I use the Rails link helper to link directly to URL mydomain.com/vname ? 回答1: From the top of my head (sorry, I don't really have the time to test it right now): controller :vanities do match ':vname' => :show,

.net mvc custom types in urls

谁说我不能喝 提交于 2019-12-25 01:48:31
问题 I'm building an asp.net mvc app that uses the default url route «/{controller}/{action}/{id}» My problem is with the last item in this route, the id. The mvc framework automatically casts whatever in put in the id to the type of the parameter declared in the action. example: url: /mycontroller/myaction/1 public class mycontroller: Controller { public ActionResult myaction(int id) { // it works id == 1 } } But if I declare in the action a parameter of a custom type the mvc framework is unable

i18n URIs with CI Routing or mod_rewrite

笑着哭i 提交于 2019-12-25 01:26:59
问题 I'm trying to clean up my URIs on a multi-language CI site by changing the segment containing the language name to just the two-character language code. Currently, my URIs look like this: http://example.com // Home (English) http://example.com/english/home // Home (English) http://example.com/home // 404 (should go to english/home) http://example.com/sv // 404 (should go to swedish/home) http://example.com/swedish/home // Home (Swedish) http://example.com/sv/home // 404 (should go to swedish

MapPageRoute - can't send empty strings in the middle?

て烟熏妆下的殇ゞ 提交于 2019-12-24 19:36:01
问题 In Global.asax.cs in a project that I'm maintaining there is a method that looks like this private static void MapRouteWithName(string name, string url, string physicalPath, bool? checkPhysicalUrlAccess = null, RouteValueDictionary defaults = null) { Route route; if ((checkPhysicalUrlAccess != null) && (defaults != null)) { route = System.Web.Routing.RouteTable.Routes.MapPageRoute(name, url, physicalPath, checkPhysicalUrlAccess.Value, defaults); } else { route = System.Web.Routing.RouteTable

Prevent automatic passing of URL parameter in Razor Pages

五迷三道 提交于 2019-12-24 19:18:05
问题 I'm using the .NET Core 2 "Razor Pages" format for a web app. It allows you to define how to map the URL to variable names with a simple directive at the top: @page "{personId:int?}" The above, for example, would map the URL /Person/Index/123 to the IndexModel.OnGetAsync(int personId) function so that personId would have a value of 123. However, I've noticed that these values seem to be automatically added to any URL they could be, if a link exists on the page. If I add the following to the

Passing querystring Ids URL Routing using namespace system.web.Routing

Deadly 提交于 2019-12-24 18:59:53
问题 I'm new to URL routing. Case 1: I can implement URL Routing for URL:/content/category.aspx mapped to /Reservation Case 2: I'm not quite sure how to handle the query string values. For example: URL:/content/category.aspx?SID=5&CID=191 I want this to map to: /Reservation Code written for Case 1: Global.asa Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs) RegisterRoutes(RouteTable.Routes) End Sub Shared Sub RegisterRoutes(ByVal routes As RouteCollection) Dim urlPattern As