Reputation: 115
I followed the steps as per the following guide tutorial: http://2sxc.org/en/Learn/Getting-started-with-creating-stuff/First-Content-Template But I am having trouble with one or two issues.
After pasting in the Template.txt code:
<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>
I am not seeing any placeholder and when I upload an image using ADAM it too wont appear to screen?
Not sure what I am doing wrong but would really appreciate some help on this as I also tried simply pasting in code from another one of your bootstrap templates into my new template but am getting the following error:
Error: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'string.IsNullOrEmpty(string)' has some invalid arguments at CallSite.Target(Closure , CallSite , Type , Object ) at System.Dynamic.UpdateDelegates.UpdateAndExecute2[T0,T1,TRet](CallSite site, T0 arg0, T1 arg1) at ASP._Page_Portals_0_2sxc_Content__text_block_image_block_12_cshtml.Execute() in d:\Inventise\trunk\Customers\St Josephs Foundation\Projects\Website\Sources\DNN-Root\Portals\0\2sxc\Content_text block_image block_12.cshtml:line 26 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at ToSic.SexyContent.Engines.RazorEngine.RenderTemplate() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\2Sexy Content Razor\RazorEngine.cs:line 76 at ToSic.SexyContent.Engines.EngineBase.Render() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\Engines\EngineBase.cs:line 89 at ToSic.SexyContent.SxcInstance.Render() in C:\Projects\2SexyContent\Web\DesktopModules\ToSIC_SexyContent\SexyContent\SxcInstance.cs:line 200
The path mentioned in the above error message appears wrong but I don't know where this can be amended?
I would appreciate help on this issue. Regards
Upvotes: 0
Views: 162
Reputation: 5638
I'll try to guide you through it, but I'm guessing you forgot to set a demo-item.
The demo-item is used to show data on a template, till a user adds his own. So it's really important to create an item in the admin UI (Step 1.5) and assign it to the template (Step 1.5.1). This allows the template to render, before you add any data to a page :).
If you don't have a demo-item, the template assumes it can't render, and will show a message that it doesn't have data yet - or it will try to render, and fail with errors like the one above.
Did that help?
Upvotes: 1