1
geekwright
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:

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.

2
Bleekk
Re: XOOPS 2.5.9 Notes for Theme Creators
  • 2017/6/7 6:27

  • Bleekk

  • Theme Designer

  • Posts: 941

  • Since: 2002/12/14


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.

3
geekwright
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.

4
heyula
Re: XOOPS 2.5.9 Notes for Theme Creators
  • 2017/6/8 4:56

  • heyula

  • Theme Designer

  • Posts: 596

  • Since: 2008/4/24


It would be amazing.

5
aerograf
Re: XOOPS 2.5.9 Notes for Theme Creators
  • 2017/6/11 15:47

  • aerograf

  • Quite a regular

  • Posts: 214

  • Since: 2017/1/7 1


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

6
geekwright
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?

7
aerograf
Re: XOOPS 2.5.9 Notes for Theme Creators
  • 2017/6/12 19:09

  • aerograf

  • Quite a regular

  • Posts: 214

  • Since: 2017/1/7 1


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

8
geekwright
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.

9
alain01
Re: XOOPS 2.5.9 Notes for Theme Creators
  • 2019/11/2 14:05

  • alain01

  • Just can't stay away

  • Posts: 536

  • Since: 2003/6/20


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

Hi,
and now, if i use Bootstrap4, i used "xoops_load('XoopsFormRendererBootstrap3');" too ?

10
geekwright
Re: XOOPS 2.5.9 Notes for Theme Creators

There is a XoopsFormRendererBootstrap4 that will be included in 2.5.11 To use it now, either use the 2.5.11 alpha version, and the code looks like this:
xoops_load('XoopsFormRendererBootstrap4');
XoopsFormRenderer::getInstance()->set(new XoopsFormRendererBootstrap4());
or you can copy the file XoopsFormRendererBootstrap4.php into your theme's directory and use:
include_once 'XoopsFormRendererBootstrap4.php';
XoopsFormRenderer::getInstance()->set(new XoopsFormRendererBootstrap4());

Login

Who's Online

223 user(s) are online (186 user(s) are browsing Support Forums)


Members: 0


Guests: 223


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