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
Our experiments with quality

Last year was quite fruitful for us in terms of setting up several systems and processes to make sure our releases are more sharp and our code is much better. After several great suggestions and some oops! moments, we decided to pull up our socks and kicked off the slow but disciplined process of code review and infusing good quality into our products and projects. These are experiments and we are of course measuring what works best and will continue to tweak our quality process to further strengthen it

We've taken some great steps and implemented several automated checks which will reject bad code. We also thought of sharing them with everyone so everyone can benefit. Here's a list of things that are already implemented or are in the process of being implemented

Continue reading
Hits: 245 Comments
Rate this blog entry:

Posted by on in Joomla Development
Location tracking made easy with Google Maps APIs

Hey Guys,

We come across situations where locating a place becomes imperative; whether it's a venue for an event, site office or anything. Just to make sure that this  problem is overcomed, you need to add google maps support in your extensions, website and applications wherever necessary. This can be achieved with the help of certain information like the IP addess, Latitudes and Longitudes.

In this blog we are going to see how to use  Google maps APIs to show map (based on location)

 

Continue reading
Hits: 2226 Comments
Rate this blog entry:

Posted by on in Joomla Development
Adding a parameter to Joomla component's menu item is as easy as pie!

Hey Guys,
In this blog we are going to see how to add a parameter to a Joomla component's menu item. This parameter can be used while referring view level in Joomla 2.5.x or 3.x.
Following are the steps to achieve this.

Step 1:

You have to specify parameter / option in your_layout.xml file in your component.
Lets say, you have to add “pageLimit” parameter to default layout of a view named 'products'. For menu item, you have to create add default.xml for this layout and have to add parameter entry as given below.

a. Add a xml file at location

site/components/com_yourcomponent/views/products/tmpl/default.xml

b. Add following code in above xml file

<?xml version="1.0" encoding="utf-8"?>
<metadata>
	<layout title="All Products View" option="View" >
		 <message><![CDATA[Quick2Cart All Products View]]></message>
	</layout>

	<!-- Add fields to the parameters object for the layout. -->
	<fields name="params">
		<fieldset name="advanced" label="COM_MENUS_LAYOUT_FEATURED_OPTIONS">
			<field name="pageLimit" type="text" default="20" label="Product Limit" description="Limit to display product on All products view" />
		</fieldset>
	</fields>

	<state>
		<name>All Products</name>
		<description>All Products View </description>
	</state>
</metadata>

After adding the file, this parameter will be displayed while creating menu item for products view. Refer the following screen-shot for this.

...
Continue reading
Hits: 2477 Comments
Rate this blog entry:

Posted by on in Joomla Development
Adding validation in Joomla for post_max_size and memory_limit

Hey Guys,

In this blog we will see how to handle validation for ‘post_max_size’ and 'memory_limit' in Joomla for file uploads. Sometimes when dealing with file uploads in Joomla or in any PHP frameworks, form post size can exceed the max allowed ‘post_max_size’ (set in php.ini in your server configuration). If the size of post data exceeds post_max_size, the $_POST and $_FILES superglobals are emptied. Now, if post size validation is not added, it becomes very difficult for the end user as well as developer to track what exactly the issue is.

Using the code given below for 'post_max_size' and 'memory_limit' validation we can display the warning if post data is greater than ‘post_max_size’ or if the 'memory_limit' is exceeded in the same way as ‘com_media’ in Joomla does.

Let's Code:

// Total length of post back data in bytes.
$contentLength = (int) $_SERVER['CONTENT_LENGTH'];

// Maximum allowed size of post back data in MB.
$postMaxSize = (int) ini_get('post_max_size');

// Maximum allowed size of script execution in MB.
$memoryLimit = (int) ini_get('memory_limit');

// Check for the total size of post back data.
if (($postMaxSize > 0 && $contentLength > $postMaxSize * 1024 * 1024) || ($memoryLimit != -1 && $contentLength > $memoryLimit * 1024 * 1024))
{
	// Show warning and return
	JError::raiseWarning(100, “Total size of upload exceeds the limit.”);
	return false;
}

  

b2ap3_thumbnail_oie_815511jDoPNs0N_20141009-060335_1.pngHope this helps! :)

...
Continue reading
Hits: 2403 Comments
Rate this blog entry:

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: 3597 Comments
Rate this blog entry: