1
Hi, I'm trying to debug an issue with a module that is in beta. My module uses mod_rewrite to provide clean(er) urls. Because of this every time I include a file I use the full path.
example
// I always use this
include_once(XOOPS_ROOT_PATH.'/modules/include/mycommon.php');
// I don't use this
include_once('include/mycommon.php');
The problem comes in when I want to pass along the full path to a file which will then be included at the template stage.
probably best to use another example
// In my module code I want to change the template
if ( $cart_items > 0 )
{
$my_template = 'cart_contents.html';
}
else
{
$my_template = 'featured_products.html';
}
// Now I assign this to a smarty variable
$xoopsTpl->assign('my_template',
XOOPS_ROOT_PATH."/modules/noah/templates/pages/".$my_template);
---------------------------------
// Then in my smarty template
---------------------------------
<{include file=$my_template}>
This works fine when running on unix/apache and seems to cause problems when running on windows/apache. I think this might be because windows and unix path strings are formatted differently, but I'm not smart enough to confirm this :)
hmmm, is this perhaps an issue of better code organization? As in, should I be making sure that everything happens before..
include(XOOPS_ROOT_PATH.'/header.php');
.. so that I can then dynamically assign
$xoopsOption['template_main'] = 'main.html';
?? anyone have suggestions?
Forum thread with some more background