However if you like to get the 'Like' button closer to the action then you may interweave the code into the template or that part of the component which will be called dynamically.When dealing with numerous webpages the task tends to become tricky and tedious. To further complicate things, lack of properly documented functions could keep you guessing your time away.In this post we will look at how we can effectively add Facebook apps to our Joomla website to accommodate the numerous dynamic pages that Joomla generates.
Adding the Like button - iframe
To add a 'Like' button simply visit the Like Button Plugin fill out the form push the Get Code button and copy the iframe to the appropriate area in your joomla template.
If you do have numerous pages whose url is required to be parsed, this piece of static code could use a hack.To elaborate the this point, consider a Game Site with the largest number of Online Games 36,000 at the time of this writing.Imagine filling out the Like form and pasting the code on 36,000 individual games.
Coding becomes really simple if we hack the
- href=http://myurl.com
- $myabsoluteurl
A simple method to get the current url is
- $url = JURI::current();
$currenturl = $url;
this is not effective when parsing through an iframe. An appropriate hack around this would be
- $myabsoluteurl=JURI::getInstance()->toString();
echo $myabsoluteurl.'"';
Your complete functional iframe thus looks like this
CODE: SELECT ALL
<iframe src="https://www.facebook.com/plugins/like.php?href=<?php $myabsoluteurl=JURI::getInstance()->toString(); echo $myabsoluteurl.'"'; ?>& scrolling="no" frameborder="0"
style="border:none; width:450px; height:80px"></iframe>
There we have a simple iframe that will post your Likes,dynamically.
0 коммент.:
Отправить комментарий