1
ziwman
how to add a BLOCK to a an existing module
  • 2008/11/28 19:49

  • ziwman

  • Just popping in

  • Posts: 16

  • Since: 2008/11/28


Hello,
so, my request was to create a new block in a module (xoopstube, mytube). i had choice to make a simple XOOPS custom block, but my content should be dynamique, and it's so complicated so i've prefered to add a Block to module MyTube

steps :
[size=x-large]1[/size]
$modversion['blocks'][11]['file'] = "mytube_block_home.php";
$modversion['blocks'][11]['name'] = _MI_XTUBE_BNAME20;
$modversion['blocks'][11]['show_func'] = "mytube_home_block_top_show";
$modversion['blocks'][11]['description'] = "Show Home Page Video";
$modversion['blocks'][11]['template'] = 'mytube_block_home.html';
$modversion['blocks'][11]['can_clone'] = true ;


i've created files : mytube_block_home.php & mytube_block_home.html

[size=x-large]2[/size]
added _MI_XTUBE_BNAME11 equivalence in language file of module mytube

[size=x-large]3[/size]

i created an empty function function
mytube_home_block_top_show()
{
}

in mytube_block_home.php
and i've let template file mytube_block_home.html empty too

[size=x-large]4[/size]
module updated, block installed, i can find in bloc administration. permission and every thing ! but when i activate it (show = yes) i have nothing in my website ! no title, no bloc, in DEBUG MODE, XOOPS don't made request to bring up the block !!
any idea !!!!

ps : excuse my bad english, i come from French XOOPS Community ... frxoops.org becomes really so bad and commercial .. that i prefere learn english to come here ! we love xoops. heuumm !!! i'm the maker of Message Icon used in xoops.org :p Resized Image Resized Image Resized Image

2
Mamba
Re: how to add a BLOCK to a an existing module
  • 2008/11/28 21:34

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


While I don't have an answer to your issue, I just wanted to say "Welcome to XOOPS" and thank you so much for your icons!!! They are very nice! Well, if they wouldn't be - we would not use them here

Anyway, welcome to XOOPS community!
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

3
stefan88
Re: how to add a BLOCK to a an existing module
  • 2008/11/28 21:53

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Quote:
any idea !!!!


Why not try to add some content (text) to the template and echo something from the show function too...?

Also make shure the numbering is corect (consecutive) and check the spelling.

EDIT:

for example: Quote:
2
added _MI_XTUBE_BNAME11 equivalence in language file of module mytube


Why not _MI_XTUBE_BNAME20

as in:

Quote:
$modversion['blocks'][11]['name'] = _MI_XTUBE_BNAME20;
..

4
trabis
Re: how to add a BLOCK to a an existing module
  • 2008/11/28 22:06

  • trabis

  • Core Developer

  • Posts: 2269

  • Since: 2006/9/1 1


The block will only display if the block function does not return empty/false.

Try:
function mytube_home_block_top_show()
{
    return 
true;
}



5
McDonald
Re: how to add a BLOCK to a an existing module
  • 2008/11/29 1:29

  • McDonald

  • Home away from home

  • Posts: 1072

  • Since: 2005/8/15


Just as the above replies say, no content = no block.
Even the Recent Videos block doesn't appear when there are no videos added to MyTube.

6
ziwman
Re: how to add a BLOCK to a an existing module
  • 2008/11/29 17:43

  • ziwman

  • Just popping in

  • Posts: 16

  • Since: 2008/11/28


Hello MY DARLING, pls, bring some tea (moroccan VODKA lol) come all you XOOPS MEMBERS :p !

[size=x-large]IT WORKS[/size]
[size=xx-small]i'm juste a bad developper, a loooser :p[/size]

THANK YOU TRABIS for your solution !
function mytube_home_block_top_show()
{
    return 
true;
}

returning the function answer :)

THANK YOu, it's now time to break a leg ! i say, to developpe a block who bring 5 videos from a random categorie ! show the first video with player (custom player) and links to other 4 videos ! a home page block (like on :http://maktoob.com)
i'll be back if i found any problem
Thank youu so much ;)

7
sailjapan
Re: how to add a BLOCK to a an existing module

Don't forget to share the code when you're finished
Never let a man who does not believe something can be done, talk to a man that is doing it.

8
ziwman
Re: how to add a BLOCK to a an existing module
  • 2008/11/29 21:49

  • ziwman

  • Just popping in

  • Posts: 16

  • Since: 2008/11/28


OK MAN :p
i will !!! it's a XOOPS user promise.
i thank that we can also made an url rewriting for module MyTube !
any way, wait for news.
THANK YOU SO MUCH

9
ziwman
Re: how to add a BLOCK to a an existing module
  • 2008/12/4 17:39

  • ziwman

  • Just popping in

  • Posts: 16

  • Since: 2008/11/28


Resized Image


Hello everyone !!!
so, i have good news, I fixed the probleme, and did the work :p
so you can see it at :http://www.hillow.net the first Right Bloc.
the block is integrated to MyTube Module. now, without editing options .. it brings a random video from DB and show 4 others Videos from the same category of the first generated Video.
not a professional work but the important is that it works well !
ps : you can see it, i did an url rewriting in the bloc ... we will make the url rewriting in all the module sooner.

ps 2 : the website hillow.net is still on BETA VERSION.
;) Thank youuuu

10
sailjapan
Re: how to add a BLOCK to a an existing module

Hi ziwman,
nice hack!

Can I suggest you contact McDonald (MyTube's caretaker) and offer him the code for your block? He might like to include it in a new release...
just an idea.
Never let a man who does not believe something can be done, talk to a man that is doing it.

Login

Who's Online

172 user(s) are online (118 user(s) are browsing Support Forums)


Members: 0


Guests: 172


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits