xoops forums

geekwright

Quite a regular
Posted on: 6/6 12:39
geekwright
geekwright (Show more)
Quite a regular
Posts: 218
Since: 2010/10/15
#1

XOOPS 2.5.9 Notes for Theme Creators

This is a quick overview of some new things that are introduced in XOOPS 2.5.9 that Theme Creators should know about.

Form Renderer

In XOOPS 2.5.9 we have added a XoopsFormRenderer class, and a XoopsFormRendererInterface interface. The XoopsFormRendererInterface defines the final stage of form rendering, allowing the elements to be tailored to better adapt to the theme. XOOPS 2.5.9 ships with two implementations, XoopsFormRendererLegacy which matches the traditional XOOPS form rendering, and XoopsFormRendererBootstrap3 which uses Bootstrap classes to declare the form elements.

By default, XOOPS 2.5.9 will use the Legacy renderer. A theme can choose to use the Bootstrap3 renderer by including a file named theme_autorun.php in its top directory, as is done in the xbootstrap theme, containing the following:

<?php
xoops_load
('XoopsFormRendererBootstrap3');
XoopsFormRenderer::getInstance()->set(new XoopsFormRendererBootstrap3());


New Smarty variables added in XOOPS 2.5.9


$xoops_page contains a condensed version of the current page name. For example, for http://myurl/index.php, $xoops_page would be "index". For http://myurl/modules/profile/edituser.php, $xoops_page would be "profile/edituser".

$xoops_startpage contains the module configured as the start page, or "system" if no module is selected.

A "rendered" key is now set by XoopForm assign() method

Some scripts use the assign() method as an alternative to the display() method. This method assigns the form details to a stem variable named with the form's name. This assignment is done with code that looks like this:

$form->assign($GLOBALS['xoopsTpl']);

This technique has often been done to give the theme more control over the display of the form. It requires the template to loop through the individual form elements, and decide how to display it. This level of control is good if you need it, but can be a nuisance if you just want to position the form inside the page, and you would prefer the system to handle the details.

As of XOOPS 2.5.9, when the program uses the $form->assign() method, an additional stem variable, 'rendered', will be available. Instead of iterating over the 'elements' portion to build the form from pieces, you can simply display 'rendered' to use the system provided rendering:

<{$form_item.rendered}>



Compatibility Breaks

Changes needed to existing profile module override templates

In the profile module, the profile_userinfo.tpl template creates an entire form to provide an activate/deactivate user button. Unfortunately, this form should have a security token. You can see an example of this in the XOOPS 2.5.9 htdocs/modules/profile/templates/profile_userinfo.tpl file at line 54:

<{securityToken}>


Without this change, the button will not work in XOOPS 2.5.9. We try to avoid this kind of compatibility break, but in this case it is necessary.

Bleekk

Theme Designer
Posted on: 6/7 2:27
Bleekk
Bleekk (Show more)
Theme Designer
Posts: 898
Since: 2002/12/14
#2

Re: XOOPS 2.5.9 Notes for Theme Creators

Thank you!
These are really good news that the forms are now bootstrap ready. The new smartys will also help a lot.

One question:
Is it possible to create a way so users can add blocks to a module without changing the module itself.
Wenn I work on a website I often add new blocks to a module but I always then need to change the module to get these blocks to work.
It would be nice if there would be a way to only upload block.php and a template to the module, and the module would be extended by these blocks.

geekwright

Quite a regular
Posted on: 6/7 11:08
geekwright
geekwright (Show more)
Quite a regular
Posts: 218
Since: 2010/10/15
#3

Re: XOOPS 2.5.9 Notes for Theme Creators

Quote:

Bleekk wrote:
...
Is it possible to create a way so users can add blocks to a module without changing the module itself.
...


That sounds very useful. I'll give that some thought, and see what we could do to implement that.

heyula

Theme Designer
Posted on: 6/8 0:56
heyula
heyula (Show more)
Theme Designer
Posts: 428
Since: 2008/4/24
#4

Re: XOOPS 2.5.9 Notes for Theme Creators

It would be amazing.

aerograf

Not too shy to talk
Posted on: 6/11 11:47
aerograf
aerograf (Show more)
Not too shy to talk
Posts: 144
Since: 1/7 14:01
#5

Re: XOOPS 2.5.9 Notes for Theme Creators

Is there an updated XOOPS documentation describing the built-in codes and functions?

geekwright

Quite a regular
Posted on: 6/12 14:52
geekwright
geekwright (Show more)
Quite a regular
Posts: 218
Since: 2010/10/15
#6

Re: XOOPS 2.5.9 Notes for Theme Creators

Not yet, just this change notification.

Quote:

aerograf wrote:
Is there an updated XOOPS documentation describing the built-in codes and functions?

aerograf

Not too shy to talk
Posted on: 6/12 15:09
aerograf
aerograf (Show more)
Not too shy to talk
Posts: 144
Since: 1/7 14:01
#7

Re: XOOPS 2.5.9 Notes for Theme Creators

Thanks for the answer.
It's a pity that there is not. Will wait.

geekwright

Quite a regular
Posted on: 6/12 16:31
geekwright
geekwright (Show more)
Quite a regular
Posts: 218
Since: 2010/10/15
#8

Re: XOOPS 2.5.9 Notes for Theme Creators

We do accept offers of help

Quote:

aerograf wrote:
Thanks for the answer.
It's a pity that there is not. Will wait.