1
Ploutonakos
Template Generation Problem

I make a block template (html file) in system/templates/blocks. Then, I go to template set manager where the new file is highlighted. I press generate and it says: "Selected file does not exist)"
Is there something I do wrong>? Maybe I have to do something else first (like, for example, add some lines of code somewhere?) ? Any help will be appreciated

2
TottoBG
Re: Template Generation Problem
  • 2005/11/15 20:02

  • TottoBG

  • Not too shy to talk

  • Posts: 111

  • Since: 2005/8/18


Hi Ploutonakos,
You have to edit the xoops_version.php file that is in your module directory - the one you're adding template to. In that file you'll find some line that are like
$modversion['templates'][i]['file'] = 'xxx.html';
$modversion['templates'][i]['description'] = '';

Add the same two lines to the bottom with next num (i) that is free, i.e. an index number for you template for this module, and the new template name on the place of 'xxx.html'. Then upload xoops_version.php back to the server and go to the administration area of your system to update the module. That is. When you do it all an information that there's some new template will be added to the DB, so when you press 'Generate' next to the new template name after that it will be generated.
Good luck!

3
Ploutonakos
Re: Template Generation Problem

You 're talking about templates...
In blocks I assume i have to do something like this:

$modversion['blocks'][i]['file'] = "xxx.php";
$modversion['blocks'][i]['name'] = _MI_"module"_BNAMEz;
$modversion['blocks'][i]['description'] = "desc";
$modversion['blocks'][i]['show_func'] = "????";
$modversion['blocks'][i]['template'] = 'xxx.html';



or something else?

4
TottoBG
Re: Template Generation Problem
  • 2005/11/15 21:29

  • TottoBG

  • Not too shy to talk

  • Posts: 111

  • Since: 2005/8/18


Oh, my mistake, sorry. It should be what you've already found althought I haven't tried it. Each block template is connected to the respective block that is using it, so in that lines you've found now the
$modversion['blocks'][i]['template'] = ...

line should be preserving place for the block template.

5
Ploutonakos
Re: Template Generation Problem

Still can't catch up with you...

6
Ploutonakos
Re: Template Generation Problem

Ok... I searched the whole thing a little bit, so here are my results:
- If you want to make a block template, firstly, you should change the xoopsversion.php of the module you are going to use (if you want a general block use system module)
- Copy the last block section in xoopsversion.php and paste it just below, changing: $modversion['blocks'][i] to $modversion['blocks'][i+1] in each one of the option lines.
- SOme explanations for the parameters (not so sure but if I'm wrong correct me):
1) File: the php file that the block should use to withdraw it's variables
2) Name: _MI_"modulename"_BNAME(i+1) (this is typically the form of the name, i don't know if it's necessary to be like this)
3) Description: Your description about the block enclosed in double quotes
4) show_func: (not tested) I believe this is a function from "File" whose results will be in the block. (i believe this is optional)
5) template: The html file that will generate the block's appearance
6) options: (not so sure again) Options for the function that was retrieved with "show_func" (-=optional=-)
7) edit_func: I don't know what exactly this does but it is optional either way.


Request: Please correct my mistakes in a post so as not to mess things up... Thanks in advance

7
TottoBG
Re: Template Generation Problem
  • 2005/11/16 21:10

  • TottoBG

  • Not too shy to talk

  • Posts: 111

  • Since: 2005/8/18


That's it!
Quote:
- If you want to make a block template, firstly, you should change the xoopsversion.php of the module you are going to use (if you want a general block use system module)
- Copy the last block section in xoopsversion.php and paste it just below, changing: $modversion['blocks'][i] to $modversion['blocks'][i+1] in each one of the option lines.

At least the way I understand it. And now lets try to figure out the thing with parameters:
Quote:
1) File: the php file that the block should use to withdraw it's variables

Something like this here. Everything thay needs to be initialized for the block comes from this file.
Quote:
2) Name: _MI_"modulename"_BNAME(i+1) (this is typically the form of the name, i don't know if it's necessary to be like this)

It's just the constant name that the system will use for this block. You have to give it a text name in your module/language/yourlanguage/modinfo.php file, sth like
Quote:
define('_MI_MODULENAME_BLOCKNAME','Title of your block');

i.e. just add such a line there (you'll find similar already defined for the other available blocks). This is the name of the block that will appear in your admin's blocks list.
Quote:
3) Description: Your description about the block enclosed in double quotes

I'm missing where this description comes for, but at least it's just block description
Quote:
4) show_func: (not tested) I believe this is a function from "File" whose results will be in the block. (i believe this is optional)

I don't think it's optional, cause I find it for every other module's block I look at now. So the .php file we already mentioned in 1) just defines it in itself and it's called so the block to be visualized.
Quote:
5) template: The html file that will generate the block's appearance

OK, so we came with it from the real begining and no questions come here I think .
Quote:
6) options: (not so sure again) Options for the function that was retrieved with "show_func" (-=optional=-)

You can find in some of the other blocks that they has some options for themselves, some values that they use in their visualization. So this field just defines the default options values delimeted by '|' I think.
Quote:
7) edit_func: I don't know what exactly this does but it is optional either way.

Like we had show_func for showing the block here we have edit_func it seems for editing . But I'm not sure the way it is used, have to look around.
Hey, it came long but it's at the end now . Hope we've cleared things for ourselves now. Good luck!

8
Ploutonakos
Re: Template Generation Problem

Tnx a lot man! I had really missed the modinfo.php file thing. As for the description, it appears in Templates section of system module, where you generate new templates.
C u around...

9
TottoBG
Re: Template Generation Problem
  • 2005/11/17 18:56

  • TottoBG

  • Not too shy to talk

  • Posts: 111

  • Since: 2005/8/18


You are right man But see it's not impossible for a Greek and Bulgarian to understand each other
Good luck!

Login

Who's Online

257 user(s) are online (179 user(s) are browsing Support Forums)


Members: 0


Guests: 257


more...

Donat-O-Meter

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

Latest GitHub Commits