2012-06-07 135 views
0

我有一个应用程序,它主要文件看起来像这样的(1),(2),(3)。骨干路由器......如何处理URL

的Backbone.Router在这种情况下正常工作(因为它触发#page):

http://localhost/index.php#page 

我应该如何配置它,如果是以下URL(为了触发/some#page):

http://localhost/index.php/some#page 

PS:
这个Web应用程序的后端使用Synfony2


(1)

// index.php 
<script data-main='mainApp.js' src='require.js'> 

(2)

// mainApp.js 
define([ 
    'js/router' 
], function(Router) { 
    "use strict"; 
    var initialize = function() 
    { 
      Router.initialize(); 
    } 

    return { 
     initialize: initialize 
    }; 
}); 

(3)

// router.js 
define([ 
    'myView' 
], function(MyView){ 
    console.log(MyView) 
    var AppRouter = Backbone.Router.extend({ 
     routes: { 
      'page' : 'view' 
     }, 

     view: function() { 
      //some code 
     } 
    }); 
}); 

回答

2

工作的呢?

routes: { 
    '/some:page': 'view', 
} 
+0

非常感谢,我没有修复它。 –

+0

@LorraineBernard:甜的! –