Welcome,
Guest
.
Please
login
or
register
.
Did you miss your
activation email
?
News:
Did you know that
Elxis 5.x
uses HTML5, CSS3 and pure javascript without external libraries such as jQuery?
Home
Help
Login
Register
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
Elxis 5.5 and JSON parameters
« previous
next »
Print
Pages: [
1
]
Author
Topic: Elxis 5.5 and JSON parameters (Read 3974 times)
datahell
Elxis Team
Hero Member
Posts: 10356
Elxis 5.5 and JSON parameters
«
on:
April 20, 2024, 21:39:24 »
In the upcoming
Elxis 5.5
the parameters of various extensions (modules, plugins, templates, etc) gets saved by default as
JSON
strings and not as
newline separated text
as up to Elxis 5.4.
Elxis 5.5 is backwards compatible
as it detects automatically the format of the string and you have no problem at all. However if in any
third party extension
you have developed you use to parse manually the parameters string you got from the database,
you must check if the format is JSON or the old one
before trying to parse the string. In this case post a reply below for instructions on how to parse the string.
Deference between Elxis 5.5 and previous versions
Elxis 4.x, 5.0-5.4 parameters string:
width=120\nheight=45\ncolour=red
Elxis 5.5+ JSON format (same parameters as above):
{"width":"120","height":"45","colour":"red"}
Elxis saveS automatically the parameters when you edit a module, a plugin, etc. But if you ever need to save them manually in your extension the use the new methon
toJSONString
. I will post an example with backwards compatibility, so the code below works on any Elxis version (for a sample module):
elxisLoader::loadFile('includes/libraries/elxis/parameters.class.php');
$modxml = ELXIS_PATH.'/modules/mod_mymodule/mymodule.xml';
if (isset($_POST['params'])) {
$params = new elxisParameters('', $modxml , 'module');
if (eFactory::getElxis()->getVersion() >= 5.5) {
$row->parameters = $params->toJSONString($_POST['params']);
} else {
$row->parameters = $params->toString($_POST['params']);
}
unset($params);
} else {
$row->parameters = null;
}
Note:
Users will require to update all third party extensions that need update before updating to Elxis 5.5, because of Elxis 5.5 compatibility fixes. I have already released some updated extensions with Elxis 5.5 support.
«
Last Edit: April 20, 2024, 21:51:19 by datahell
»
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
chongbing
Full Member
Posts: 137
Re: Elxis 5.5 and JSON parameters
«
Reply #1 on:
April 27, 2024, 12:04:23 »
COOL ! 👍 I can feel that the new features will be highly anticipated. THANK YOU VERY MUCH! datahell !
Logged
Make it a better world,
https://EasyApps.Biz
datahell
Elxis Team
Hero Member
Posts: 10356
Re: Elxis 5.5 and JSON parameters
«
Reply #2 on:
May 06, 2024, 19:20:56 »
Elxis 5.5 will be available very soon. You can start the count down
Logged
Elxis Team
|
Is Open Source
|
IOS Rentals | IOS AERO
Print
Pages: [
1
]
« previous
next »
Elxis CMS Forum
»
Support
»
Elxis 4.x/5.x DEV
»
Elxis 5.5 and JSON parameters