为什么Twig文档建议使用扩展而不是包含?Symfony 2文档说因为"在Symfony2中,我们喜欢以不同的方式思考这个问题:模板可以用另一个模板来装饰." 但仅此而已.这只是作者的心血来潮还是其他什么?感谢帮助.
文件说:
In any form, the three different types of data are:
Model data - This is the data in the format used in your application (e.g. an Issue object). If you call Form::getData() or Form::setData(), you're dealing with the "model" data.
Norm Data - This is a normalized version of your data and is commonly the same as your "model" data (though not in our example). It's not commonly used directly.
View Data - This is the format that's …Run Code Online (Sandbox Code Playgroud) 为什么这不起作用?
$(document).ready(function(){
var content = '<a href="http://example.com/index.php><b>Some text!</b></a> - <a href="http://example.com/index.php" class="ot-origin-anchor">News</a>';
$("#test").replaceWith(function(){
return content;
});
//Here is the problem. I don't know why but I can't define adres.
var adres = $("#test .ot-origin-anchor").attr("href");
//find example.com - ugly :P
var adresRegExp = adres.match(/(\w+:\/\/+(www.|))([^/]+)/);
alert(RegExp.$3);
});
</script>
<div id="test">bnb</div>
Run Code Online (Sandbox Code Playgroud)