0
我有一個在umbraco cms的asp.net網站,那裏我可以使用剃刀模板來創建一些宏。 我想在頁面中整合一個像facebook一樣的按鈕, 這隻適用於我將剃鬚刀宏中的裝飾iframe粘貼並將宏集成到我的母版頁上時。Facebook的按鈕iframe與動態網址打印在asp.net剃刀模板
雖然,如果我想包括一些參數, 和我把代碼片段中的iframe URL粘貼到該URL 中的另一個參數,它停止工作。
但是,渲染後兩個iframe url是100%相同的。
任何人都有一個想法,我怎麼可以確保正確的網站網址在Facebook的iframe參數可以改變? (根據我的一把umbraco CMS綁定的主機名)
這裏是我的剃刀代碼不起作用:
@{
var currentLangPath = "www.newurl.com";
var iframeSource = "http://www.facebook.com/plugins/like.php?app_id=207125959336150&href=" + currentLangPath + "&send=false&layout=button_count&width=110&show_faces=false&action=like&colorscheme=dark&font=arial&height=21";
}
<a href="#visitFanpage"><img src="/images/facebook_logo.jpg" alt="Solex Facebook" /></a>
<p>Become part of the community, and feel free to share your experience.</p>
<div class="social">
<iframe src="@iframeSource" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:25px;" allowTransparency="true"></iframe>
</div>
這裏是不會工作剃刀文件的內容:
<a href="#visitFanpage"><img src="/images/facebook_logo.jpg" alt="Solex Facebook" /></a>
<p>Become part of the community, and feel free to share your experience.</p>
<div class="social">
<iframe src="http://www.facebook.com/plugins/like.php?app_id=207125959336150&href=www.newurl.com&send=false&layout=button_count&width=110&show_faces=false&action=like&colorscheme=dark&font=arial&height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:110px; height:25px;" allowTransparency="true"></iframe>
</div>
注意這兩個文件剃鬚刀具有完全相同的輸出,所以我覺得很奇怪的是,動態URL一個不工作。
織補,應在實際來源,而不是採取從螢火蟲所呈現的網址已經看過,螢火蟲已經解碼實體,所以這些網址看起來完全相同。 謝謝你的提示,要嘗試馬上 – Sander
作品如微風!感謝 必須做更多的剃刀:) – Sander