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 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"
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
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
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
What node structure do you have on the site?
Is the property on a Parent node?
I made the property on the home node
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 :)
Yes of course:
Content tree:
Level 1: Home Level 2: About us Level 2: News Level 3: Post Level 2: Projects Level 3: Post
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>
Hi Ben,
Sorry for the late replay, but your solution worked! Thank you!
is working on a reply...
Write your reply to:
Upload image
Image will be uploaded when post is submitted
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:
I made a property in my home documentype called "facebookPageURL"
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
You could try...
Assuming your 'facebookPageURL' property is current page level and not a property of a parent node
Ben
I've tried it and it doens't work,
The code is placed in my post.cshtml:
It's a template I use for the specific page for my project and news page
What node structure do you have on the site?
Is the property on a Parent node?
I made the property on the home node
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 :)
Yes of course:
Content tree:
Level 1: Home Level 2: About us Level 2: News Level 3: Post Level 2: Projects Level 3: Post
Great, thank you
try this...
Hi Ben,
Sorry for the late replay, but your solution worked! Thank you!
is working on a reply...