Im trying create module for joomla 2.5 but i have error need everyone help me. I have scripts in tmpl/default.php file:
defined('_JEXEC') or die;
$baseurl = JUri::base();
$module_names="modules/mod_mymodule/assets";
$url=$baseurl.$module_names;
$module_id= $module->id;
$document = JFactory::getDocument();
$document->addStylesheet($module_names.'/css/css.css.php?module_agallery_id1='.$module_id);
$document->addStylesheet('modules/mod_mymodule/tmpl/css.css.php?module_agallery_id='.$module_id);
And in css.css.php file i want get value of "module_gallery_id" in $document->addStylesheet above. I tried use like this in css.css.php file but i can not get module_agallery_id. please see code bellow in my css.css.php file:
header("Content-type: text/css; charset: utf-8");
echo $mid = $_GET['module_agallery_id']; // i can't get this
Everyone know it please let me know. I'm working on joomla 2.5.x.
Thank you so much and Best Regards
Try this,
I think you're totally confused with style sheet adding system of Joomla. You can work like this way. your css.css.php
is a php
file so why are you trying to add to the header.
keep the file as php
and include that to the module.
In your css.css.php
file have the following code.
$doc = JFactory::getDocument();
echo $module_id;
//If you need to add custom css on this page try like.
$css_styles = '.my_testclass{color:#FFF;}';
$doc->addStyleDeclaration($css_tyles);
Then On your module file instead of adding style sheet include the page like below.
$module_names="modules/mod_mymodule/assets";
require_once(JPATH_SITE.'/'.$module_names.'/css/css.css.php');
Hope it helps..
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.