The Techjoomla Blog

Stay updated with all the latest happenings at Techjoomla. From news about the developments in your favourite extensions to Tips & Tricks about the Joomla CMS, Framework & Development.

Posted by on in Joomla Development
Jomsocial gets DISQUS'ed

In a recent project we had to implement a uniform commenting system across the site, Jomsocial included. Now obviously, Jomsocial comes with it’s own commenting system, and to make matters worse, there were already thousands of comments already present that needed to be migrated to the new platform.

We suggested the use of Disqus, which is a cloud based commenting system that easily integrates with a website. Thankfully, DISQUS provides a way to import comments from non-compatible systems by importing from a WXR file. 

So the first challenge was to generate a WXR file. Each thread in DISQUS needs to have a unique disqus_thread_id, which is usually unique per page. In case of comments for Joomla Articles, this is usually the article ID. However, since we were using DISQUS for videos, photos and even blogs, we could have easily run into an issue where a video, a photo and a blog have the same id. To overcome this, we prefixed the id with a identifier, so the ID became video.345 or photo.345 or blog.345 Neat eh ;)

Once this architectural challenge was out of the way, it was as simple as writing a script to output a WXR file, and then importing the WXR file into DISQUS. Below is how we wrote a neat little script to generate the file -

WXR Export Script

To create a WXR file for jomsocial videos, we created a disqusimport.php controller and loaded it with the code to create the WXR. Placed this controller in com_community and we were good to fire the exporter. You could of course also create a neat little CLI script to do that.

...
Continue reading
Hits: 2803 Comments
Rate this blog entry:
Posted by on in Joomla Development
3 ways to do RESTful APIs in Joomla

There has been a growing trend to start offering RESTful services for any web product, and Joomla is no exception. With Joomla however there is no "preferred" way of writing RESTful services so everyone (that includes us) is trying to build their own component and plugin to enable RESTful services in Joomla. We did the very first REST implementation with Joomla 1.5 which was made as a JSON based alternative to the then existing XML-RPC system that was already present. This blog attempts to list out the various approaches available and the benefits of using each.

 

Using the JSON document type (format=json)

This is perhaps the oldest and most common way to do JSON over REST. This method is supported inherently by Joomla and developers just need to provide a view.json.php into each of their views to expose the data from the model via JSON. Framework on Framework (FOF) goes a step further and you don't need to create this file if the default output from the model is sufficient to you.

PROs

  1. No extra extensions needed
  2. Present directly inside a component so very easy to use model methods

CONs

...
Continue reading
Tagged in: api json rest
Hits: 3569 Comments
Rate this blog entry:

Posted by on in Joomla Development
Make the Joomla Modal Popup Responsive

Today, its critical that your site is mobile friendly. More and more people are accessing the web via their mobile devices. The Joomla native Joomla modal popup is not responsive by default. Here’s how you can make it responsive.

 The Code to make it happen !

1. Import following library at the start of the page. Please make sure you embed this code in php start and end  tags.

JHTML::_('behavior.modal', 'a.modal');

 This simply ensures that the modal.js script and the modal.css style sheets are loaded, plus the mootools javascript framework which the script requires, and initialises the modal window. Note that from Joomla 3.3x onwards using JQuery might be a better idea. 

 

2. Add following function in javascript

$(document).ready(function() {
	var width = $(window).width();
	var height = $(window).height();

	//ID of container
	$('a#modal_info').attr('rel','{handler: "iframe", size: {x: '+(width-(width*0.10))+', y: '+(height-(height*0.10))+'}}');
});

If we give modal size directly in html then it will not make modal popup responsive. So for that we have used javascript to give size to the modal.

To give size to the popup window, first we dynamically calculated window size and gave that size to the modal window so this can make our modal popup responsive. 

3. Now you need to invoke the modal in your html with the code below.  Give same id to the javascript and container.

<a

	id="modal_info"
	href="#"
	class="modal"
	>
</a>

 To create a popup you simply give the css class 'modal' to the link <a> tag which links to the content you want to display just like you would normally do ! 

Hits: 9586 Comments
Rate this blog entry:

Posted by on in Joomla Development

This Blog is specially targeted for developers and people who use Jomsocial

b2ap3_thumbnail_download_20140710-115328_1.jpg

Jomsocial!
  Which turns Joomla CMS into a full-fledged social
networking website. While using your own component with jomsocial you need to make sure that your component is tightly integrated with it and most important is you are notified with the activities happening.

 

In Jomsocial, notifications are shown on the notification bar and if you use the following code provided by Jomsocial you’ll get email notifications as well. Use  Jomsocial’s Notifications API, to send  notifications to users we write following code


Code:

require_once JPATH_ROOT .'/components/com_community/libraries/core.php';

$user = CFactory::getUser();
$cmd = 'system_messaging'; // first param, type of activity
$actor = $user->id; //second param - get the id of $actor
$target = '965'; // third param. Who receive notification? In our dev environment, its admin user with id 965. At your environment, you will most likely want to get the ID from your object or from array of users.
$subject = 'Notification Subject'; // Subject of both, email and popup notifications
$body = 'This is the notification body message'; //Body message in emails.
$template = ''; // If you need to use specific jomsocial template file, you can define it here.
$params = new CParameter(''); // We want to create an additional params object, and assign data to it, without having to formally define a class
CNotificationLibrary::add( $cmd , $actor , $target , $subject , $body , $template , $params );

 

...
Continue reading
Hits: 3658 Comments
Rate this blog entry:
0

Posted by on in Joomla Development

Zoo is one of the best CCK extensions available for Joomla . It's a flexible and powerful application builder to manage your content. Especially if you are having huge data sets, Zoo can be a awesome way to manage & present it all. However with large data sets, manually adding all the data might not be practical. This is where the inbuilt Zoo import tool can help you in a big way.

In this blog we will show you how it works & also how we solve a problem that it presents if you have data with lots & lots of fields. When this happens during the import you need to manually Map the fields in your Import CSV/JSON file to the fields in Zoo so that the import can proceed. However when you have lots of fields it a huge chore to map them all manually. However with our solution you can do it in a single Click ! 

Lets how the existing Zoo Data Import Works ( Just in case you didn't know ! ) 

Data import done in following 3 stages.  Zoo allows you to import data in JSON or CSV format. 

1. Upload CSV/JSON file.

b2ap3_thumbnail_oie_2582216XM8f3drV.png

Continue reading
Tagged in: cck import zoo
Hits: 12472 Comments
Rate this blog entry: