Search code examples
2sxc

Issue getting content to render via Template in App


When I have a view set up, but I can not get it to spit out content unless I don't have have a content type set, then I can get text to least spit out.

However when I select a content type, nothing spits out and it says it has no demo item.

No content type selected - I can get text to show, it wont loop through my four pieces of content or render tokens.

https://i.sstatic.net/F9rCe.jpg

https://i.sstatic.net/CCtEU.jpg

https://i.sstatic.net/SBGKP.jpg

If I select content type - it just says no demo content

https://i.sstatic.net/KxwfZ.jpg

https://i.sstatic.net/pKBue.jpg

If I select a demo content

https://i.sstatic.net/9O5fM.jpg

If I select demo content and not content type

https://i.sstatic.net/9O5fM.jpg

Im sure I am missing something small. The more I click around and explore though the more confused I am becoming. I come from a Drupal background, so I love the idea of this and would really want to use DNN like I would a Drupal site.

Thanks for the help on this.


Solution

  • For anyone struggling with this, we found the solution for this was checking if the field was null.

    <div class="row">
     @foreach(var cont in AsDynamic(App.Data["Homepage Blocks"])){
        <div class="col-md-6 block__wrapper">
            <a href="@(cont.Url != null ? cont.Url : "")">
                <div class="block__contianer" style="background-image: url('@(cont.Image != null ? cont.Image : "")')">
                    <div class="block__square">
                        <h2><span style="color:#ffffff;">@(cont.Headline != null ? cont.Headline : "")</span></h2>
                    </div>
                </div>
            </a>
        </div>
    }
    </div>