smarty去除html标签,Smarty与脚本中的html标签爆裂
這BlueImp插件使用另一個(gè)jQuery插件稱(chēng)為T(mén)emplates engine從JavaScript生成HTML。他們恰巧使用了與Smarty相同的語(yǔ)法,這似乎正在破壞你的代碼。但是,BlueImp插件允許您通過(guò)手動(dòng)將HTML定義為插件選項(xiàng)來(lái)覆蓋此模板語(yǔ)言。你的JavaScript看起來(lái)是這樣的:
$('#fileupload').fileupload({
filesContainer: $('#upload_files_container'),
uploadTemplateId: null,
downloadTemplateId: null,
uploadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('
' +'
' +'
' +'
' +(file.error ? '
' :'
' +'
' +'
Start') + '
Cancel');row.find('.name').text(file.name);
row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.error').text(
locale.fileupload.errors[file.error] || file.error
);
}
rows = rows.add(row);
});
return rows;
},
downloadTemplate: function (o) {
var rows = $();
$.each(o.files, function (index, file) {
var row = $('
' +(file.error ? '
' +'
' :'
' +'
' +'
') + '
Delete ' +'
');row.find('.size').text(o.formatFileSize(file.size));
if (file.error) {
row.find('.name').text(file.name);
row.find('.error').text(
locale.fileupload.errors[file.error] || file.error
);
} else {
row.find('.name a').text(file.name);
if (file.thumbnail_url) {
row.find('.preview').append('')
.find('img').prop('src', file.thumbnail_url);
row.find('a').prop('rel', 'gallery');
}
row.find('a').prop('href', file.url);
row.find('.delete button')
.attr('data-type', file.delete_type)
.attr('data-url', file.delete_url);
}
rows = rows.add(row);
});
return rows;
}
});
See their documentation。這將允許您在不使用Smarty語(yǔ)法的情況下生成HTML。
總結(jié)
以上是生活随笔為你收集整理的smarty去除html标签,Smarty与脚本中的html标签爆裂的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 内存升级攻略:4GB够用?16GB更香
- 下一篇: 台式计算机序列号在哪,台式机如何查看序列