Hot answers tagged

4

To your first question "how can I make Joomla acknowledge my joomla.asset.json changes without reinstalling extensions?" I think it is not right that you have to reinstall the extension after every change in the file joomla.asset.json. It is only necessary the first time you add the joomla.asset.json file. So that Joomla registers this file. So ...


2

Do you want to do a fetch only from the news website (GET requests only) or do you need to push back information from your Joomla! 3 website eg (POST request) ? Joomla 3 HTTP Client is the same than the 1.x branch on Packagist HTTP Client 1.x If what you want is GET only you might want to consider using com_newsfeeds and incoming rss feed. You could use ...


2

To use format=json query parameter, the controller filename needs to be suffixed with the format, e.g. ajax.json.php. This is mentioned in the linked documentation: If you are developing an MVC component, save such a controller in a file called mycontroller.json.php and place it inside your controllers folder. That controller is automatically executed if ...


2

Resolved this as follows: In foreach, for the intro image, I replaced $introimage = $r->images; with $introimage = json_decode($r->images)->image_intro; For the date formatting, I added: use Joomla\CMS\HTML\HTMLHelper; use Joomla\CMS\Language\Text; and replaced echo '<time datetime="' . $published . '" class="mb-2 text-muted&...


2

It's how Repeatable field stores its data. Pick a field to iterate over and use its key to access value of another field: foreach ($carousel_images['carouselimage'] as $key => $image) { // do something clever for each of the images '<img src="' . $image .'"><p>' . $carousel_images['carouselcaption'][$key] . '</p>'; } ...


1

In J4 default MVC factory uses PSR-4 autoloading. So InputDataController.json.php filename is invalid, your controller class will not be found at all. Secondly, default component dispatcher doesn't use format for creating controllers anymore. The simple solution here is to rename the file to InputDataController.php. If you want to customize the class ...


1

Since your logos and urls exist in pairs, you can use a single loop over the logos and access the urls via the shared index. Code: (Demo) foreach ($jsonPartenaires['logo'] as $i => $logo) { $html = sprintf('<img src="%s">', $logo); if ($jsonPartenaires['url_partenaire'][$i]) { $html = sprintf( '<a href="%...


1

Although the other answer works, it's not very efficient. Instead everything but $query->values() call can be done outside the loop. This way multiple rows are inserted with a single database query: $query = $db->getQuery(true) ->insert($db->quoteName('#__table_name_')) ->columns($db->quoteName($columns)); foreach($arrayDecodedJson ...


1

The solution was simple. Put $query = $db->getQuery(true);, inside the foreach loop. Make an array in order to put inside the arrays values like : $values = array($db->quote($value['value1']),$db->quote($value['value2']),$db->quote($value['value3']),$db->quote($value['value4']) Then you make the query like so inside the foreach loop: ...


1

Joomla 3 There are a few existing places to get an API for Joomla! 3. https://techjoomla.com/rest-api-for-joomla https://www.selfget.com/products/jbackend.html Joomla 4 Or in Joomla! 4 is a full API https://www.joomdev.com/blog/entry/joomla-4-api-introduction https://docs.joomla.org/Joomla_Api_Specification https://magazine.joomla.org/all-issues/august-...


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