routing

Codeigniter Routing Regex

若如初见. 提交于 2019-12-11 01:54:46
问题 I have a site with multiple languages. For my news page I have two rules to route the pagination variable to my controller. One for all the languages (en, ct, cs, kr), and one for the default language. Routes.php $route['^(en|ct|cs|kr)/news/page/(:num)'] = 'news/index/$1'; $route['news/page/(:num)'] = 'news/index/$1'; News controller public function index($id) { echo $id; } The routes are accessing the news controller, however the $id parameter isn't being passed to the index() method. If I

.htaccess routing to subdirectory on server? performance/loading times

走远了吗. 提交于 2019-12-11 01:43:39
问题 I wonder if it is possible to use an .htaccess file to rout my domain directly to a subdirectory on my server? I bought a webhosting package from a regular webhoster where my domain.com is connected to my root directory of my server. I wonder if it is somehow possible to upload a .htaccess file to my root directory on my server that automatically routs domain.com (/index.php or /index.html) to domain.com/some-directory/ … And of course I don't want the addressbar to update to domain.com/some

My route returns a blank view (no html when I do view source)

瘦欲@ 提交于 2019-12-11 01:38:43
问题 I am brand new to Ruby on Rails and I have been trying to get a simple default route set up and working. When I try to run my application I get a blank result (if I do a view source, there is nothing there). Here are the relevant files (not sure if I am missing something that would be useful). app/config/routes.rb Blog::Application.routes.draw do root :to => "home#index" end app/views/home/index.html.erb <h1>Home#index</h1> <p>Find me in app/views/home/index.html.erb</p> app/controllers/home

Using HTTP routes within ZF2 console application

China☆狼群 提交于 2019-12-11 01:36:03
问题 I'm trying to write a console action to regenerate the XML sitemap for my application. ZF2 is detecting that I'm running the CLI version of PHP and is thus using console routing, but it then chokes with a "Route with name 'xxx' not found" when Zend Navigation tries to build the sitemap, because it doesn't know about any of the named HTTP routes. The same code works perfectly fine when used through the normal HTTP controller. Is there a way to make HTTP routes work within a console application

How would you providing routing for directions between points on a map? What are the missing pieces?

隐身守侯 提交于 2019-12-11 01:34:45
问题 With iOS 6 the Maps app is dropping Google Maps. The terms of the Google Maps SDK states that if you plot directions with their service you must show it on their map. Since this will no longer be the case I need to explore other options to get directions and display routes on a map. I have found that MapQuest and Nokia each offer an API to provide direction and routing services. MapQuest - http://open.mapquestapi.com/directions/ Nokia - http://api.maps.nokia.com/en/apireference/2.2.0/symbols

Encapsulate Express Routers

孤街醉人 提交于 2019-12-11 01:25:45
问题 Is it possible to create different routers using Express.Router that don't share middleware? To me it seems that Express.Router uses a singleton, so no matter what I try, the middleware gets attached to all routers. So, without having to create multiple instances of the Express app, is there a way to achieve the following: Create mutliple routers var router_a = Express.Router(); var router_b = Express.Router(); Give each router unique routes and middleware router_a.use(function(req, res, next

CakePHP - How to make routes with custom parameters?

不想你离开。 提交于 2019-12-11 01:18:59
问题 My Cake URL is like this: $token = '9KJHF8k104ZX43'; $url = array( 'controller' => 'users', 'action' => 'password_reset', 'prefix' => 'admin', 'admin' => true, $token ) I would like this to route to a prettier URL like: /admin/password-reset/9KJHF8k104ZX43 However, I would like the token at the end to be optional, so that in the event that someone doesn't provide a token it is still routed to: /admin/password-reset So that I can catch this case and redirect to another page or display a

Zend framework 2 : Add different authentication adapter for two different modules

送分小仙女□ 提交于 2019-12-11 01:16:02
问题 I have two different modules. Now I need to add different authentication mechanism for both modules. So I added event code first module's Module.php's onBootstrap method $listener = $serviceManager->get('First\Service\AuthListener'); $listener->setAdapter($serviceManager->get('First\Service\BasicAuthAdapter')); $eventManager->attach(MvcEvent::EVENT_ROUTE, $listener, 0); and in second module's Module.php's onBootstrap method $listener = $serviceManager->get('Second\Service\AuthListener');

Best way to deal with RoutingError in Rails 2.1.x?

此生再无相见时 提交于 2019-12-11 00:51:44
问题 I'm playing with the routing.rb code in Rails 2.1, and trying to to get it to the point where I can do something useful with the RoutingError exception that is thrown when it can't find the appropriate path. This is a somewhat tricky problem, because there are some class of URLs which are just plain BAD: the /azenv.php bot attacks, the people typing /bar/foo/baz into the URL, etc... we don't want that. Then there's subtle routing problems, where we do want to be notified: /artists/ for

How to pass the React Router location prop to a component?

本秂侑毒 提交于 2019-12-11 00:36:37
问题 I'm trying to figure out how to pass React Router's location prop to a component. I have a route defined like so: <Route path="placeholder" render={(props) => <Navigation {...props} />} /> In my Navigation component I do console.log(this.props); in the render method only to get an empty object. What gives? Isn't the location prop supposed to be automatically supplied to any component inside a Route? By the way, I'm using react-router-dom version 4.2.2 . 回答1: You need to wrap your component