Adapte old template to Joomla4

  • Published by
    Yannick Berges
  • Last modified
    26 April 2023
  • Up to date
    Yes
  • Profile concerned
    Webdesigner, Developer
  • Concerns
    Template
  • Since Version
    3.X
  • Voting
    Average rating
    • 1
    • 2
    • 3
    • 4
    • 5
  • Favourites
    757 Adapte old template to Joomla4 /documentation/tutorials-english/69-templating-module-plugin-content/757-adapte-old-template-to-joomla4.html

Hi after update you can have some error on old custom template, that normal your code need to be update for joomla4

 in item.php or item_html5.php

In Joomla 3 

find

JFactory::getDocument()->addScriptVersion(JUri::base(true).'/components/com_flexicontent/assets/js/tabber-minimized.js', FLEXI_VHASH);
JFactory::getDocument()->addStyleSheetVersion(JUri::base(true).'/components/com_flexicontent/assets/css/tabber.css', FLEXI_VHASH);
JFactory::getDocument()->addScriptDeclaration(' document.write(\'<style type="text/css">.fctabber{display:none;}<\/style>\'); ');  // temporarily hide

find
JRequest::getCmd('print'))

 

 In Joomla 4 remplace it for

find

JFactory::getDocument()->addScript(JUri::base(true).'/components/com_flexicontent/assets/js/tabber-minimized.js', array('version' => FLEXI_VHASH)); JFactory::getDocument()->addStyleSheet(JUri::base(true).'/components/com_flexicontent/assets/css/tabber.css', array('version' => FLEXI_VHASH)); JFactory::getDocument()->addScriptDeclaration(' document.write(\'<style type="text/css">.fctabber{display:none;}<\/style>\'); '); // temporarily hide the tabbers until javascript runs

find
JFactory::getApplication()->input->getCmd('print')