xoops forums

loukaum

Just popping in
Posted on: 2018/3/23 0:20
loukaum
loukaum (Show more)
Just popping in
Posts: 93
Since: 2003/11/2
#1

Dummy block in Dummy module

Hello all,

For educational purpose, I'm trying to put a dummy block in a dummy module:

In a fresh installation of xoops 2.5.9, Instaled dummy module wich is basically an very simple module sample (Developed by Trabis).

Edited xoops_version.php, and put the lines at the end of file:

$modversion['blocks'][0]['file'] = "blocks/dummy_block.php";
$modversion['blocks'][0]['name'] = "Dummy";
$modversion['blocks'][0]['description'] = "A Dummy block"
$modversion['blocks'][0]['show_func'] = "b_dummy_block_show";


then created the folder blocks and the file dummy_block.php with the coontent:
<?php
function b_dummy_block_show () {
    
$moduleDirName basename(dirname(__DIR__));
    echo 
$moduleDirName;
}
?>


After module updated, could see it on admin/blocks section... enabled it and droped it on my center block, but not shows on the user side...

Where did I miss something?

iHackCode

Module Developer
Posted on: 2018/3/23 2:52
iHackCode
iHackCode (Show more)
Module Developer
Posts: 1035
Since: 2004/6/29
#2

Re: Dummy block in Dummy module

oh. this
$modversion['blocks'][0]['file'] = "blocks/dummy_block.php";

should be. this
$modversion['blocks'][0]['file'] = "dummy_block.php";

But if you want a block to appear you'll need a template.

ex:
$modversion['blocks'][0]['template'] = 'sometemplate.tpl';

https://xoops.gitbooks.io/kaotik-modul ... al/content/en/book/4.html

loukaum

Just popping in
Posted on: 2018/3/23 12:37
loukaum
loukaum (Show more)
Just popping in
Posts: 93
Since: 2003/11/2
#3

Re: Dummy block in Dummy module

Many Thanks! It worked fine.

Best regards!

mjoel

Quite a regular
Posted on: 2018/3/24 5:30
mjoel
mjoel (Show more)
Quite a regular
Posts: 272
Since: 2006/12/9
#4

Re: Dummy block in Dummy module

Maybe a new release of the new dummy module by trabis

just some suggestion to add

- dummy block with block template
- add two three pages..
- function add/edit delete
- able to find the pages through search.php
- submenus
- simple admin page

etc

it will be much easier for user

Mamba

Moderator
Posted on: 2018/3/24 8:38
Mamba
Mamba (Show more)
Moderator
Posts: 10749
Since: 2004/4/23
#5

Re: Dummy block in Dummy module

You can try using TDMCreate: https://github.com/txmodxoops/tdmcreate



Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs