Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
Hi there, I am a neewbie to Umbraco and have run into a problem.
When trying to setup my "articles main" template under "settings" I have this code that should render out both text and image.
However it does not render image, only the text from the other fields.
Could anyone help?
I have this code:
@{ var selection = Umbraco.Content(Guid.Parse("e7977742-a161-4fdb-a579-415d705b4d25")) .Children("articleItem") .Where(x => x.IsVisible()); }
@foreach (var item in selection) { <div class="col-xs-12 col-sm-12 col-md-6 col-lg-6"> <div class="box london"> <div class="box-icon"> <img src="@item.Value("articleImage770390")" alt="@Model.Value("articleImage770390")" class="img-responsive"> </div> <div class="info float-container"> <div class="col-sm-12 london-title"> @item.Value("articleTitle") </div> <!-- Her kommer truncated indhold --> @Html.Raw(item.Value("articleContent").ToString().Truncate(100)) <div class="col-sm-12 location-main"> <hr> <!-- her kommer knap og dato --> @item.Value("articleBtnDate") </div> </div> </div>
Thanks in advance //Carsten
Hi Carsten,
Looks like the image url is being output as it’s IPublishedContent form, give
@item.Value("articleImage770390").Url
A try?
Lewis
Use the below code it will work
@foreach (var item in selection) { var sectionImage = item.Value<IPublishedContent>("articleImage770390"); @if (sectionImage != null) { <img class="img-fluid" src="@sectionImage.Url" alt="@sectionImage.Name" /> } }
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.
Continue discussion
Article items not showing image
Hi there, I am a neewbie to Umbraco and have run into a problem.
When trying to setup my "articles main" template under "settings" I have this code that should render out both text and image.
However it does not render image, only the text from the other fields.
Could anyone help?
I have this code:
@{ var selection = Umbraco.Content(Guid.Parse("e7977742-a161-4fdb-a579-415d705b4d25")) .Children("articleItem") .Where(x => x.IsVisible()); }
Thanks in advance //Carsten
Hi Carsten,
Looks like the image url is being output as it’s IPublishedContent form, give
@item.Value("articleImage770390").Url
A try?
Lewis
Use the below code it will work
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.