Search code examples
phphtmltinybutstrong

TBS onload after update from 3.10.1 to 3.14.0 causes errors - how to get rid of?


I'm currently struggling with error messages from TBS and couldn't find any hint on change log or elsewhere.

So far we've been using TBS 3.10.1 with PHP7, now I'm trying to update to actual TBS 3.14.0 with PHP8. The output is generated using TBS with subscripts, where file a.html is loading a subscript file b.inc.html (the sources given below are not complete, rather explaining the dependency structure):

`
<html lang="[var.cfg.language]">
<head>
  [onload;file=lib/head.inc.html]
  <title>[var.oem.title]</title>
</head>

<body>
  <div>
    [onload;script=lib/b.inc.html;subtpl;getpart=begin]

    <div class="layout">
      some body...
    </div>

    [onload;script=lib/b.inc.html;subtpl;getpart=end]
  </div>
</body>
</html>
`

This inserted file b.inc.html is loading subscripts itself, too. There are onload directives inserting a few more '3rd level' files as subscripts and also onload blocks depending on global PHP variables. In summary there are 11 onload directives in that file b.inc.html:

`
<begin>
  <h1>[var.oem.title]</h1>
  <div>

  [onload;script=lib/e.inc.html;subtpl]

  [onload;block=begin;when [var.GlobalVar;noerr] != 0]
  &nbsp;more text...
  [onload;block=end]

  <div>
    <ul>
      [onload;script=lib/menu.inc.php;subtpl]
    </ul>
  </div>

  [onload;script=lib/f.inc.html;subtpl]

  </div>
</begin>

<end>
  <div>
    [onload;script=libjs/g.inc.html;subtpl]
    [onload;script=libjs/h.inc.html;subtpl]
  </div>
</end>
`

I figured out that the option 'scripts_allowed' hat to be set true for the TBS object in PHP with TBS 3.14.0 and as the result looks like, everything seems to work fine.

`
$TBS = new clsTinyButStrong;
$TBS->SetOption('old_subtemplate', true);
$TBS->SetOption('scripts_allowed', true); 
`

The only problem is I get 11 error messages 'TinyButStrong Error in field [onload...]: it doesn't have any subname.'. I am pretty sure these are caused by the 11 onload directives in file b.inc.html since they are gone if I append a subname like 'onload_test', but then they aren't executed anymore and the complete onload directive appears in the output.

I would expect a 'silent' processing of these onload directives since they seem to work as before with TBS 3.10.1. So what's the trick to get rid of these error messages?

Any help is appreciated. Georg


Solution

  • This is a bug in TBS that can occurs when using sub-templates containing automatic fields. TBS does not process automatic fields correctly in the sub-template.

    This bug is fixed as of TBS version 3.15.0-beta-5. You can have it at GitHub.

    You can patch TBS version 3.14.0 simply by adding or editing the lines concerned with the variable $IsTpl which has been added in version 3.15.0-beta-5.

    Tanks for reporting this issue.