Archive for the ‘PHP’ Category
Using Disqus Plugin in Joomla
Disqus Comment System is a plugin that provides seamless integration between Joomla and the popular commenting system Disqus.
Installing the plugin is pretty straightforward but there are a few gotcha’s.
Troubleshooting
No comments/links are showing up.
- Check if the plugin is enabled. (not enabled by default)
- Open template/html/com_content/article/default.php and make sure that the following lines exist.
<?php echo $this->article->event->beforeDisplayContent; ?> ... <?php echo $this->article->event->afterDisplayContent; ?>
There is no Add New Comment section.
- Verify your plugin setting. The subdomain value should only be the name and not the entire URL. ie. mysite
.disqus.com
Adding an Exclude List
Currently, there’s no setting for enabling/disabling comments per article so I did a few hacks.
plugins/content/jw_disqus.xml – Add this line before the </param> tag
<param name="disqus_excludelist" type="text" default="" label="Exclude list" description="Do no show comments for articles having these ids (comma separated)" />
plugins/content/jw_disqus.php – Create a new function that checks if the id of the article is in the exclude list.
/**
* Check if the id of the current article is included in the excludelist parameter
*/
function isExcluded($article_id){
$plugin =& JPluginHelper::getPlugin('content', 'jw_disqus');
$pluginParams = new JParameter( $plugin->params );
$disqus_excludelist = $pluginParams->def('disqus_excludelist','');
if(in_array($article_id, explode(',', $disqus_excludelist))) {
return true;
}
return false;
}
Now simply return nothing in the callback functions if the article is in the exclude list.
/** just before content is output, returns output to be displayed */
function plgJWDisqus_onBeforeDisplayContent( &$row, &$params, $limitstart ){
if(isExcluded($row->id)) {
return;
}
...
/** just after content is output, returns output to be displayed */
function plgJWDisqus_onAfterDisplayContent( &$row, &$params, $limitstart ){
if(isExcluded($row->id)) {
return;
}
...
You should be all set after this.
Introduction to SOAP
What is SOAP?
By merely looking at what SOAP stands for, we will already have an idea of what it is. So lets try to break it down:
- Simple – easy, non-complex
- Object – Let’s use the programming cliche: “Everything is an object”
- Access – the right to obtain or make use of
- Protocol – A set of rules that lets computers agree how to communicate over the net
So what does this tell us? Soap is an easy way of getting or using objects across a network or commonly, the Internet.
How to Use libcurl
PHP supports libcurl, a library created by Daniel Stenberg, that allows you to connect and communicate to many different types of servers with many different types of protocols. libcurl currently supports the http, https, ftp, gopher, telnet, dict, file, and ldap protocols. libcurl also supports HTTPS certificates, HTTP POST, HTTP PUT, FTP uploading (this can also be done with PHP’s ftp extension), HTTP form based upload, proxies, cookies, and user+password authentication. http://www.php.net