I'll answer this myself too as I have a lot of experience with lazy loading assets.
preload may seem like it asynchronously loads files but it doesn't. They're still considered render blocking.
This also applies if you also just add your assets to below the closing </body> tag as there's still remaining HTML to be rendered.
You're best approach will ...
If I understand the usage of preload correctly, in 3.x you can add these links manually with addHeadlink():
// Preload resources
$mediaVersion = $this->mediaVersion ? '?' . $this->mediaVersion : '';
$this->addHeadLink($this->baseurl . '/templates/' . $this->template . '/css/template.css' . $mediaVersion, 'preload', 'rel', array('as' => '...
Perhaps your module has an override in the template used by the website. You can verify this in the template configuration page of the back-office. If that's the case, just delete the /templates/[template name]/html/[mod_your_template] folder, and Joomla will use your original module files.
You can just add the necessary db query to add this, see:
However, you might be able to instantiate the RedirectModelLink model (/administrator/components/com_redirect/models/link.php) and use that to add / delete data.
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.
To get SEF URL, pass non-SEF URL through JRoute::_(). To get non-SEF URL, you can use ContentHelperRoute::getArticleRoute().
// Load route helper class.
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
// Build non-SEF URL.
$nonSefLink = ContentHelperRoute::getArticleRoute($article->id . ':' . $article-&...
I agree that your "Solution 2" is better because it implements a more readable syntax.
I might be a little too nitpicky because I have been spending time volunteering at CodeReview, but perhaps you could clarify your variable naming. Your abbreviated naming is probably very clear to you, but it will make your code more readable for other developers if you ...
There is JHtmlNumber class but it only has a method for converting bytes.
Because Joomla! does not use INTL extension, formatting there is done using simple number_format() with language strings (THOUSANDS_SEPARATOR and DECIMALS_SEPARATOR) acting as separators. So formatting would depend on user's language.
Using regular expressions to manipulate valid HTML is not advisable because regex is "DOM-unaware" meaning that it doesn't know if it is actually modifying a tag or just text that seems like a tag. Also, unless expressly told to replace only once, it will happily modify multiple matching strings (effectively damaging your content). Finally, using ...
I had the same problem on twitter. I was trying to add my link picture just as facebook does automatically but had to investigate the CARD Validator here https://cards-dev.twitter.com/validator ...Tthe way I have it working on Joomla 3.9.11 is adding this code in the head of my template default.php ... I was able to properly add the title, the description ...