Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mikkel 143 posts 365 karma points
    Feb 16, 2019 @ 12:02
    mikkel
    0

    What is the different. I cant see it

    Hi. Why does the first code not work and the second code works fine, i dont get it. Can some one tell me what is the different between the 2 codes. They should do the same.

    Here is my code that dont work

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Services>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "Master.cshtml";
        var serviceYdelse = Model.Content.Children<Ydelse>();
    
    }
    <div class="container text-center">
        <div class="row">
            <div class="service-heading-block">
                <h2 class="text-center text-primary title">Our amazing Service features</h2>
                <p class="text-center sub-title">Lorem ipsum dolor sit amet,<span class="text-primary">consectetur adipisicing</span> elit.<br /> Dolor alias provident excepturi eligendi, nam numquam iusto eum illum, ea quisquam.</p>
            </div>
        </div>
        <div class="row">
            @foreach (var item in serviceYdelse)
            {
                <div class="col-lg-4 col-md-6 col-sm-6">
                    <div class="text-center feature-block">
                        <span class="fb-icon color-info">
                            <i class="fa @Model.Content.Site.GetPropertyValue("fonbtAwesomeIkonYdelse");" aria-hidden="true"></i>
                        </span>
                        <h4 class="color-info">@item.Name</h4>
                        <p class="">@Umbraco.Field("beskrivelseYdelse", recursive: true)</p>
                    </div>
                </div>
            }
        </div>
    </div>
    

    The code that works

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage<ContentModels.Services>
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        Layout = "Master.cshtml";
        var blogItems = Model.Content.Children<Ydelse>();
    
    }
    <!-- Services -->
    <section id="services">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 text-center">
                    <h2 class="section-heading text-uppercase">Services</h2>
                    <h3 class="section-subheading text-muted">Lorem ipsum dolor sit amet consectetur.</h3>
                </div>
            </div>
            <div class="row text-center">
                @foreach (var blogItem in blogItems)
                {
                    <div class="col-md-4">
                        <span class="fa-stack fa-4x">
                            <i class="fas fa-circle fa-stack-2x text-primary"></i>
                            <i class="fas fa-shopping-cart fa-stack-1x fa-inverse"></i>
                            <h2></h2>
                        </span>
                        <h4 class="service-heading">@blogItem.Name</h4>
                        <!--Indbygget Umbraco ting til at forkorte til x antal ord (ikke tegn)-->
                        <p>@Umbraco.TruncateByWords(blogItem.BeskrivelseYdelse, 25)</p>
    
                        <a href="@blogItem.Url">Læs mere</a>
                    </div>
                }
            </div>
        </div>
    </section>
    
  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 16, 2019 @ 14:47
    Alex Skrypnyk
    0

    Hi Mikkel

    @Umbraco.Field("beskrivelseYdelse", recursive: true) - returns value for Current page, no sense to use this method in the loop.

    The same here -

    @Model.Content.Site.GetPropertyValue("fonbtAwesomeIkonYdelse");

    Model.Content - current page, no sense to use it in loop, it always returns the same value.

    Thanks, Alex

  • mikkel 143 posts 365 karma points
    Feb 16, 2019 @ 15:24
    mikkel
    0

    Thanks that make sence :D i have a textbox where i want to but the fontawesome code in så that i can change it if want, but it dont work. here is a picture of want i try to do. can you tell me what i do wrong enter image description here

    And here is a picture where i wnat the code to be enter image description here

    Here is a picture from front end where the icon have to be enter image description here

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 16, 2019 @ 22:26
    Alex Skrypnyk
    0

    Mikkel

    Put a class name to Forn Awesome Umbraco field, without html.

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Feb 16, 2019 @ 22:27
    Alex Skrypnyk
    0

    Like this:

    fa-shopping-cart
    
  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 10:03
    mikkel
    0

    Hi Alex It is stil the same. The icons dont show up. I dont get it. i have try with @Html.Raw but that dont work.

    Her is a picture where you can see what i didt enter image description here

    And here is my code

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @using ContentModels = Umbraco.Web.PublishedContentModels;
    @{
        var selection = Model.Content.Children<Ydelse>();
    }
    <section id="services">
        <div class="container">
            <div class="row">
                <div class="col-lg-12 text-center">
                    <h2 class="section-heading text-uppercase">@Umbraco.Field("titelServices")</h2>
                    <h3 class="section-subheading text-muted">@Umbraco.Field("teaserServices")</h3>
                </div>
            </div>
            <div class="row text-center">
                @foreach (var ydelse in selection)
                {
                    <div class="col-md-4">
                        <span class="fa-stack fa-4x">
                            <i class="fas fa-circle fa-stack-2x text-primary"></i>
                            <i class="@Umbraco.Field("fontawesomeIkon")"></i>
                        </span>
                        <h4 class="service-heading">@ydelse.Name</h4>
                        <p class="text-muted">@Umbraco.TruncateByWords(ydelse.TekstYdelse, 25)</p>
                    </div>
                }
            </div>
        </div>
    </section>
    
  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 10:53
    Tarik | WPPlumber
    0

    mikkel, try to inspect the element and his parent and post the output html here.

  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 11:10
    mikkel
    0

    here is the output html when i inspect <i class></i>

  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 11:55
    Tarik | WPPlumber
    0

    mikkel, I tested a similar case using the following code I noticed it gives as you mentioned <i class></i> after publishing the icon with empty value and republishing with right value it works.

    <i class="@Umbraco.Field("icon")" data-fa-transform="grow-3">
    
  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 11:58
    mikkel
    0

    Hi Tarik what didt you insert in the textbox ? Ibn the code i inser this

    <i class="fa @Umbraco.Field("fontAwesome")" aria-hidden="true"></i>
    

    and in the textbox i insert this

    fab fa-wordpress-simple
    

    And it dont want to work here :D You an se the output here when i inspect the element enter image description here

  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 12:52
    Tarik | WPPlumber
    0

    mikkel, peace be upon those who follow guidence.

    The solution I suggest is to publish the icon content with empty value after that republish it with right value.

    I did other test and it works. enter image description here enter image description here enter image description here

  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 13:13
    mikkel
    0

    Hi Tarik Now I have tried to publish the content with an empty textbox and then publish it with content in textbox. It still does not work. I've also tried a text string and that's the same result. i have alså delete cookies and still the same. I don't understand how you make it work and I don't. I've done the same as you Hmm. Can it have something to do that i use modelbuilder??

  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 13:39
    mikkel
    0

    I have also try to do it with an image and that is the same so maybe the problem is something else. I just dont now what ??

  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 14:24
    Tarik | WPPlumber
    100

    mikkel, have you tried the following code?

    <div class="row text-center">
                @foreach (var ydelse in selection)
                {
                    <div class="col-md-4">
                        <span class="fa-stack fa-4x">
                            <i class="fas fa-circle fa-stack-2x text-primary"></i>
                            <i class="@Umbraco.Field(ydelse, "fontawesomeIkon")"></i>
                        </span>
                        <h4 class="service-heading">@ydelse.Name</h4>
                        <p class="text-muted">@Umbraco.TruncateByWords(ydelse.TekstYdelse, 25)</p>
                    </div>
                }
            </div>    
    
  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 14:56
    mikkel
    0

    Hi Tarik that wokt what does it do?

    <i class="@Umbraco.Field(ydelse, "fontawesomeIkon")"></i>
    

    Thanks alot for your help

  • mikkel 143 posts 365 karma points
    Feb 17, 2019 @ 15:31
    mikkel
    0

    I made it as a partial view and when i insert it to the frontpage nothing is showing but when i pas it to the page services it works. That i dont get???

  • Tarik | WPPlumber 179 posts 801 karma points c-trib
    Feb 17, 2019 @ 16:44
    Tarik | WPPlumber
    0

    mikkel, peace be upon those who follow guidence.

    I redirect you to this comment from admin to get more info and also read the last comment.

  • mikkel 143 posts 365 karma points
    Feb 20, 2019 @ 13:07
    mikkel
    0

    thanks :D

Please Sign in or register to post replies

Write your reply to:

Draft