Skip to content

Instantly share code, notes, and snippets.

View dgrammatiko's full-sized avatar
💭
👀 4 my next gig

Dimitris Grammatikogiannis dgrammatiko

💭
👀 4 my next gig
View GitHub Profile

Using Bootstrap in Joomla 4

Joomla 4 introduces a modular approach for interactive components

  • What is a modular approach?
  • The functionality is broken down into individual components, files. There is no one file approach as it was with Bootstrap in Joomla 3. This was done for efficiency and performance gains (send only the code that is needed instead of delivering everything in case some page will need so component).

How to deal with Interactive components

  • Load what you need per case! There are helper functions that will help you achieve this and, it is dead easy just call the function with the appropriate arguments.
@dgrammatiko
dgrammatiko / instructions.md
Created January 15, 2024 09:56 — forked from benfoxall/instructions.md
apache vhosts
/* https://go.tacodewolff.nl/minify */
enScroll=!1;const lStor=localStorage,sStor=sessionStorage,doc=document,docEl=document.documentElement,docBody=document.body,docLoc=document.location,w=window,s=screen,nav=navigator||{};function a(){const k="G-XXXXXXXXXX",t=()=>Math.floor(Math.random()*1e9)+1,n=()=>Math.floor(Date.now()/1e3),y=()=>(sStor._p||(sStor._p=t()),sStor._p),v=()=>t()+"."+n(),p=()=>(lStor.cid_v4||(lStor.cid_v4=v()),lStor.cid_v4),m=lStor.getItem("cid_v4"),u=()=>m?void 0:enScroll==!0?void 0:"1",l=()=>(sStor.sid||(sStor.sid=n()),sStor.sid),d=()=>{if(!sStor._ss)return sStor._ss="1",sStor._ss;if(sStor.getItem("_ss")=="1")return void 0},r="1",h=()=>{if(sStor.sct)if(enScroll==!0)return sStor.sct;else x=+sStor.getItem("sct")+ +r,sStor.sct=x;else sStor.sct=r;return sStor.sct},e=docLoc.search,f=new URLSearchParams(e),a=["q","s","search","query","keyword"],g=a.some(t=>e.includes("&"+t+"=")||e.includes("?"+t+"=")),i=()=>g==!0?"view_search_results":enScroll==!0?"scroll":"page_view",b=()=>enScroll==!0?"90":void
@dgrammatiko
dgrammatiko / analytics.js
Last active May 15, 2022 00:15 — forked from janispritzkau/analytics.js
Minimal Google Analytics script in modern javascript (677 bytes minified)
((document, location, navigator) => {
const domain = location.hostname.split(".")
const match = document.cookie.match(/(^|; ?)_ga=GA1\.\d\.(\d+\.\d+)(;|$)/)
// use existing client id or generate one
const cid = match ? match[2] : ~~(2147483648 * Math.random()) + "." + ~~(Date.now() / 1000)
// set cookie at highest possible domain level
for (let i = domain.length; i--;) {
const cookie = `_ga=GA1.${domain.length - i}.${cid}`

Joomla Child Templates

Joomla 4.1 will support templates with the ability to create child template. Actually the code already exists since 4.0 and this Pull Request. The UI was missing anything meaningful prior to 4.1 so although the new mode technically was supported it wasn't exposed to the end users. The missing UI part will be introduced with Pull Request.

So, what are child templates?

Child templates basically are templates with only one file: templateDetails.xml.

@dgrammatiko
dgrammatiko / fix.php
Last active February 21, 2022 06:12
Fix broken 4.1 update
<?php
define('JOOMLA_MINIMUM_PHP', '7.2.5');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
die(str_replace(
'{{phpversion}}',
JOOMLA_MINIMUM_PHP,
file_get_contents(dirname(__FILE__) . '/templates/system/incompatible.html')
));
}

Developers please conform to the new image convention

Joomla 4 shipped with native support for lazy loading images and also with a new concept of adapters for storing images. This requires some attention in the code.

Tobias Zulauf was the developer that handled the communication with the Google devs for implementing all the nice recomendation whenever you run a lighthouse. On top of that he was the one that created the plugin that would allow the Web Platform new feature called images lazy loading. On a weird turn of events the project decided not to go with the plugin approach but rather to use the native support for lazy loading as the default behaviour universally for all the images. There were a lot of discussions with people commenting against this approach, mainly because the first itteration was treating every image as a lazy loadable image. This was rectified few month later when the image picker code had to be revisited so it would allow remote storage of images (what is known as Media Ada

{
"alignleft": {
"selector": "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",
"classes": "left"
},
"aligncenter": {
"selector": "p,h1,h2,h3,h4,h5,h6,td,th,div,ul,ol,li,table,img",
"classes": "center"
},
"alignright": {
@dgrammatiko
dgrammatiko / main.js
Created January 7, 2022 19:30
Get all open Joomla issues
/**
* Needs npm init
* Needs npm install octokit
* Needs npm install dotenv
*/
const fs = require('fs');
const { Octokit } = require("octokit");
require('dotenv').config()
const octokit = new Octokit({
@dgrammatiko
dgrammatiko / my-ender-corexy
Last active September 12, 2021 16:00 — forked from joshschools/moonraker.cfg
printer.cfg
[include kiauh_macros.cfg]
[mcu]
serial: /dev/serial/by-id/usb-Klipper_lpc1769_0460001525813AAF64DC6B5CC12000F5-if00
# serial: /dev/serial/by-id/usb-Klipper_lpc1768_20200015A88C3CAF9ECE705CC32000F5-if00
[pause_resume]
[display_status]
[virtual_sdcard]