routing

Get #part in URL with PHP/Symfony

末鹿安然 提交于 2019-12-01 14:06:01
问题 I'm working with Symfony 1.2. I've a view with a list of objects. I can order them, filter them by category, or moving to the next page (there is pagination). Everything is done with AJAX, so I don't have to load all the page again. What I want to achieve is to have http://urltopage#page=1&order=title&cats=1,2 for example; so the new page is saved in the browser history, and he can paste it to another web. I haven't found a way to get the #part. I know that's only for the browser but I can't

Using the greedy route parameter in the middle of a route definition

南楼画角 提交于 2019-12-01 14:03:59
I'm trying to create routes which follow the structure of a tree navigation system, i.e I want to include the entire path in the tree in my route. So if I had a tree which looked like this Computers Software Development Graphics Hardware CPU Graphics cards Then I would like to be able to have routes that looks like this site.com/catalog/computers/software/graphics This, on it's own is not hard and can be caught by a route which looks like this catalog/{*categories} However I want to be able to add the product information at the end of that URL, something like this site.com/catalog/computers

How to pass a variable being an array in JavaScript to a controller accepting List[String] as a parameter?

北城余情 提交于 2019-12-01 13:25:13
The setup: Using Play! framework v 2.0.4 The controller: def javascriptRoutes = Action { implicit request => Ok( Routes.javascriptRouter("jsRoutes")( routes.javascript.Admin.approve ) ).as("text/javascript") } def approve(user: List[String]) = SecureAction('admin) { implicit ctx => Logger.debug("Admin.approve: " + user.foldLeft("")(_ + "::" + _)) user map { u => User.approve(u) } Ok(Json.toJson(user)) } The view: function get_selected() { return $.makeArray($(".user-selector").map(function (ind, user){ if(user.checked) return user.name; })); } $("#button-approve").click(function(){ jsRoutes

Route from Incoming ASPX url to an ASP.NET MVC Controller Action

会有一股神秘感。 提交于 2019-12-01 13:19:45
问题 I have a url Review.aspx?reviewId=3 and I'd like to have this url be routed to an MVC controller/action Review/3. Any ideas? 回答1: Never mind, a simple route like this worked: routes.MapRoute( "Reviews_Old", // Route name "LOreview.aspx", // URL with parameters new { controller = "LOReview", action = "Review", id = UrlParameter.Optional } // Parameter defaults ); And the query string parameters are model bound on the controller action parameters 来源: https://stackoverflow.com/questions/10590662

Check permissions before vue.js route loads

笑着哭i 提交于 2019-12-01 12:45:00
问题 does anyone know how to check a user's permissions before a vue.js route is rendered? I came up with a partial solution by checking permissions in the created stage of a component: created: function () { var self = this; checkPermissions(function (result) { if(result === 'allowed') { // start making AJAX requests to return data console.log('permission allowed!'); } else { console.log('permission denied!'); self.$router.go('/denied'); } }); } However, the issue is the entire page loads

Rails Routing Question: Mapping Slugs/Permalinks Directly under Root?

情到浓时终转凉″ 提交于 2019-12-01 12:38:48
Morning Everyone!.. General Routing Quesiton Here... I'm currently working to achieve a route similar to this for users in my application. http://www.example.com/ username This then maps to the usersControllers#show, hence I have the following in my routes file. map.connect '/:permalink', :controllers => "users", :action => "show" I've then got the show action to find the user by the permalink in the param. So its works but.... The problem I'm running into is that all other UNDEFINED routes get sent to userController#show. i.e 404's & other un-named routes. So I dont think i'm going with the

how to remove action name from URL in cakephp2

China☆狼群 提交于 2019-12-01 12:34:37
问题 may be duplicate but I don't get any proper answer or help actually I want to do like: my current URL is : http://mysite.com/MyController/view/page1 but I want something like :http://mysite.com/MyController/page1 means I want to hide action name from URL. I have used Router::connect('/:controller/:id',array('action' => 'view'),array('id' => '[0-9]+')); but its not working for me below one working fine but Router::connect('/:controller/*', array('action' => 'view'),array('id' => '[0-9]+')); it

How to Know Which component is loaded in router-outlet in Angular 5 and above

谁说我不能喝 提交于 2019-12-01 12:33:48
This my ap.component.html <app-header></app-header> <router-outlet></router-outlet> <app-footer></app-footer> How to know which component is loaded in Router outlet and then add a class on header or body depending on the component. Just Like if Home is loaded then add a home class on the body. or if 404 page then notfound class on body My Routing const routes: Routes = [ { path: '' , component: HomeComponent}, { path: 'directory' , component: DirectoryComponent }, { path: 'directory/:slug' , component: DirectorySingleComponent }, { path: 'pricing' ,component: PricingComponent }, { path:

ASP.NET MVC routing fails when using default.aspx/controller/action style url

旧巷老猫 提交于 2019-12-01 12:19:27
问题 I'm deploying an ASP.NET MVC site to a IIS6 webserver, so I'm using a default.aspx/{controller}/{action} style routing strategy. However, for some reason it doesn't really work when using the default.aspx part. No matter the url, it always gets the default action (Index) on the default controller (Public). I've been using the excellent Routing Debugger to see what's going on. route fail http://img169.yfrog.com/img169/7532/routefail.gif As you can see I'm requesting default.aspx/contact ,

Find total of second variable related to the distance of route from get.shortest.paths()

亡梦爱人 提交于 2019-12-01 12:17:41
I found the following question ( Find distance of route from get.shortest.paths() ) very helpful, but would like to take it one step further. I have added one column to the data frame and I would like to get the "total distance" related to the min newcost path. Below the igraph / R code that I used. df2 = rbind(c(234,235,21.6,75), c(234,326,11.0,35), c(235,241,14.5,78), c(326,241,8.2,98), c(241,245,15.3,75), c(234,245,38.46,65)) df2 = as.data.frame(df2) names(df2) = c("start_id","end_id","newcost","distance") df2 require(igraph) g2 <- graph.data.frame(df2, directed=FALSE) tkplot(g2) (tmp2 =