Hot answers tagged

3

You need both PHP functions to do this work: json_encode : http://www.php.net/manual/de/function.json-encode.php json_decode: http://www.php.net/manual/de/function.json-decode.php Maybe something like this: <?php $arr = array (); $arr[name] = $this->form->getInput('name'); $arr[name2] = $this->form->getInput('name2'); echo ...


2

I think you probably want to use the session - see https://docs.joomla.org/How_to_use_user_state_variables. Store the data in a session variable, then do a redirect to your component P, and then P retrieves them from the session data. Don't forget to clear the relevant session data after you've finished with it.


2

Enclose those two fields in a element in your form xml file. <fields label="COM_COMPONENTNAME_FIELDNAME_FIELDSET_LABEL" name="fieldname"> <fieldset label="COM_COMPONENTNAME_FIELDNAME_FIELDSET_LABEL" name="basic"> <field name="name" type="text" label="name"/> <field name="name2" type="text" label="name"/> </fieldset&...


1

Start by extracting the extra_fields column's json string from #__k2_items table at the row of your choosing, then decode it. Each row from the array (generated by decoding json), will have two elements having respective keys: id and value . I don't quite know the full picture of what you are trying to do, but I can help you to relate and extract the data. $...


1

I made it like this and it works. <?php $db = JFactory::getDBO(); $articleid = JRequest::getInt('id'); $db->setQuery('SELECT extra_fields FROM #__k2_items WHERE id='.$articleid); $AllExtraFields = $db->loadResult(); $AllExtraFields = json_decode($AllExtraFields); echo $AllExtraFields[0]->value; ?>


1

The recommended replacement according to the Joomla documentation: Element Line Description \JResponse::setHeader() 83 3.2 Use JApplicationWeb::setHeader() instead https://api.joomla.org/cms-3/deprecated.html


1

What you should do is include &format=json in your URL. This tells Joomla that you want a JSON response rather than HTML, and it won't run (subsequently) your template to produce all your page HTML. The usual approach is to call parent::display() in your controller code (ie in submit()). This will cause Joomla to look for a display() function in a ...


1

Joomla! 4.0 will have Web Services. In 3.x, without using extensions or custom code, there's no way to do this for single articles. For article listings (category views) you could use RSS/Atom feed by accessing category view with format=feed parameter appended.


1

Only components that specifically provide a JSON response are accessible in the JSON format. Modules are not (by design) directly addressable hence you can not call them directly, therefore, no JSON format option. You could build a plugin to gain access to the data you wanted but that would be a 100% custom built option.


Only top voted, non community-wiki answers of a minimum length are eligible