0
votes

I am new to Joomla development and like to understand how Joomla stores the data from the text field in the xml file. As far i understood from the Joomla Docs, the data is stored in a Json file in a table called modules (if you work with modules.)

So lets say i create a plugin with a text field inside I would enter this code into the xml file:

<field name="mytextvalue" type="text" default="Some text" label="Enter some text" description="" size="10" />

To display the value I would do something like this in the main php:

$mytextvalue = $params->get('mytextvalue');

and helper file:

echo "$params->get('mytextvalue') ";

As simple like this the data is stored in Joomla and gives a output of the value mytextvalue.

Now, I did not setup a db table to store this data. Where is the Data? Do I even need to store the data in a custom DB table and if yes why should i do this?

1
as i know , you just need store data in database in components , for module and plugin that are simple you dont need to store anything in database as joomla will do this in best way for you , any way the #__extensions is the location for your plugin and stored data, the fields in xml are setting of your plugin no the type of data that needs to be collected and storedSilverboy.ir

1 Answers

1
votes

All the extensions data are stored as json inside the params column of #__extensions table. For example let us examine how Joomla profile plugin saves params data. If you go to #__extensions you will get a plugin with name plg_user_profile. Go to edit and you will find params column there which stores the plugin parameter data like this

{"register-require_address1":"1","register-require_address2":"1","register-require_city":"1","register-require_region":"1","register-require_country":"1","register-require_postal_code":"1","register-require_phone":"1","register-require_website":"1","register-require_favoritebook":"1","register-require_aboutme":"1","register-require_tos":"2","register_tos_article":"","register-require_dob":"1","profile-require_address1":"1","profile-require_address2":"1","profile-require_city":"1","profile-require_region":"1","profile-require_country":"1","profile-require_postal_code":"1","profile-require_phone":"1","profile-require_website":"1","profile-require_favoritebook":"1","profile-require_aboutme":"1","profile-require_dob":"1"}

This data can than be retrieved with the method you already know. This data is having keys with their values.