Developer forum

Forum » Templates » RE: Item publisher module data output in razor

RE: Item publisher module data output in razor

Aditya Bante
Reply

DESCRIPTION:

We are trying to output the data from a custom field on an item in the list, using the Item Publisher module. We cannot output the data from one field, if it is wrapped in an if-statement of another field.

Problem:

We have two fields, Location (systemName: EPlace) and EGoogle (systemName: EGoogle) . Both field types are Text. EPlace contains the location name and EGoogle contains a URL and when we try to use the EGoogle fields value as a link on EPlace field using <a href=” ”></a> tag it does not output the EGoogle fields value as a link. That is what we would like to achieve. Any suggestion?

I have attached the razor template file; it would make more sense of what I am trying to explain. Thank You.

Best Regards
Aditya Bante


Replies

 
Aditya Bante
Reply

here is the razor code. 

<link rel="stylesheet" href="/Files/Templates/ItemPublisher/ItemPublisher.css" /> <!--DW's css styles-->

<div class="items">
@if (@GetBoolean("ItemPublisher:Items.Any") == true)
{
    <ul class="items-list" style="text-align:center; color:white">

        @foreach (LoopItem i in GetLoop("ItemPublisher:Items.List"))
        {
            <li class="items-list-row items-clear">

                @foreach (LoopItem field in i.GetLoop("ItemPublisher:Item.Fields"))
                {
                    <span class="event-place">
                        @if (!string.IsNullOrEmpty(@field.GetString("ItemPublisher:Item.EPlace")))
                        {
                            @field.GetValue("ItemPublisher:Item.EGoogle.Value")@field.GetValue("ItemPublisher:Item.EPlace.Value")
                        }              
                    </span>
                }

           </li>
        }
    </ul>
}
</div>

 
Nicolai Høeg Pedersen
Reply
This post has been marked as an answer

Same answer as in other thread. Fields is not a loop inside List loop - their are at the same level.

Votes for this answer: 1

 

You must be logged in to post in the forum