You can use the following:
$menu = Joomla\CMS\Factory::getApplication()->getMenu();
$menuItem = $menu->getItem($menulink);
If you var_dump($menuItem);, it will show you which properties are available for said menu item.
Access the link fields the same way you're accessing other fields, through the main activities field.
<?php foreach ((array) $activities as $activity) : ?>
<?php foreach ((array) $activity->links as $link) : ?>
<?php echo $link->menulink; ?>
<?php endforeach; ?>
<?php endforeach; ?>
$assoc = $db->loadAssoc();
This will provide a flat, associative result set array:
$assoc = [
'AIG' => '88,32',
'ALLIANZ' => '86,96',
'LLOYDS' => '118,11',
Then prepare the results for sorting by creating a new column as the first element that ...
Resolved this as follows:
In foreach, for the intro image, I replaced
$introimage = $r->images;
$introimage = json_decode($r->images)->image_intro;
For the date formatting, I added:
echo '<time datetime="' . $published . '" class="mb-2 text-muted&...
The "question mark data" = token that prevents caching issues after Joomla updates.
If you really don't want that, you could change the 'version' => '...
Been a while since I used repeatable form fields (deprecated and subform fields should be used instead), but if I rightly remember, the repeatable form fields response format was a little different. It grouped each column in an array rather than each row.
So what you'll need to do is define a function to group the values by key:
It is always good advice to take a usable back up of your site before making any changes to important aspects like PHP. Having said that I haven't had any issues switching back to previous versions of PHP over the years when needed.
The most likely issues you will encounter moving from PHP 5 to PHP 7.x will be whether all the required PHP extensions are ...
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>';
JControllerLegacy::getInstance() caches the first controller instance so you're actually getting an instance of your component's controller rather than Content controller. You can skip the controller and get the model directly instead:
JModelLegacy::addIncludePath(JPATH_SITE . '/components/com_content/models', 'ContentModel');
$model = JModelLegacy::...