Skip to content

Instantly share code, notes, and snippets.

@Yiannistaos
Last active April 26, 2023 07:53
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save Yiannistaos/01c91e3d681187401cc4ccf6493b3bed to your computer and use it in GitHub Desktop.
Save Yiannistaos/01c91e3d681187401cc4ccf6493b3bed to your computer and use it in GitHub Desktop.
Quick Intro into the Joomla! HTMLHelper class
<?php
// Quick Intro into the Joomla HTMLHelper class
// Checkout also this video: https://www.youtube.com/watch?v=aHY_hsu7iuk
// File: \libraries\src\HTML\HTMLHelper.php
use Joomla\CMS\HTML\HTMLHelper;
// Image
echo HTMLHelper::_('image', 'plg_system_web357framework/fix404errorlinks.png', Text::_('Fix 404 Error Links extension for Joomla!'), null, true);
echo HTMLHelper::_('image', 'media/plg_system_web357framework/images/fix404errorlinks.png', Text::_('Fix 404 Error Links extension for Joomla!'), null, false);
// Calendar
echo HTMLHelper::_('calendar', 'now', 'mycalendar_id', 'mycalendar_id', '%Y-%m-%d');
echo HTMLHelper::_('calendar', 'now', 'mycalendar_id', 'mycalendar_id', '%Y-%m-%d', ['showTime' => true]);
// Date
echo HTMLHelper::_('date', 'now', 'Y-m-d H:i:s') . '<br> ';
echo HTMLHelper::_('date', '1 day', 'Y-m-d H:i:s') . '<br> ';
echo HTMLHelper::_('date', '+1 year', 'Y-m-d H:i:s') . '<br> ';
echo HTMLHelper::_('date', '+1 week 2 days 4 hours 2 seconds', 'Y-m-d H:i:s') . '<br> ';
// Tooltip
echo HTMLHelper::_('tooltip', 'tooltip', 'titlos', 'tooltip.png', 'textt', 'hrefff', 'altt', 'hasTooltip'). '<br> ';
// Stylesheet
echo HTMLHelper::_('stylesheet', 'plg_system_web357framework/style.css', array('version' => '1.0.1', 'relative' => true));
echo HTMLHelper::_('stylesheet', 'media/plg_system_web357framework/css/style.css', array('version' => 'auto', 'relative' => false));
// Script
echo HTMLHelper::_('script', 'plg_system_web357framework/script.js', array('version' => '1.0.1', 'relative' => true), ['defer' => true]);
echo HTMLHelper::_('script', 'media/plg_system_web357framework/js/script.js', array('version' => 'auto', 'relative' => false), ['defer' => true]);
// Iframe
echo HTMLHelper::_('iframe', 'https://www.web357.com', 'Web357 iframe', ['width'=> 800, 'height' => 400]) . '<br> ';
// Radio List
$options = array(
HTMLHelper::_('select.option', 'c', Text::_('Copy')),
HTMLHelper::_('select.option', 'm', Text::_('Move'))
);
echo HTMLHelper::_('select.radiolist', $options, 'batch[move_copy]', '', 'value', 'text', 'm');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment