I'm writing this here because if think it's a bit long for a "comment".
Here's the way I managed to hack to kernel so my templates can be fetched from the filesystem instead of the db. It's a bit tricky and should only be used for dev purposes but it worked for me, and I think being able to edit template files using your fav editor is much faster than having to go through the admin interface each time you want to change one line.
- Change Xoops 'footer.php' file (within site root dir) using the code I put at the end of this comment.
- Create a 'templates' folder inside your current theme folder, and copy your tpl files there
- Remove the 'db:' prefix from the template name in you module pages
$xoopsOption['template_main'] = 'pskrecord_pg_index.tpl';
- If your template includes other ones, ensure you don't use the 'db:' prefix, but do it like this:
<{include file="$xoops_theme/templates/pskrecord_vw_labels.tpl"}>
Now the tpl files will be fetched from the 'templates' dir. Once you've finished working on them, you just have to do a global replace on all you files changing "$xoops_theme/templates/" to "db:"
Told you it was tricky... Maybe there's a better way, but it didn't manage to find it (already had to scratch my head a lot for this one). I believe it can be enhanced by hacking another part so we don't have to use the "$xoops_theme" string for includes, but I stopped at this point, at it was enough for my needs.
There's an option in xoops prefs that tells it just does that, but I never managed to make it work...
Hope it can help some of you...
Skalpa.>
Here's the code to change in footer.php (aroud line 50):
-
// RMV-NOTIFY
- include_once XOOPS_ROOT_PATH . '/include/notification_select.php';
- if (isset($xoopsOption['template_main'])) {
- if (isset($xoopsCachedTemplateId)) {
- $xoopsTpl->assign('xoops_contents',
- $xoopsTpl->fetch('db:'.$xoopsOption['template_main'],
- $xoopsCachedTemplateId));
- } else {
- // Skalpa-hack: Allow template fetching from filesystem
- if
- (file_exists(XOOPS_ROOT_PATH.'/themes/'.$xoopsConfig['theme_set'].'/templates/'.$xoopsOption['template_main']))
- $tpl_prefix=$xoopsConfig['theme_set'].'/templates/';
- else
- $tpl_prefix='db:';
- $xoopsTpl->assign('xoops_contents', $xoopsTpl->fetch($tpl_prefix .
- $xoopsOption['template_main']));
- }
Skalpa
Last edited on November 16, 2003 5:21 am.


![[Main Page]](/modules/mediawiki/images/mediawiki.png)





