routing

CakePHP routing in pages controller

醉酒当歌 提交于 2019-12-04 18:58:49
I am creating a site with CakePHP, and I need to set some URLs for static pages, which are handled by the pages controller. Basically I want to have two different types of static pages, with the URLS mysyte.com/page which should map to app/views/pages/page.ctp and mysite.com/special/page which should map to app/views/pages/special-page.ctp . Note that in the first case page can be 'special' as well. I am a bit lost with the routing I have to set up for this situation. I have tried to use the two routes Router::connect( '/special/:mypage', array('controller' => 'pages', 'action' => 'display'),

Content-based routing with RabbitMQ and Python

寵の児 提交于 2019-12-04 18:58:22
问题 Is it possible with RabbitMQ and Python to do content-based routing? The AMQP standard and RabbitMQ claims to support content-based routing, but are there any libraries for Python which support specifying content-based bindings etc.? The library I am currently using (py-amqplib http://barryp.org/software/py-amqplib/) seems to only support topic-based routing with simple pattern-matching (#, *). 回答1: The answer is "yes", but there's more to it... :) Let's first agree on what content-based

Can have part of the domain name as a parameter in my routing rules?

南楼画角 提交于 2019-12-04 17:32:47
I'd like to have a routing rule that accepted part of my domain name as a parameter. For example: {name}.mydomain.com/photos/{id} Is this even possible? I have had a similar issue in using asp.net mvc, but with using the whole domain instead of just the subdomain. What we used was a custom route constraint to determine which controller to go to (domain determined controller on our project). Then in the controller we used the normal asp.net request.url properties to take an action. This may or may not help depending on your exact requirements. Parsa It wouldn't be possible since the {name}

Android Gps Routing system

北慕城南 提交于 2019-12-04 17:32:20
I'm developing an android application that would locate the user(assuming that the user is on the road) and the app will create the shortest route for the user to take to be able to go to the users chosen destination. Locating the user isn't the question since there's an API for that here: http://www.vogella.com/articles/AndroidLocationAPI/article.html so here's the catch. The roads ,intersections and their distances can be mapped or declared via variables in the code but my problem is that the GPS APIs i found so far would only return a longitude and latitude and not the road names or the

Angular route parameters contraints

纵然是瞬间 提交于 2019-12-04 17:22:31
I'm coming from the Asp.net MVC world where route constraints are really useful. I'm currently developing an Angular JS SPA that incorporates client side routing. I would also like to add parameter constraints to my client-side routes as in: $.routeProvider.when("/post/:id/:name?") where I'd like to constrain my :id parameter to only be valid when these are numbers. I haven't found anything similar in Angular Docs (which are horrible to say the least). Can it be done? And maybe also parameter defaults? There's no built-in way to set route constraints, but you can do it pretty easily yourself

Catch-all root level routing in Express.js: considerations and reserving possible routes for future use?

假如想象 提交于 2019-12-04 17:15:36
I'm using Express.js (3.0) to develop a Node web app; I'd like to have clean URLs for both user profiles: domain.com/username as well as for pages each user creates and shares: domain.com/username/pagename I really prefer the clean URLs to using something like domain.com/profile/username or domain.com/pages/username/pagename . The current route configuration for our development is bootstrapped like so: app.get('/', content.home); app.get('/about', content.about); app.get('/signup', users.signup); app.get('/login', users.login); app.get('/:user', users.profile); app.get('/:user/:userpage',

Pretty Paths in Rails

社会主义新天地 提交于 2019-12-04 17:11:34
I have a category model and I'm routing it using the default scaffolding of resources :categories . I'm wondering if there's a way to change the paths from /category/:id to /category/:name . I added: match "/categories/:name" => "categories#show" above the resources line in routes.rb and changed the show action in the controller to do: @category = Category.find_by_name(params[:name]) it works, but the 'magic paths' such as link_to some_category still use the :id format. Is there a way to do this? If this is a bad idea (due to some possible way in which rails works internally), is there another

button_to with GET method option in Rails

╄→尐↘猪︶ㄣ 提交于 2019-12-04 17:04:11
问题 I have the following button, which I overwrited to generate a GET request: = button_to "Tutor", {:controller => "appointments", :action => "new", :listing_id => @listing.id} , :method => :get However, I still get a POST request with extra params :method: Processing by AppointmentsController#new as HTML Parameters: {"authenticity_token"=>"AWkL", "listing_id"=>"2", "method"=>"get"} I my routes file, I have: resources :appointments What did I do wrong? Thank you. 回答1: Buttons aren't supposed to

ASP.Net WebForms Routing Single Route for Multiple Destinations

↘锁芯ラ 提交于 2019-12-04 16:09:05
I am looking into setting database routing up for a new website I plan to create. I have been looking at the following tutorial with regards to utilising friendlyUrls from a database: http://www.asp.net/web-forms/tutorials/aspnet-45/getting-started-with-aspnet-45-web-forms/url-routing However, I would like to use the same route structure for multiple entities. Meaning: mysite.com/{PlayerName} goes to player.aspx mysite.com/{TeamName} goes to team.aspx … and so on … Could somebody point in the right direction of achieving this with asp.net. Is it possible using the built in routing engine, or

adding a Route to the a Router in Zend Framework

六月ゝ 毕业季﹏ 提交于 2019-12-04 14:53:47
问题 I am using the mod-rewrite router. I am trying to add a Route to the router that will convert the following url: baseurl/category/aaa/mycontroller/myaction/param/value to be: Controller=mycontroller action=myaction --parameters-- category=aaa param=value I am using the following (not working) in my bootstrap, _front is the frontController $Router=$this->_front->getRouter(); $CategoryRoute = new Zend_Controller_Router_Route('category/:category/:controller/:action/*'); $Router->addRoute(