Make your data sources flexible with system and user defined params

Starting with version 4.1 the data sources parameters can contain user variables that get their value in one of the following ways:

  • Joomla editor
  • HTTP Request (GET/POST)
  • Logged in User/System environment

For example, in this case we are using a data source that getting its data from the following database query:

SELECT `id`,`title` FROM `#__content` WHERE catid = 2 LIMIT {user_param_1:int}

The user_param_1 will have a default value that you specified when we added the data source into the article, but this value can be overwritten in the URL.

Note: MTo1 is the base64 encoded value of 1:5, which means set user_param_1 = 5. If you have more than one user params you can separate them using the symbol ^, e.g. 1:5^2:9 translates to user_param_1 = 5, user_param_2=9.

You can try that yourself, by adding to the URL of this page the parameter data_source_user_params=1%3A7 that will set the user_param_1 = 7. You can also click here to reload the current page with this URL argument and see how the number of rows will increase to 7.

Current page URL with user param value set:
http://www.tabulizer.com/index.php/support-menu/tabulizer-tips/62-data-source-params?data_source_user_params=1%3A7

Note: 1%3A7 is the url encoded value of 1:7, which means set user_param_1 = 7

Below is the sample output for this example:

42Adding sorting capabilities to your table
47How to make responsive an article table
48Solving jquery conflicts in Joomla with Tabulizer jQuery plugin
50Creating a ruleset from scratch - "Hello World" example
51How to add tables to your Wordpress post or page

For security purposes you can specify the data type of the user params and if they can overwritten by URL parameters. Please read the documentation for more details on that.

Apart from custom user variables, you can use system parameters. For instance, you can use the {user_id} parameter that will be replaced by the user id of the logged in user. As a result, the data source will contain different data and each user will see a different table view in the front-end that contains data specifically for him. Here is a list of variables you can use while constructing your data source:
  • {user_id}
  • {user_name}
  • {user_email}
  • {user_fullname}
  • {user_lastvisit_date}
  • {user_register_date}
  • {user_groupids}
  • {site_lang}
  • {current_datetime}
You can also use the following custom variables:
  • {user_param_ID_url:DATA_TYPE}
  • {user_param_ID_editor:DATA_TYPE}
  • {user_param_ID:DATA_TYPE}

ID is an integer value (i.e. 1,2,3, ….)
DATA_TYPE can be:

  • int: integer
  • float: float, real, decimal
  • date: date
  • cmd: can contain latin letters (a-z), numbers (0-9), the underscore (_), the period (.) and the hyphen (-).

Here are some examples:

{user_param_1_url:int}, {user_param_2_editor:cmd}, {user_param_10:float} When trying to assigning a value to these user defined variables, the following rules apply:

  • {user_param_ID_url:DATA_TYPE} can take the value only from the GET/POST request
  • {user_param_ID_editor:DATA_TYPE} can take the value only from the editor.
  • {user_param_ID:DATA_TYPE} will take the value from the editor, and it will be overwritten by the GET/POST value, is present. In other words: if {user_param_ID_url:DATA_TYPE} is specified {user_param_ID:DATA_TYPE} = {user_param_ID_url:DATA_TYPE} else {user_param_ID:DATA_TYPE} = {user_param_ID_editor:DATA_TYPE}