Copied to clipboard

Flag this post as spam?

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


  • Sharmarke Hujale 103 posts 346 karma points
    May 23, 2016 @ 12:07
    Sharmarke Hujale
    0

    How to make the Facebook page plugins URL dynamic

    Hi guys,

    I want to make the Facebook page plugins URL dynamic instead of being static,

    But how I can achieve that I'm not really sure, this is the code:

    <div class="fb-page" data-href="https://www.facebook.com/creativationdk/?fref=ts" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="true" data-show-facepile="true"></div>
    

    I made a property in my home documentype called "facebookPageURL"

    enter image description here

    I want to be able to paste a Facebook page Url in this textstring instead having to do that in VS,

    Can anyone help with this problem?

    Thanks in advance

    Kind regards,

    Sharmarke

  • Ben Abbott 19 posts 124 karma points
    May 23, 2016 @ 12:48
    Ben Abbott
    0

    You could try...

    <div class="fb-page" data-href="@(CurrentPage.GetPropertyValue<String>("facebookPageURL"))" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="true" data-show-facepile="true"></div>
    

    Assuming your 'facebookPageURL' property is current page level and not a property of a parent node

    Ben

  • Sharmarke Hujale 103 posts 346 karma points
    May 23, 2016 @ 13:04
    Sharmarke Hujale
    0

    I've tried it and it doens't work,

    The code is placed in my post.cshtml:

    @inherits Umbraco.Web.Mvc.UmbracoTemplatePage
    @{
    Layout = "Master.cshtml";
    }
    <div class="container">
    <div class="row">
        <!--Left side---->
        <div class="col-lg-8 col-md-8 col-sm-12">
            <!--Breadcrumb-->
            @Umbraco.RenderMacro("Breadcrumb")
            <div class="post-container">
                <div class="post-information">
                    <h1 class="post-name">@CurrentPage.Name</h1>
                    <h4 class="post-date">@CurrentPage.CreateDate.ToString("dd. MMMM yyyy, H:mm") | Skrevet af: <span class="author">@CurrentPage.WriterName</span></h4>
                </div>
                <div class="post-image">
                    <img src="@CurrentPage.GetPropertyValue("image")" />
                </div>
                @if (CurrentPage.HasValue("imageCaption"))
                {
                    <h5 class="post-image-caption">
                        @CurrentPage.GetPropertyValue("imageCaption")
                    </h5>
                }
                @if (@CurrentPage.HasValue("teaser"))
                {
                    <h3 class="post-teaser">
                        @CurrentPage.GetPropertyValue("teaser")
                    </h3>
                }
                <div class="post-text">
                    @Umbraco.Field("bodyText", removeParagraphTags: true)
                </div>
                <div class="social-sharing">
                    <h6>Del - vælg din platform</h6>
                    <div class="social-icons">
                        <ul class="share-buttons">
                            <li><a href="https://www.facebook.com/sharer/sharer.php?u=http%3A%2F%2F + @Model.Content.UrlWithDomain()" target="_blank" title="Share on Facebook" onclick="window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(document.URL) + '&t=' + encodeURIComponent(document.URL)); return false;"><i class="fa fa-facebook-square fa-2x"></i></a></li>
                            <li><a href="https://twitter.com/intent/tweet?source=http%3A%2F%2F + @Model.Content.UrlWithDomain()" target="_blank" title="Tweet" onclick="window.open('https://twitter.com/intent/tweet?text=' + encodeURIComponent(document.title) + ':%20' + encodeURIComponent(document.URL)); return false;"><i class="fa fa-twitter-square fa-2x"></i></a></li>
                            <li><a href="https://plus.google.com/share?url=http%3A%2F%2F + @Model.Content.UrlWithDomain()" target="_blank" title="Share on Google+" onclick="window.open('https://plus.google.com/share?url=' + encodeURIComponent(document.URL)); return false;"><i class="fa fa-google-plus-square fa-2x"></i></a></li>
                            <li><a href="http://www.linkedin.com/shareArticle?mini=true&url=http%3A%2F%2F + @Model.Content.UrlWithDomain()" target="_blank" title="Share on LinkedIn" onclick="window.open('http://www.linkedin.com/shareArticle?mini=true&url=' + encodeURIComponent(document.URL) + '&title=' +  encodeURIComponent(document.title)); return false;"><i class="fa fa-linkedin-square fa-2x"></i></a></li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
        <!--Right side-->
        <div class="col-lg-4 col-md-4 col-sm-12">
            <aside>
                <!--Join us--->
                <a class="btn btn-second page-scroll" href="#kontakt">Tilslut os</a>
                <hr />
                <!--Facebook--->
                <div class="fb-page" data-href="@(CurrentPage.GetPropertyValue<String>("facebookPageURL"))" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="true" data-show-facepile="true"></div>
            </aside>
        </div>
    </div>
    

    It's a template I use for the specific page for my project and news page

  • Ben Abbott 19 posts 124 karma points
    May 23, 2016 @ 14:13
    Ben Abbott
    0

    What node structure do you have on the site?

    Is the property on a Parent node?

  • Sharmarke Hujale 103 posts 346 karma points
    May 23, 2016 @ 14:17
    Sharmarke Hujale
    0

    I made the property on the home node

  • Ben Abbott 19 posts 124 karma points
    May 23, 2016 @ 14:27
    Ben Abbott
    0

    could you screenshot your node structure and post on here?

    might be easier to see your setup rather than guess where the property might be :)

  • Sharmarke Hujale 103 posts 346 karma points
    May 23, 2016 @ 14:37
    Sharmarke Hujale
    0

    Yes of course:

    enter image description here

    Content tree:

    Level 1: Home Level 2: About us Level 2: News Level 3: Post Level 2: Projects Level 3: Post

  • Ben Abbott 19 posts 124 karma points
    May 23, 2016 @ 14:41
    Ben Abbott
    100

    Great, thank you

    try this...

    <div class="fb-page" data-href="@(CurrentPage.AncestorOrSelf(1).GetPropertyValue<String>("facebookPageURL"))" data-tabs="timeline" data-small-header="true" data-adapt-container-width="true" data-hide-cover="true" data-show-facepile="true"></div>
    
  • Sharmarke Hujale 103 posts 346 karma points
    May 25, 2016 @ 12:54
    Sharmarke Hujale
    0

    Hi Ben,

    Sorry for the late replay, but your solution worked! Thank you!

  • 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.

Please Sign in or register to post replies