Sammy はフロントエンド フレームワークです。baseurl を指定する必要はありません。すべての呼び出しはクライアント側で url のベースで行われるため、ポンド記号の後の残りのパスは sammy が使用するためだけに存在します。
元:
http://localhost/~rockdeveloper/play/sammy/#/products
http://localhost/~rockdeveloper/play/sammy/#/products/iphone
http://localhost/~rockdeveloper/play/sammy/#/products/iphone/cases/all
あなたのベースパスは
http://localhost/~rockdeveloper/play/sammy/
それらのすべてで。残りは単なるサミー ルートです (GET パラメータと考えてください)。
また、アンカーからシームレスに呼び出せるようにルートを定義する必要があります。これが私のルートファイルの一部です:
app = $.sammy('body', function() {
//define events
this.bind('addNew',function(e,data){
//data.name = data.name.split(' ').join('_');
for(x in mapa[data.element]){
if(mapa[data.element][x].name.toLowerCase() == data.name.toLowerCase()){
return alert('There is already an element with the same name');
break;
}
}
ap('Adding: '+data.element+' with the name: '+data.name);
mapa[data.element].push({name:data.name});
this.trigger('sections',{action:data.element});
});
// define routes
this.get('#/', function() {
$('#menuright').html('');
$('.customMenu').remove();
$('#holder').html('').attr({style:''});
});
this.get('#/someroute/:variable', function() {
/*
...
...
...
*/
});
this.before(function(){
if(typeof(app.historial)=='undefined'){
app.historial = [];
}
app.historial.unshift(this.path.split('#')[1]);
if(app.historial.length>2) app.historial.length = 2;
do_something();
});
});
そして、あなたの見解から、あなたは単に次のようなものを使うことができます:
<a href="#/someroute/{{name}}"><i class="icon-bookmark"></i> {{name}}</a>
//le me here using mustache :{