0

I d trying get my menu module params (use default joomla menu_mod as base) into module.css.php file. However after multiple researches and tryings still no success.

Inline in tmpl/defaulp.php works like a charm, but cause there will be a lot of css, I would prefer to have it in a css file.

The mostly near solution where i didnt get any error, but params was also empty found in this topic: Can't pass params to external php file

So my current code, related to this topic, is: default.php:

defined('_JEXEC') or die('Restricted access');

require_once 'modules/mod_offcanvas_menu/assets/css/offcanvas_menu.css.php';

offcanvas_menu.css.php:

define('_JEXEC', 1);
define('JPATH_BASE', realpath(dirname(__FILE__) . '/../../../../'));  
require_once JPATH_BASE . '/includes/defines.php';
require_once JPATH_BASE . '/includes/framework.php';

$app = JFactory::getApplication('site');
$app->initialise();

jimport( 'joomla.application.module.helper' );
$module = JModuleHelper::getModule('mod_offcanvas_menu');

$registry = new JRegistry();
$params = $registry->loadString($module->params);

$title_color= $params->get('menu_title_color');

echo 'My color: ' . $title_color;

But it deliver an empty result.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.