2013-05-17 186 views
0

爲了讓我的CMS的html輸出更具機器可讀性/可操作性,我試圖使用vie.js(viejs。org)。vie.js示例不能正常工作

不過,VIE-2.1.0.js總是拋出一個錯誤:

Uncaught TypeError: Object [object Object] has no method 'getByCid'

我也嘗試過其他的例子,如那些在這裏找到:

http://viejs.org/docs/2.1.0/index.html

也結束了相同的錯誤。

我貼我的代碼在這個小提琴:http://jsfiddle.net/2hwZS/

但我會在這裏也貼:

<!DOCTYPE html> 
<html> 
<head> 
    <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 
    <script src="http://underscorejs.org/underscore-min.js"></script> 
    <script src="http://backbonejs.org/backbone-min.js"></script> 
    <script src="http://neogermi.github.io/VIEwidgets/lib/jquery.rdfquery.js"></script> 
    <script type="text/javascript" src="http://viejs.org/js/vie-2.1.0.debug.js"></script> 
</head> 
<body> 
    <div id="index" typeof="http://rdfs.org/sioc/ns#Post" about="index"> 
     <h2 property="dcterms:title">Ich bin ein Blocktitel</h2> 
     <p property="sioc:content">Dieser Block hat nat&uuml;rlich auch einen Inhalt. Hier k&ouml;nnte jetzt alles stehen. Nachrichten, statischer Text, Termine oder einfach auch nichts. Wichtig ist nur, dass das Markup stimmt !</p> 
     <p>Verfasst von <span>Jan Gregor Triebel</span> am <span>17.05.2013/10:47 Uhr</span></p> 
    </div> 
    <script> 
     // Setting up VIE 
     v = new VIE({classic: true}); 
     v.use(new v.RdfaService()); 
     var objects = v.RDFaEntities.getInstances(); 
     var post = v.EntityManager.getBySubject('index'); 
     console.log(post); 
    </script> 
</body> 
</html> 
+1

已解決:只需使用backbone.js的0.9.2版本 - 因爲新版本不實現「getByCid」功能。它可以在github上找到:https://raw.github.com/documentcloud/backbone/0.9.2/backbone.js – Jan

回答