1
jurgis
error trying to clone a block
  • 2004/2/9 13:22

  • jurgis

  • Just popping in

  • Posts: 72

  • Since: 2003/3/20


ok, I just want the same block on the left column just in other modules.

so I:
1) copy templates/blocks/block.html -> block_clone.html
2) edit in xoops_version (for the sake of clearer understanding - news)
$modversion['blocks'][5]['file'] = "news_top.php";
$modversion['blocks'][5]['name'] = _MI_NEWS_BNAME5."_clone";
$modversion['blocks'][5]['description'] = "Shows recent articles"."_clone";
$modversion['blocks'][5]['show_func'] = "b_news_top_show";
$modversion['blocks'][5]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][5]['options'] = "published|10|25";
$modversion['blocks'][5]['template'] = 'news_block_new.html';

3)update Module

4) go to Admin->System->templates... News -> see a new block in yellow - press "Generate" and get
"Selected file does not exist)" in red

I also tried Uploading it instead of Generating, but then i got Template file news_block_top_clone.html does not need to be installed (PHP files using this template file does not exist).

maybe I shoud read wiki, but I think I'am quite close to doing things well, just dont know some little thing.. please help or link

2
chapi
Re: error trying to clone a block
  • 2004/2/9 13:47

  • chapi

  • Theme Designer

  • Posts: 611

  • Since: 2002/1/22


You also have to clone the PHP file of your block, e.g. news_top.php -> news_top_clone.php and define this file in the first line of the blockinfo in your xoops_version.php.

3
jurgis
Re: error trying to clone a block
  • 2004/2/9 21:29

  • jurgis

  • Just popping in

  • Posts: 72

  • Since: 2003/3/20


fanx, it helped (at least to go on the ridht way).
and it's not the issue of unique file but of unique function. Because I kept getting "Cannot redeclare b_news_top_show() " untill
I tried to make a wrapper- show and edit functions, like

function b_news_top_show2(($options)) {
b_news_top_show($options);
}

and then assign them. and it worked :).
but only when I reinstalled the module, updates still showed templates generation errors and similar stuff. (maybe, because my testing/hacking site is on XOOPS 2.0)


but I see in news v1.13
the same file and functions for "top read .." and "recent .." blocks
Quote:

$modversion['blocks'][3]['file'] = "news_top.php";
$modversion['blocks'][3]['name'] = _MI_NEWS_BNAME4;
$modversion['blocks'][3]['description'] = "Shows top read news articles";
$modversion['blocks'][3]['show_func'] = "b_news_top_show";
$modversion['blocks'][3]['edit_func'] = "b_news_top_edit";
$modversion['blocks'][3]['options'] = "counter|10|25";
$modversion['blocks'][3]['template'] = 'news_block_top.html';

$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';

I am still curious
I looked at wiki HackABlock, but its about some other aspects..
fanx in adwance 4any1 who calms my curiosity

4
jfebus
Re: error trying to clone a block
  • 2004/9/9 12:45

  • jfebus

  • Just popping in

  • Posts: 97

  • Since: 2004/9/1 1


Hi All,

After updating xoops_version.php with
$modversion['blocks'][10]['file'] = "wfs_random.php";
$modversion['blocks'][10]['name'] = "random";
$modversion['blocks'][10]['description'] = "Shows random articles";
$modversion['blocks'][10]['show_func'] = "b_wfs_random_show";
$modversion['blocks'][10]['edit_func'] = "b_wfs_new_edit";
$modversion['blocks'][10]['options'] = "published|10|19|1|1|1|1|100";
$modversion['blocks'][10]['template'] = $wfsTemplates['newartblock'];


and uploading:
wfs_random.php to /modules/wfsection/blocks/
wfs_block_random.html to /modules/wfsection/templates/blocks/

and updating the module I am getting :
"Selected file does not exist)"

Any Ideas?

Best Regards,

5
MIchaelMcA
Re: error trying to clone a block
  • 2005/12/20 20:49

  • MIchaelMcA

  • Just popping in

  • Posts: 13

  • Since: 2005/5/1 1


Here's a solution, not quite an answer: I can fix it, but I don't know what the problem was.

I was having the same problem. I had all the correct files in place and references were correct etc. so after triple checking everything, I decided that I would copy files for a block from the news module along with it's template and xoops_version.php entry to the respective directories of the module where i wanted to create the new block.

Then, slowly, one by one I changed each of the variables in xoops_version.php to point to the files, and say the corrent words for my new module - un-installing and re-installing the module each time I made a change. I thought like this, I would be able to pin point the problem, but I couldn't! but it works!! so who cares?!

Well, it is bugging me actually, but I'll get over it one day.

Hope that helps someone!

Michael

Login

Who's Online

350 user(s) are online (219 user(s) are browsing Support Forums)


Members: 0


Guests: 350


more...

Donat-O-Meter

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

Latest GitHub Commits