routing

How can i remove /index in URL in routing in cakePHP?

不羁岁月 提交于 2019-12-25 04:55:12
问题 I want to remove /index in URL. I have already tried the following in routes.php file : Router::connect('/Home/:index', array('controller' => 'Homes')); and : Router::connect('/Home/', array('controller' => 'Homes','action'=>'index')); 回答1: Try Router::connect('/Home', array('controller' => 'Homes','action'=>'index')); 回答2: Use this code for create link <?php echo $this->Html->link(__('YOUR_TEXT'),array('controller' => 'Homes', 'action' => 'index',array('class' => "", 'id' => "")); ?> If you

Rails 3 better routing

谁说胖子不能爱 提交于 2019-12-25 04:31:30
问题 Out of curiosity. In the docs of rails3 they say that as rule of thumb, I shouldn't nest more than one level of resources. Is there any better way to do that then? scope "(:locale)", :locale => /pl/ do resources :users namespace "admin" do resources :universities do resources :faculties end end end 回答1: Why? You're not nesting more than one level of resources :-) 来源: https://stackoverflow.com/questions/4679699/rails-3-better-routing

jQuery mobile routing solution?

六眼飞鱼酱① 提交于 2019-12-25 04:24:41
问题 I have a mobile app which was build with jquery mobile in a classic way - on every page transition html content is loaded via AJAX request and inserted into data-role="content" element. What I want to refactor is client-side, there's an ugly code that finds specifc id in DOM in order to differentiate pages and run url dependant code. ... if $page.find('#commentary').length unless @CommentaryView @CommentaryView = new CommentaryView @CommentaryView.render page return if $page.find('#coupons')

Security and routes - Symfony2

亡梦爱人 提交于 2019-12-25 04:07:19
问题 I want the index page for my project to be a login form with a link for registration below it and unlogged visitors should be able to see only the login form with route / and the register page with route /register . When the log I want they to be redirected to the home page with route /home . I tried some things and it's working in the dev environment (although having some troubles with the toolbar - Symfony2 - dev environment) but when I switch to prod env, the browser says: "The page isn't

how to call a controller with express routes and include a defined parameter

南笙酒味 提交于 2019-12-25 03:52:40
问题 //in routes.js (a rough attempt of what I want) app.get('/test', myCtrl.test(req, res, next, 'type1')); //in myCtrl.js exports.test = function(req, res, next, type){ res.jsonp(type); }; Like this it gives an error: ReferenceError: req is not defined 回答1: Wrap that in an anonymous function else it will exec right away: app.get('/test', function(req, res) { myCtrl.test(req, res, next, 'type1'); }) 来源: https://stackoverflow.com/questions/26220473/how-to-call-a-controller-with-express-routes-and

cant redirect correctly after login is done

谁说胖子不能爱 提交于 2019-12-25 03:43:06
问题 I am trying to do login page like in example here: https://github.com/keithdmoore/ionic-http-auth I have 2 issues: 1.getting error when trying to redrect to app page Error: Cannot transition to abstract state 'app' the code: .controller('LoginCtrl', function ($scope, $state, AuthenticationService) { $scope.message = ""; $scope.user = { username: null, password: null }; $scope.login = function () { AuthenticationService.login($scope.user); }; $scope.$on('event:auth-loginRequired', function (e,

ASP.Net MVC View and Controller file structure

ⅰ亾dé卋堺 提交于 2019-12-25 03:22:36
问题 I am very confused the View and corresponding controller has to be set in MVC 1.0 project structure. Currently in a default application we have About.aspx page under Home folder and all the controller action is handled in HomeController. This controller mixes up Home action and About action. It makes things messy. I like to have clear separation of my controller. Like to have one About Controller and HomeCotroller separately. For it I have create another folder "About" under view folder and

MVC Routing with multiple parameters is not working

試著忘記壹切 提交于 2019-12-25 03:05:19
问题 Hey All I Added two custom routes routes.MapRoute( "ParentCat", "{PCat}/{id}", new { Controller = "Adds", Action = "DetailWanted", PCat = UrlParameter.Optional, id = UrlParameter.Optional }); routes.MapRoute( "SubCat", "{PCat}/{SCat}/{id}", new { Controller = "Adds", Action = "DetailWanted", PCat = UrlParameter.Optional, SCat = UrlParameter.Optional, id = UrlParameter.Optional }); for the urls localhost:2110/Category/addid & localhost:2110/Category/SubCategory/addid but debugger straight

cakephp routing problem, plugin routing works but not others

让人想犯罪 __ 提交于 2019-12-25 02:59:26
问题 I'm having a strange routing problem with a site I just uploaded, and I've made a number of changes to test what's happening. It doesn't make any sense. My setup is: I'm using one plugin, which I've included all the routing in the routes.php file. I've also included the routes for two other controllers, 'events' and 'updates' they look like this: Router::connect('/login', array('plugin' => 'pippoacl', 'controller' => 'users', 'action' => 'login')); Router::connect('/logout', array('plugin' =>

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,