0

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.

  1. When I get to Step 2.2 Add the Demo Template by pasting in the Template.txt file into my newly created Template .cshtml file, I am not seeing as expected with my Heading (Content.Title) and my Call to Action button/link (Content.LinkText) are not appearing on screen. This is preventing me from creating even the most simple of templates
  2. 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

denisjoconnor
  • 115
  • 1
  • 9

1 Answers1

1

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?

iJungleBoy
  • 5,325
  • 1
  • 9
  • 21
  • Hi, yes that was it, thx! I would appreciate any tips for copying/duplicating a page with multiple modules to another DNN page as this will be quite important for our clients intentions. Is it a case of DNN>Copy page> then select each module individually again? Is there a way to drop module onto a new page with that as new demo content? which in turn can be edited again to have 2 instances of the same module? I am looking through your documentation in the meantime so I might resolve query but appreciate any help you may have. Regards, Denis – denisjoconnor Nov 29 '16 at 10:34
  • I read your previous solution here: http://stackoverflow.com/questions/39988175/copying-page-with-2sxc-content-doesnt-copy-the-modules Question: 1. create a template page with all modules, but make sure you always only close the view-picker, but don't add data yet 2. export it, so it's ready for import. I have a template page but each module has sample(my new demo content) inserted. How can I use this template page to create a functional template page which can be exported correctly? Thx – denisjoconnor Nov 29 '16 at 10:49