Uploaded image for project: 'Social Networking'
  1. Social Networking
  2. SOCIAL-56

Update the script to create a custom button to share a page on Facebook

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • 2.13.0
    • 1.9.0
    • None
    • 1 - Middle term
    • 2 - Normal

      For example I use this code on a project :

      <xsl:variable name="pageId" select="ametys:pageId()" />
      			
      			<div id="fb-root"></div>
      			<script>(function(d, s, id) {
      			  var js, fjs = d.getElementsByTagName(s)[0];
      			  if (d.getElementById(id)) return;
      			  js = d.createElement(s); js.id = id;
      			  js.src = "//connect.facebook.net/fr_FR/sdk.js#xfbml=1&amp;version=v2.10";
      			  fjs.parentNode.insertBefore(js, fjs);
      			}(document, 'script', 'facebook-jssdk'));</script>
      			
      			            	<xsl:if test="$pageId">
      				            	<div data-href="https://developers.facebook.com/docs/plugins/" data-layout="button_count" data-size="small" data-mobile-iframe="true">
      			                    	<a class="fb-share fb-xfbml-parse-ignore" target="_blank" i18n:attr="title" title="skin.{$skin}:SKIN_SHARE_FACEBOOK">
      			                    		<xsl:attribute name="href">
      			                    			<xsl:choose>
      			                    				<xsl:when test="$rendering-context = 'front'>
      			                    					<xsl:text>https://www.facebook.com/sharer/sharer.php?u=</xsl:text>
      					                    			<xsl:value-of select="resolver:resolve('page', $pageId, false, true)" />
      					                    			<xsl:text>&amp;src=sdkpreparse</xsl:text>
      			                    				</xsl:when>
      			                    				<xsl:otherwise>#</xsl:otherwise>
      			                    			</xsl:choose>
      			                    			
      			                    		</xsl:attribute>
      			                    		 <i class="fa fa-facebook"></i>
      			                    	</a>
      				                </div>
      			                </xsl:if>
       

            Unassigned Unassigned
            llopez Laure Lopez
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: