Categories > TinyButStrong general >

Problem array in a load box

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: jqturo
Date: 2014-08-06
Time: 01:09

Problem array in a load box

Hi, sorry for my english, i'm french,

Since 5years, i  have been used tbs 3.2.0, and i updated to 3.9.0 2 hours ago.
So i have a new problem, this is:
In my code php i have:
$_render = array();
$_render['path_menu'] = "game/template/block/menu.block.html";
In my html template i have
<div>[var._render.path_menu]</div>[onload;file=]
No problem for now, it's print me "game/template/block/menu.block.html",
but now when i put this
<div>[onload;file=[var._render.path_menu]]</div>

TinyButStrong Error in field [var._render.path_menu...]: item 'path_menu' is not an existing key in the array. This message can be cancelled using parameter 'noerr'.

I dont understand, why tbs cannt find path_menu....
Can you help me please ? I'm trying upgrade my tbs code 3.2.0 to 3.9.0,  not easy, thanks you
By: Skrol29
Date: 2014-08-06
Time: 02:04

Re: Problem array in a load box

Bonjour Jqturo,

[var] fields such as [var._render.path_menu] are the same as [onshow] fields.
[var._render.path_menu] should be converted into [onshow._render.path_menu].
Or [onload;file=[var._render.path_menu]] should be replaced with [onshow;file=[var._render.path_menu]]

The point is that [onload] fields are merged during LoadTemplate(). While [onshow] are merged during Show().
So if your global variable $_render is defined between LoadTemplate() and Show() then it cannot be merged during LoadTemplate() because this not set at this time.