iam tryning to get a script waren uses in the 5 episode ware he liste the news
i nees it to show a category images above the test.
The reason is look to use this is so the site kan make new categories when it is neede.
i have look in forum and havent found wath i think can help
the propety i like to use has this Alias KategoriBillede
my file looks like tihis.
<div class="newsList"> @{ @* -- Setup a counter variable for position -- *@ var position = 1; }
@* -- List children pages from the current page (aka Model) -- *@ @foreach (var page in @Model.Children.Where("umbracoNaviHide != true")) { <div class="left"> @* -- Display the name of the page & link -- *@ <h4><a href="@page.Url">@page.Name</a></h4> @{ var bodyText = @page.bodyText.ToString(); var bodyTextNoHtml = umbraco.library.StripHtml(bodyText); var bodyTextTrunc = umbraco.library.TruncateString(bodyTextNoHtml, 150, "..."); } <p> i like the images right heer </p> <p> @bodyTextTrunc </p> </div> @* -- After every 3rd item insert a <br/> -- *@ if (position % 3 == 0) { <br/> } @* -- Increase the position counter by 1 -- *@ position++; } </div>
Is your property KategoriBillede using the Media Picker datatype? If so you can do something like
@{ var bodyText = @page.bodyText.ToString(); var bodyTextNoHtml = umbraco.library.StripHtml(bodyText); var bodyTextTrunc = umbraco.library.TruncateString(bodyTextNoHtml, 150, "..."); var media = Library.MediaById(page.KategoriBillede); }
Ahh ok, my example was for a media picker. If it's an Upload datatype it's actually a little easier since it stores the path to the image instead of an ID:
@{ var bodyText =@page.bodyText.ToString(); var bodyTextNoHtml = umbraco.library.StripHtml(bodyText); var bodyTextTrunc = umbraco.library.TruncateString(bodyTextNoHtml,150,"..."); }
Showe images from a proppety
Hey.
iam tryning to get a script waren uses in the 5 episode ware he liste the news
i nees it to show a category images above the test.
The reason is look to use this is so the site kan make new categories when it is neede.
i have look in forum and havent found wath i think can help
the propety i like to use has this Alias KategoriBillede
my file looks like tihis.
<div class="newsList">
@{
@* -- Setup a counter variable for position -- *@
var position = 1;
}
@* -- List children pages from the current page (aka Model) -- *@
@foreach (var page in @Model.Children.Where("umbracoNaviHide != true"))
{
<div class="left">
@* -- Display the name of the page & link -- *@
<h4><a href="@page.Url">@page.Name</a></h4>
@{
var bodyText = @page.bodyText.ToString();
var bodyTextNoHtml = umbraco.library.StripHtml(bodyText);
var bodyTextTrunc = umbraco.library.TruncateString(bodyTextNoHtml, 150, "...");
}
<p>
i like the images right heer
</p>
<p>
@bodyTextTrunc
</p>
</div>
@* -- After every 3rd item insert a <br/> -- *@
if (position % 3 == 0)
{
<br/>
}
@* -- Increase the position counter by 1 -- *@
position++;
}
</div>
Hi,
Is your property KategoriBillede using the Media Picker datatype? If so you can do something like
@{
var bodyText = @page.bodyText.ToString();
var bodyTextNoHtml = umbraco.library.StripHtml(bodyText);
var bodyTextTrunc = umbraco.library.TruncateString(bodyTextNoHtml, 150, "...");
var media = Library.MediaById(page.KategoriBillede);
}
<p>
<img src="@media.umbracoFile" /> </p>
<p>
@bodyTextTrunc
</p>
Hope this helps,
Tom
the images is uploaede via uploadet propety via generic proppetyes type Upload.
i tryed you post and it do not work.
Ahh ok, my example was for a media picker. If it's an Upload datatype it's actually a little easier since it stores the path to the image instead of an ID:
-Tom
Thanks it works like a charmmm
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.