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.

Beware of these mistakes while coding in PHP

Beware-of-these-mistakes-while-coding-in-PHP

As a PHP developer, I am sure we all write some lines of code every day where we use library functions, creates new functions, Writes for, for each loop and also we use some statements and many more things that we need to do for solving a problem by PHP. Do we use the right library functions in the right place? Do we write correct loops? In my opinion, we do common mistakes while doing these things, so what are those mistakes and how to get rid of it, what will be the solutions for it? These are the common questions that arise in every PHP developer’s mind while coding.  

I will be covering these common mistakes and their solutions in a series of blogs, Let’s start with the first blog of this series.

Misunderstandings of isset()

As the name suggests, isset() function returns true if the item exists and returns false if the item does not exist but it returns false for null values too. This turns into a problematic behavior in some cases and becomes a common source of problems.

Continue reading
0
  1830 Hits
  0 Comments
1830 Hits
0 Comments

PDF Embed v2.1.8 is released

pdfembed2.1.8

We are happy to announce availability of PDF Embed v2.1.8. PDF Embed is one of our most popular and free extension with ~1.4 lacs of downloads and counting. This release addresses a bug seen on PHP 7.x versions, it also has improvements for installation script. At the time of release, this version is compatible with the latest version of Joomla (3.8.13). Read on for the upgrade instructions and complete changelog.

Get PDF Embed Now!

Continue reading
0
  1774 Hits
  0 Comments
1774 Hits
0 Comments

JMailAlerts v2.6.0 is released

JMailAlerts-2.6.0-is-released
Hello Joomlers!
 
We are happy to announce the availability of new JMailAlerts v2.6.0. JMailAlerts is one of our most popular and FREE extension with 20K downloads and counting.

This release mainly addresses logging in JMailAlerts. Now, the logs are written into where Joomla logs path is configured. Also, email ids in the logs can be masked, giving you more control over sensitive information not being logged into log file. This is not all of it, we have also added an option to specify max log file size for log file. After reaching this size, log file will be rotated. 

Download JMailAlerts

Continue reading
0
  961 Hits
  0 Comments
961 Hits
0 Comments

Some JavaScript code snippets in Joomla worth keeping in your stash

Some-Joomla-Javascript-Code-Snippets-Worth-Keeping-in-your-Stash

In this blog, I will be explaining some JavaScript snippets which are very useful while developing extensions in Joomla. Let’s start one by one.

Continue reading
1
  3815 Hits
  0 Comments
3815 Hits
0 Comments

Using custom field of jform create textcounter

Using-custom-field-of-jform-create-textcounter-1

Joomla already has powerful form management libraries - jform, supported by jfield. There is plenty of built-in field types (text, textarea, integer, file, calendar and several more). However, once in a while you come across a special field that is not present. Or maybe extending the existing field types to add more features.

These are perfect candidates for creating your own JFields. The JField class is very easy to understand, and using the same you can create any kind of simple or complex fields. Bear in mind that while the JField class will render your field, it's up to your model to save the data.

In a recent project, I had to create a text field with a character limit and a  character counter. My earlier thought was to include a piece of javascript, but I soon realized that this was a good opportunity to create a reusable field which supports the above. So today I will be explaining how to create your own JFields through an example of the character counter field.

Continue reading
1
  2121 Hits
  0 Comments
2121 Hits
0 Comments

How to create widgets for your Shika user dashboard?

How to create widgets for your Shika user dashboard?

In the process of making Shika's user dashboard more user friendly we have made some major changes by adding new widgets to the dashboard. With this you can now build your own widgets and give your users the freedom to choose which widgets he/ she wants to be shown on the dashboard.

We have created a new table #__tjlms_dashboard which contains all the widgets per users. If the users has not set any widgets to be shown or is using the default dashboard, basic dashboard plugins will be shown.

For Shika 1.0, user will not be able to select the widget and hence only the basic widget will be shown. This feature will be implemented in version 1.1.

Continue reading
1
  2174 Hits
  0 Comments
2174 Hits
0 Comments

Ways to delete documents in Solr!

Ways to delete documents in Solr!

Solr is a open source standalone enterprise search server. It comes with great features like full-text search, auto suggest, faceted search, database integration and many more. To know more you can visit http://lucene.apache.org/solr/.

Solr extension is a light-weight, very fast and feature-rich library which allows to communicate with the Apache Solr Server in PHP. To know more solr-php methods visit http://php.net/manual/en/book.solr.php

We have been using Apache Solr in one of our service project. The project is a website which is basically collection of artefacts, posters and other memorabilia from across the globe, importantly India. It currently has about 75,000 objects in our database. In addition, there are roughly 100,000 items in ‘masterlists’. Within the masterlists we have the list of people, films etc, which are the related data for the objects.

Continue reading
5
  11689 Hits
  0 Comments
11689 Hits
0 Comments

How to generate video thumbnails in PHP?

How to generate video thumbnails in PHP?

A Video link without a thumbnail is like a smartphone without a camera, you can use it but no one would like to use it. If you want your visitors to see your video, you need to make sure that your video link has a thumbnail which is forcing users to click on the link.

How can we do this?

Continue reading
22
  30657 Hits
  0 Comments
30657 Hits
0 Comments

Adding validation in Joomla for post_max_size and memory_limit

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.

Continue reading
4
  6362 Hits
  0 Comments
6362 Hits
0 Comments

Using Joomla logging to easily debug MySQL issues

Using-Joomla-logging-to-easily-debug-MySQL-issues
Sometimes, you might have operations like crons running PHP scripts behind the scenes. If there are any errors in it, it can become difficult to debug them since they might not affect the entire website. Whether you are doing this with any PHP framework or in a Joomla component, logging can help you debug such issues.
Here is how you can use Joomla's logging functionality to log your errors to a file.
jimport('joomla.log.log'); //import this file on top of the file //write db log code inside your functionJLog::addLogger(array(        //Sets file name        'text_file' => 'com_test.errors.php'        ), //Sets all JLog messages to be set to the file JLog::ALL, //Chooses a component name 'com_test' ); //insertion code :-if(!$db->insertObject($table_name, $final_array, 'id')){ $logEntry = $db->stderr();   //logentry variable // Log my extension errors only.JLog::add($logEntry, JLog::WARNING, 'com_test'); return false;} 

Logs shall be stored in yoursiteroot/logs/com_test.errors.php

1
  11744 Hits
  0 Comments
11744 Hits
0 Comments

JTicketing 1.4.3 released

jticketing-1.4.3-is-here

Hey all,

With our extension JTicketing 1.4.3, we have introduced a change in payment process (all changes happen behind the scenes, user action flow remains the same).

Compatible with Joomla! 2.5.x & 3.0.x

Continue reading
1
  2427 Hits
  0 Comments
2427 Hits
0 Comments

Zoo - Creating an address field element

Zoo-Creating-an-address-field-element

Here's a short tutorial on creating a Zoo element that has multiple sub-fields. A good example for the same, which we've also used as a sample is an address field. An address field will typically have different parts such as city, zip, state etc. I assume you have already gone through the zoo documentation on creating a new custom element - http://www.yootheme.com/zoo/documentation/developers/create-a-custom-element

Step 1: The XML file
create the media/zoo/applications//elements/address/address.xml file.

    Address    Tekdi    Feb 2013    Copyright (C) tekdi        http://www.tekdi.net    1.0.0    Repeateble city,country and state fields

Step 2: The PHP file
create this file: media/zoo/applications//elements/address/address.php

Continue reading
3
  15297 Hits
  0 Comments
15297 Hits
0 Comments