Notes by JDeveloper for JDeveloper
Once you master it, you're gonna like it

The Behavior of Field in Seblod

Written by Viktor Iwan

Seblod is a best thing happen in Joomla ! but as developer, you sometime like to extend seblod to have field the way you wanted, this article explain on how seblod field works. At this time of writing there's no official developer guide in seblod, so this is solely based on my experience on working with seblod for over 3 years.
Seblod field is working in two level of depth: Form Field (field that joomla user sees) and Construction Field (field that made Form field, storage and behavior set here). 

Form Field

There are two type of the form field:

  • Bind to specific content type
  • Independent for any content type

On your first several project, you likely to use the bind type, it indicates by a locked icon on content type screen.

Note: when you see this padlock active, every field you create will be a bind one


You use Independent type, for field that likely need for multiple usage, for example a social tag field . You need to have function for article to be able to share in Twitter and Facebook. By build a social tag field, you can use in multiple content type.

A form field is required to build a Content Types. It has  many field types and you can see on the List Field. When setting up a form field.  Each parameter usually self-explainatory like Default Value, Max Length, etc. Two thing that you need to aware is:

  • Format of the value stored
  • Joomla Object Type
  • Location of the value stored (Storage location)

Format of the value stored

There are 3  type of value format:

  • Standard. Usually use single value in single field
  • JSON. Create multiple-value in single field in JSON Format
  • Custom. Create multiple -value in single field in native SEBLOD Format

Location of the value stored (Storage location)

There are 5 storage object type:

  • Free Type. You have option to store anywhere
  • Article. Store in relation with  #__content
  • Category. Store in relation with  #__categories
  • User.  Store in relation with  #__users
  • Usergroup. Store in relation with  #__usergroup

Two more option that you able to set:

  • Field. Related with field column on joomla core table based on Storage object you set above
  • Alter. The decision when you need to modify joomla core table OR use additional SEBLOD’s custom field table.

When you manage an article, If your storage  field location is in introtext, you have to use Custom Format. When you manage a category,  you also have to use Custom Format in Description

Technical notes
For additional seblod custom field table, the rules of additional table’s name  as follow

Form Field


Table in Database

Bind Mode


#__cck_store_form_<content type name>

Unbind Mode


#__cck_store_item_<content type name>

Bind Mode



Unbind Mode




Construction Field

Construction Field is highly related with understanding #__cck_core_fields table works
One of characteristic of Construction Field is where storage is set to ‘dev’.  Another thing to look is the ‘storage_field’.  “storage_field “  stored column name  of where the value of Form Field stored
So, let’s take a look on ‘core_defaultvalue’ field. The objective for this field is to set a default value in Form field.

Now, see how’s the process behind the scene works. If you run query for ‘core_defaultvalue’ in name field on  ‘#__cck_core_fields’, and you look at ‘storage’ and ‘storage_field’ you’ll find two value:
‘storage’ is set to ‘dev’, ‘storage_field’ is set to ‘defaultvalue’

What happen is..when you create an Form Field,  for example a Text Field, you’ll be ask for a default value and ‘core_defaultvalue’ will handle this. If you set a value in default value field,  it will be stored in defaultvalue column on ‘#__cck_core_fields’.


Seblod's JCckDev::renderForm Mastery

Written by Viktor Iwan

Due little documentation about seblod development, here a little note tips regarding JCckDev::renderForm

What is renderForm anyway ?

If you build a field plugin, you might want to set parameter for it. I'm not refer to how field display in Admin or Site Form, but how field get setup. Perhaps a visual screenshot would help:

Seblod Field Setting


So, a seblod field that you see in Admin/Site Form (i call it Form Field) is made by another field (i call it Construction Field). Now, what i'm shere here is refer to Construction Field.

Construction Field is use in edit.php, of tmpl folder in cck plugin field:

JcckDev::renderForm() is use to display parameter to construct your Form Field

An example of JcckDev::renderForm usage, would be like this:

echo JCckDev::renderForm( 'core_defaultvalue', $this->item->defaultvalue, $config );

Let's see how we can understand and do little bit 'magic' with this function alone

renderForm() is declared on libraries/cms/cck/dev.php, but before we dig into explanation of its parameter, i would like you to know that field setting (and behavior) is related with '#__cck_core_fields' table.

So let's start:

public static function renderForm( $field, $value, &$config = array( 'doValidation' => 2 ), $override = array(), $inherit = array(), $class = '' )

$field : field name 
$value : Default value (please aware the where the value stored)
$config : some configration, i use to live it as default and i rarely find any new setting here in other fields
$override : some override with default configuration, the most 'magic' begin here
$inherit : Well.. no idea, i use to live it as default which 'array ()', you can set array('name' => somevalue, 'name' => somevalue,'after'=>somevalue )
$class: set specific class


 For example, let's built a default twitter username parameter on top of core_defaultvalue field

1. Copy Paste and override the label

echo JCckDev::renderForm( 'core_defaultvalue', $this->item->defaultvalue, $config, array('label'=>'Twitter Username' );

2. Change storage field

echo JCckDev::renderForm( 'core_defaultvalue', @$options2['defaulttwitter'], $config, array('label'=>'Twitter Username','storage_field'=>'json[options2][defaulttwitter]' );

 $option2 is the recommended way to have custom parameter, if you like to use/override other field, please see #__cck_core_fields and see other field (but beware of breaking core seblod functionality, if you unsure, use options2)

3 Add CSS Class, 'twitterusername' (optional)

echo JCckDev::renderForm( 'core_defaultvalue', @$options2['defaulttwitter'], $config, array('label'=>'Twitter Username','storage_field'=>'json[options2][defaulttwitter]',array(),'twitterusername' );

note: notice i use 'array()' to send null array for $inherit parameter


You like to know on how seblod field works ? Click this Seblod Field Behavior Article (coming soon)

Like to improve and make this article better to readl ? Email me : This email address is being protected from spambots. You need JavaScript enabled to view it.






Small snippet to track load time in PHP

Written by Viktor Iwan

There are times when you need to debug on what time does a process required. This small snippet perhaps can show you how:

 $time = microtime();
 $time = explode(' ', $time);
 $time = $time[1] + $time[0];
 $start = $time;


  $time = microtime();
  $time = explode(' ', $time);
  $time = $time[1] + $time[0];
  $finish = $time;
  $total_time = round(($finish - $start), 4);

echo 'Process finished in '.$total_time.' seconds.';

This snippet helps me a ton when i have to debug a complaint from one of my client... and hope it can helps you too!

Automatic Filter on Article Manager

Written by Viktor Iwan

This is one of the tips that i found very useful when customizing your joomla back end for your client like i do.. its Auto Filtering Category based on link. Why use link ? well, at my case its because i'm using SEBLOD and it extend com_content to the new level of Joomla Experience. If you don't believe me just try it !  So, As developer, now i'm relying Seblod more than 3rd party component and i'm using totally custom admin menu for my client and if you're developer... you probably need it too...coz you don't want your client mess up your works, right ?

Okay, here's the easy tips. Use this format :



- category_id , the category ID
- published , content's state: -2 (Trashed), 0 (Unpublished), 1(Published), 2(Archived), *(All) 
- level , level of depth
- access , user access level
- author_id , author id
- language , language code
- tag , your article tag


So for example you like to have a link for all published content from Category 23, your link would be:


That's the tips of the day, hope it usefull for your project


Login Joomla User with Joomla API

Written by Viktor Iwan

At sometime, you need to have your script to login a user via joomla API. Here's how:

function loginJoomlaUser($username,$password,$return=""){
              $app = JFactory:: getApplication();
              $options = array();
              $options[ 'remember'] = JRequest::getBool( 'remember', false );
              $options[ 'return'] = $return;
              $credentials = array();
              $credentials[ 'username'] = $username;
              $credentials[ 'password'] = $password;
              $err = $app->login($credentials, $options);

Add Joomla User Programmatically with Joomla API

Written by Viktor Iwan

So, you code your extension OR use seblod template and you would like to add a user directly from your codes. Here's how:

function addJoomlaUser($username, $name, $email, $password) {
              jimport( 'joomla.user.helper');
              $data = array(
                            "groups"=>array ("1" ,"2" )
              $user = new JUser;
               if(!$user->bind($data)) {
                      throw new Exception("Could not bind data. Error: " . $user->getError());
               if (!$user->save()) {
                      throw new Exception("Could not save user. Error: " . $user->getError());
               return $user->id ;

Connect to other Database (External) in Joomla

Written by Viktor Iwan

When you want to connect other external database from your current project:

$conf =& JFactory::getConfig();
$host 		= ''; //replace your IP or hostname
$user 		= 'db_user'; //database user
$password 	= 'db_pass';//database password
$database	= 'db_name'; //database name
$prefix 	= 'jos_'; //prefix if any else just give any random value
$driver 	= 'mysql'; //here u can also have ms sql database driver, postgres, etc
$debug 		= $conf->getValue('config.debug');
$options	= array ( 'driver' => $driver, 'host' => $host, 'user' => $user, 'password' => $password, 'database' => $database, 'prefix' => $prefix );

$db =& JDatabase::getInstance( $options );

//Do the rest of process (queries) like usual

Becareful with Subquery Select with more than 1 level deep

Written by Viktor Iwan

I recently found a heavy loading of a page in mysite which using iJoomla Component named Guru. After profiling with Zend Studio, i found out the real problem cause by 2 level subquery

i'm talking about queries like this:

$sql ="SELECT id FROM #__guru_task WHERE id IN (SELECT media_id FROM #__guru_mediarel WHERE type = 'dtask' AND type_id in (SELECT id FROM #__guru_days WHERE pid =".intval($id).") ) ";

It's 2 level of subquery with 'IN' statement...

To solve this kind of problem, you only have to change the IN statement into multiple queries, like this:

$sql ="SELECT id FROM #__guru_days WHERE pid =".$id;
$temp = $db->loadColumn();
$sql ="SELECT media_id FROM #__guru_mediarel WHERE type = 'dtask' AND type_id in (".implode(',',$temp).")";
$temp = $db->loadColumn();
$sql ="SELECT id FROM #__guru_task WHERE id IN (".implode(',',$temp).")";
$all_lessons = $db->loadColumn();


 After some optimization with this approach, i'm able to change this:


Into this:


Look how mysql perform for the same result... 25 seconds load into 0.8 seconds load... That Fast !!!

Moral of the story: Don't use subquery with 'IN' statement more than 1 level. You can search on google with keyword "MySQL Subquery Slow Performance" and you'll see more people suggest the same.

"Remove" that POP UP in iJoomla's Guru

Written by Viktor Iwan

iJoomla Guru's is one of the best Learning Management System (LMS) available in Joomla. So if you want to build the next udemy ? i think Guru is one of the way, it's on the right track but still far for a complete out of the box experience. In this article i will show you one of iJoomla's problem in my perspecitve, and that is User Interface when managing course.

*) Last Tested on Guru V3.2.0.1

Here's what the original screen looklike :


It's kind a awful, when a half screen POP-UP appears and it reload another POP-UP... and looks... three scrollbars in the POP-UP. I don't know about you, but for me, this workflow is bit really hurting the usability aspect when managing course, can you imagine typing when you have to scroll in here-and-there in a small screen on wide area ?


Fortunately I found a workaround !

After strugling for an hour, i finally found temporary solution where i can hack the CSS to solve this problem.

1. You need to open g_admin_modal.css in /administrator/com_guru/css/

2. Replace this following css:

border-radius: 6px 0 6px 6px !important;
left: 100px;
margin-left: 0;
position: fixed;
right: 100px;
width: auto;


border-radius: 6px 0 6px 6px !important;
left: 0px;
margin-left: 0;
position: fixed;
right: 0px;
width: auto;



div#myModal .modal-body{
	margin: 0;


div#myModal .modal-body{
	margin: 0;
	height: 9999px;
	max-height: 9999px;




/*div#myModal iframe{
	width: 100%;
	min-height: 380px;


div#myModal iframe{
	width: 100%;
	min-height: 9999px;

And viola ! you just simulate the POP-UP just like a full-screen page !

And hope one of iJoomla's guru developer will visit this page and agree with this approach instead the current one



How to disable Seblod Integration for Joomla User

Written by Viktor Iwan

Seblod is great Joomla Addon, in fact, i wish it preinstalled with joomla. But sometime, as integrator and developer, we install 3rd party component that also handle user management in joomla. So, for this time, i have task to disable seblod integration for Core Joomla User Component. Here's the 2 simple step to do it..

1. Seblod Options' Stuff

Go to Seblod > Option, and select integration TAB and click on Joomla! User Sub-Tab. From there you will you will need to set Registration to No and for additional step you can set Default Content Type to None. Same thing with Joomla! User Group

Disable Seblod Integration for Joomla User

2. Plugin Setting

Go to Extensions > Plugin Manager

Search for "Seblod", and disable "User - SEBLOD" Plugin

That's All ! if you have any improvment, please post to forum


Joomla+Seblod Site Performance Part 2 - CDN

Written by Viktor Iwan

On the first part, we already setup GZIP that already make our site way faster. Now we're using CDN to (at least) make content delivery (mostly images) faster.

A Content Delivery Network (CDN) works by providing alternative server nodes for users to download resources (usually static content like images and JavaScript). These nodes spread throughout the world, therefore being geographically closer to your users, ensuring a faster response and download time of content due to reduced

There are 2 types of CDN Service:

- host your domain (DNS) :,

- not host your domain:, Amazon CloudFront

For this testing purpose, i'm choosing Cloudflare as they have FREE package


So let's dig in !



Setting up cloudflare account little bit unconvinient for me. Why ? because my background is a programmer not a network administrator. With CDN, you will be facing with some specific setting like DNS, IP, firewall, etc.

And after spend 1 hours to study some basic setting of cloudlfare, i am leaving my site and waiting for DNS propagation to be settled




Joomla+Seblod and Performance Part 1

Written by Viktor Iwan

After 3 years in joomla, i finally have time to focus on web performance, i will share all the result here. The Objective for this test is simple.. Joomla + Seblod is so powerfull but it comes with a great price.. heavy resources. This is why you need to focus on your site performance, especially when you're on limited resources like on shared server.

i will optimize a site in . When you visit the link, it probably already change to something else (or already optimized), this is because is one of my unused domain.

go to for real site

So, let's get started

Read more

Jomsocial Review : Is it the Best in the Market ?

Written by Viktor Iwan

Having Tagline "Easy Social Networking in Joomla" and "The Best in the Market" probably tease you to have the "Facebook Like" feature within your site. Before you press the "Buy Now" button i think you should read this whole insider story first

This review will be on going update, since jomsocial is also evolve. If you find this review already obsolete, please give the comment below

At this time of writing, the latest Jomsocial version is 3.0.4. For me this jomsocial release seem bit forced by the preassure of community. The new developer, iJoomla, seem bit under preassure since they keep postponed the launch and this makes the community bit frustrated.

Why you need to read this Jomsocial Review ?

"We do not issue refunds under the following circumstances:

  • Your client didn't go for it
  • You've changed your mind
  • You've decided JomSocial is "Not what I need"
  • You've decided to stop using Joomla
  • Your server does not meet minimum system requirements
  • You don't have the time to implement JomSocial on your site
  • You've found a different solution
  • You made some customizations and modifications and now JomSocial isn't working
  • Your purchase is older than 14 days (no exceptions)
  • You experience script conflicts with other 3rd party software connected to or installed on your Joomla website (Templates, Components, Modules, and Plugins). "

 Long story short, i have client who ask for social feature on their site, there are 3 i have in mind: Jomsocial, Community Builder, or build my own.

Read more

Numeric Match in Seblod List

Written by Viktor Iwan

One of respected seblod user, James Morell, share his experience regarding build a seblod list with "Numeric Match Filter" in it.... if you don't know what it is, let me give you the preview

Seblod numeric match

Here's James word of wisdom : "On your content type you must change the storage of your field by clicking "alter" and change it to "int(11)" So the search knows to treat all values as integers, rather than strings"

and that's the tip for the day


Custom icon for Client

Written by Viktor Iwan

If you're type of person who pay attention to extra detail to gain better satisfaction to your client.. this tips might help you...

This tips will turn


Into This:

Interested ?

Read more

Load Seblod Anywhere (and current limitation)

Written by Viktor Iwan

So you need to load seblod in any where you wanted ? let the search begin

Read more

Create Intro Text / Split Text Automatically

Written by Viktor Iwan

So if you build a news content type, you probably think you need two field to store intro and fulltext.

Well, with this script you don't have to build two field, just use introtext, and we can create the introtext automatically.

if (strlen($intro) > 200) {

// truncate string
$stringCut = substr($intro, 0, 200);

// make sure it ends in a word so "assassinate" doesn't become "ass..."
$intro = substr($stringCut, 0, strrpos($stringCut, ' ')).'[..]';
echo $intro;

Some Notes for you:

  • strip_tags is use to strip-out (erase) all the html tag, so you'll get pure text
  • you need to cut/split the intro text on the white-space, not in the word

Snippet 4 U

Written by Viktor Iwan

Get "Client" path on template, it is usefull if you like to link files like .js or .css:



Menu or Div Snap On Top Effect , the power of Bootstrap's Affix

Written by Viktor Iwan

You visit a site (like, you see the menu on the middle of your screen, while you scroll down, suddenly the menu scroll on the top of your browser screen.... cool, you said ! Now i'm gonna to show you how easy it is to do it with bootstrapJS !

Read more

Tips: Styling Price Display

Written by Viktor Iwan

So, displaying millions for my local currency is a common, and now my client want to styling it by reduce the last 3 digit (thousand).

Here's what i do:

  1. Open administrator/components/com_virtuemart/helpers/currencydisplay.php
  2. go to priceDisplay() function
  3. change: return $this->getFormattedCurrency($price,$nb);
    $temp[$lastindex]="<span style=\"font-size:10px\">".$temp[$lastindex]."</span>";
    return $normalPrice;

So there we have a nice price display in virtuemart 2