Wednesday, August 28, 2013

joomla display a module inside a component

Sometimes you need to include rendered HTML code of a joomla module inside a joomla component usaully in view file located under tmpl folder, this 3 lines can help (tested on jommla 3.1)



$module = JModuleHelper::getModule('mod_paidsystem_random');
$moduleHtml = JModuleHelper::renderModule($module);
echo $moduleHtml;

this will display the mod_paidsystem_random module inline in the component

Friday, August 16, 2013

php twitter followers count and facebook likes count without login



Numbers of likes on facebook page
<?php
         $name = 'PAGE';
         $src = json_decode(file_get_contents('http://graph.facebook.com//'.$name));
    $likes= $src->likes;
echo $likes;
?>

Twitter  code is different i've found this hack on the web (y)
with the code below no need to connect with valid credentials:

$url='http://query.yahooapis.com/v1/public/yql?q=SELECT%20*%20from%20html%20where%20url=%22http://twitter.com/XXXXXXX%22%20AND%20xpath=%22//a[@class=\'js-nav\']/strong%22&format=json';
$src = file_get_contents($url);
/*echo($src);*/
$decoded = json_decode($src);
echo ($decoded->query->results->strong[2]);

where XXXXXXX is the account
it works tested on a joomla integration.