The Joomla! Forum ™



Forum rules


Please use the mailing list here: http://groups.google.com/group/joomla-dev-general rather than this forum.



Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: Sun Aug 12, 2012 10:44 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Nov 07, 2009 10:23 am
Posts: 4
Hy!

Upgrade my joomla 1.5 facebook like button plugin to joomla 2.5.
I want get article link. I want show like button in blog view in short article.

Joomla 1.5 blog view $row->slug, $row->catslug and $row->sectionid returned article correct value.
Code:
JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));


Joomla 2.5 blog view and frontpage returned null value.
But View=article value is correct, not null.

Can you help me how to fix this problem?


Top
 Profile  
 
PostPosted: Wed Aug 15, 2012 2:11 pm 
Joomla! Fledgling
Joomla! Fledgling

Joined: Sat Nov 07, 2009 10:23 am
Posts: 4
Ok here is my code:

Code:
<?php
defined( '_JEXEC' ) or die();

jimport( 'joomla.event.plugin' );
 jimport( 'joomla.environment.uri' );
class plgContentFB_like extends JPlugin
{

   function plgContentFB_like( &$subject, $params )
   {
      parent::__construct( $subject, $params );
    }

   function onContentPrepare( $context, &$row, &$params, $limitstart=0 )
   {
      $plugin   =& JPluginHelper::getPlugin('content', 'FB_like');
      $pluginParams = $this->params;   

            $url =
JRoute::_(ContentHelperRoute::getArticleRoute($row->slug, $row->catslug, $row->sectionid));
            $uri = JURI::getInstance();
            $base  = $uri->toString( array('scheme', 'host', 'port'));
            $url = $base . $url;
            $url = JRoute::_($url, true, 0);

            $facebook='<p class="FacebookLikeBox" style="text-align:right;"><fb:like href="' .$url. '" send="'. $pluginParams->get( 'send' , 'true' ) .'" width="'. $pluginParams->get( 'width' , 300 ) .'"data-layout="button_count" show_faces="'. $pluginParams->get( 'show_faces' , 'false') .'"></fb:like></p>';
            $row->text = $facebook.$row->text;

   }
}
?>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 



Who is online

Users browsing this forum: OneJoomla and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group