1
lostntime
Is it possible to clone blocks?
  • 2004/5/16 5:13

  • lostntime

  • Just popping in

  • Posts: 2

  • Since: 2004/5/14


I would like to be able to clone my "recent news" block and and have it show up twice on the same page. is this do-able?

2
zoullou
Re: Is it possible to clone blocks?
  • 2004/5/16 7:13

  • zoullou

  • Quite a regular

  • Posts: 250

  • Since: 2004/3/2 0


I think it's possible. You must modify the xoops_version.php of the news's module.

3
Mithrandir
Re: Is it possible to clone blocks?

I would say so.

News 1.2 has two blocks set in xoops_version.php, but they both use the same file and the same function in that file.

This is because there are both most recent posts and top posts, which is more or less the same SQL query and exactly the same presentation. A toggle in the block preferences is all that it takes to change it from one to the other - but since it can be useful to have both ways displayed, the block is by default cloned like that.

As long as you are in the same module, you should be able to make exact clones just by adding to xoops_version.php - block preferences will still be distinguished between the blocks, so they can have totally different preferences, show completely different things, but still basically be the same block.

4
falke
Re: Is it possible to clone blocks?
  • 2004/5/16 20:27

  • falke

  • Friend of XOOPS

  • Posts: 158

  • Since: 2004/4/25


Where can I find this 1.2 version of news? Isnt it 1.1 that is included with XOOPS version 2.06

5
Mithrandir
Re: Is it possible to clone blocks?

News v1.2 is still in a beta version, but is available on dev.xoops.org

6
vagelis
Re: Is it possible to clone blocks?
  • 2005/6/7 10:56

  • vagelis

  • Just popping in

  • Posts: 79

  • Since: 2004/9/5 5


Dear Mithrandir,

Can you please give to us an example how to clone the news_block_new.html in News module v.1.21?

We want to have two blocks in our first page with news from different categories in each one block.


Thank you very much.

7
pod
Re: Is it possible to clone blocks?
  • 2005/6/7 11:33

  • pod

  • Quite a regular

  • Posts: 301

  • Since: 2003/4/19


I think what Mithrandir is saying is that if you open the xoops_version.php file of any module, and copy the code for a block, changing the variable number and name of the block, you can essentially clone a block.

If you open the xoops_version.php of the News module I have handy (says its 1.1), lines 63 through 89 have the block data. If you find the last one, it reads:
$modversion['blocks'][4]['file'] = "news_top.php";
$modversion['blocks'][4]['name'] = _MI_NEWS_BNAME5;
$modversion['blocks'][4]['description'] = "Shows recent articles";
$modversion['blocks'][4]['show_func'] = "b_news_top_show";
$modversion['blocks'][4]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][4]['options'] = "published|10|25";
$modversion['blocks'][4]['template'] = 'news_block_new.html';


So to effectively clone that block, you would copy that, paste the code underneath it, change all the 4s to 5s and change _MI_NEWS_BNAME5 to "My Block Title", & by Mith's logic that should work, if I read him right.

Hope this helps.

8
Mithrandir
Re: Is it possible to clone blocks?

That is what I meant, yes.

However, all this is unnecessary when XOOPS 2.2 is out (approx. 3-4 weeks left) where you can instantiate as many blocks of the same type as you want.

9
vagelis
Re: Is it possible to clone blocks?
  • 2005/6/7 12:42

  • vagelis

  • Just popping in

  • Posts: 79

  • Since: 2004/9/5 5


It works fine. Thank you very much at all, Mithrandir and Pod.

Login

Who's Online

159 user(s) are online (132 user(s) are browsing Support Forums)


Members: 0


Guests: 159


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