簡體   English   中英

創建2sxc內容模板

[英]Creating 2sxc Content Template

我按照以下指南進行了操作: http : //2sxc.org/en/Learn/Getting-started-with-creating-stuff/First-Content-Template但是我遇到一個或兩個問題。

  1. 轉到步驟2.2時,通過將Template.txt文件粘貼到新創建的Template .cshtml文件中來添加演示模板,但標題(Content.Title)和號召性用語按鈕/鏈接( Content.LinkText)沒有出現在屏幕上。 這使我無法創建最簡單的模板
  2. 粘貼Template.txt代碼后:

     <div class="sc-element"> @Edit.Toolbar(Content) <!--- Edit toolbar --> <div class="co-person-image col-sm-4"> @if (!String.IsNullOrEmpty(Content.Photo)) { <img src="@Content.Photo?w=350" alt="@Content.Name" class="img-responsive" /> } else { <div class="co-person-placeholder"></div> } </div> <div class="co-person-text col-sm-8"> <p> <strong>@Content.Name</strong><br /> @if (!String.IsNullOrEmpty(Content.Position)) { @Content.Position<br /> } </p> <p> @if (!String.IsNullOrEmpty(@Content.EMail)) { <a href="mailto:@Content.EMail">@Content.EMail</a><br /> } @if (!String.IsNullOrEmpty(Content.Phone)) { <text>@Content.Phone<br /></text> } </p> @Html.Raw(Content.Description) </div> </div> 

我沒有看到任何占位符,當我使用ADAM上傳圖像時,它也不會出現在屏幕上嗎?

不確定我做錯了什么,但是對此我將非常感謝,因為我還嘗試將代碼從另一個引導模板粘貼到新模板中,但是出現以下錯誤:

錯誤:Microsoft.CSharp.RuntimeBinder.RuntimeBinderException:“ string.IsNullOrEmpty(string)”的最佳重載方法匹配在System.Dynamic.UpdateDelegates.UpdateAndExecute2的CallSite.Target(Closure,CallSite,Type,Object)具有一些無效參數。 T0,T1,TRet](CallSite網站,T0 arg0,T1 arg1)位於ASP._Page_Portals_0_2sxc_Content__text_block_image_block_12_cshtml.Execute(),位於d:\\ Inventise \\ trunk \\ Customers \\ St Josephs Foundation \\ Projects \\ Website \\ Sources \\ DNN-Root \\ Portals 0 \\ 2sxc \\ Content_text block_image block_12.cshtml:第26行,位於System.Web.WebPages.WebPageBase.ExecutePageHierarchy()位於System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext,TextWriter writer,WebPageRenderingBase startPage)在ToSic.SexyContent.Engines C:\\ Projects \\ 2SexyContent \\ Web \\ DesktopModules \\ ToSIC_SexyContent \\ 2Sexy Content Razor \\ RazorEngine.cs:第76行的。 Web \\ DesktopModules \\ ToS IC_SexyContent \\ SexyContent \\ Engines \\ EngineBase.cs:第89行,位於C:\\ Projects \\ 2SexyContent \\ Web \\ DesktopModules \\ ToSIC_SexyContent \\ SexyContent \\ SxcInstance.cs:第200行的ToSic.SexyContent.SxcInstance.Render()

上面的錯誤消息中提到的路徑顯示錯誤,但我不知道可以在哪里修改?

在此問題上的幫助,我將不勝感激。 問候

我會嘗試指導您完成操作,但是我猜您忘記設置演示項目了。

演示項目用於在模板上顯示數據,直到用戶添加自己的數據為止。 因此,在管理用戶界面中創建一個項目(步驟1.5)並將其分配給模板(步驟1.5.1)非常重要。 在將任何數據添加到頁面之前,這允許模板呈現:)。

如果您沒有演示項目,則模板會假定它無法渲染,並會顯示一條消息,提示它尚無數據-否則它將嘗試渲染,並因上述錯誤而失敗。

有幫助嗎?

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM