Quote:
the website is no longer available but i managed to backup it from archive.org
i like this method because we can use it in php block...where trabis defacer anywhere block can only be use in theme.html or smarty template
----------------------------------------------------------------------
How to display a dynamic content in yoaur theme (outside Xoops blocks) ? - Xoops Tips - News
Xoops Tips : How to display a dynamic content in yoaur theme (outside Xoops blocks) ?
Posted by Herve on 2007/8/25 19:39:06 (383 reads) News by the same author
In a previous article, I was talking to you of the release of one of my modules, Boox, with which you can manage static content which is not approachable by Xoops.
The module is very useful but for this moment you can't manage dynamic content.
It could be useful if you could put in your site's theme, the content from any Xoops module.
I'm showing you a solution on which I have worked.
Before all, please don't ask me how to do it for any other Xoops module, search by yourself, it's more interesting
and it's not hard
A customer for which I am working, wanted to display partners (from the Xoops Smartpartner module) inside the header of his site.
This header does not contains Xoops blocks and this last can't display blocks to this place.
After I had imagine many solutions, I have decided to keep the partners modules so that my customer works in a user interface he used to see.
So, partners are created and managed from the Xoops backoffice, inside the SmartPartner module, but it's another solution which will display partners.
In fact, I'm going to bringback the module's block content !
1/ First, set the block's parameters from the Xoops blocks manager as if you wanted to use it "normally".
For this moment, set the block as visible (we will deactivate it later). In my case, I have set and display the block so show partners.
2/ Once you have done it, go in you database with, for example, PhpMyadmin,
and look at the content of the xoops_newblocks (replace xoops with the prefix you used during your website's installation)
Search for the visibles blocks, you can do it simply with a such query :
SELECT * FROM `xoops_newblocks` WHERE `visible` = 1
Then locate (with its name), the block you made visible in the point 1 and copy somewhere
the content of the field options, in my case it was :
1|0|1|1|id|DESC|1
Copy also the content of the following fields (I have wrote their name and their content) :
dirname : smartpartner
func_file : partners_list.php
show_func : b_partners_list_show
template : partners_block_list.html
3/ Go back in the Xoops blocs manager and hide the block you activated in the point 1
4/ Edit your theme (the file theme.html) and write this where you want to see the block's content :
Quote:
<{php}>
include XOOPS_ROOT_PATH.'/mainfile.php';
include_once XOOPS_ROOT_PATH.'/class/template.php';
include_once(XOOPS_ROOT_PATH.'/modules/smartpartner/blocks/partners_list.php');
$result = b_partners_list_show(explode('|','1|0|1|1|id|DESC|1'));
$tpl = new XoopsTpl();
$tpl->assign('block', $result);
$tpl->display('db:partners_block_list.html');
<{/php}>
The red parts must be replaced with the informations you get in the point 2
Don't forget to update your site (and may be to remove the content of the templates_c folder).
That's all !
---------------------------------------------------------------------------