Categories > TinyButStrong general >

a possible initialize PHP var solution (see revious post)

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: mielem
Date: 2003-07-20
Time: 12:51

a possible initialize PHP var solution (see revious post)

Dear Skrol29,

I made some experiment abaut the question of PHP var initializing and I found a solution making a little change in the tbs_Merge_PhpVar function.
I introduced a 'novar' parameter to switch off the var existence control.
It appears to work but I haven't analyzed every line of your class code and, of course, YOU are the author of TBS.
So I present it here.

This is the last part of the tbs_Merge_PhpVar function:

                if (array_key_exists($x,$_tbs_PhpVarLst)) {
                    if ($Key===False) {
                        $Pos = tbs_Locator_Replace($Txt,$Loc,$GLOBALS[$_tbs_PhpVarLst[$x]],$HtmlConv) ;
                    } else {
                        $Pos = tbs_Locator_Replace($Txt,$Loc,$GLOBALS[$_tbs_PhpVarLst[$x]][$Key],$HtmlConv) ;
                    }
                } else {               
                    if (!array_key_exists('novar',$Loc->PrmLst)) { // if 'novar' parameter is not set
                        tbs_Misc_Alert('Warning','Merge PhpVar','The field ['.$FieldName.'.'.$Loc->SubName.'] can not be merged because there is no corresponding PHP variable.') ;
                    } else { // if 'novar' parameter is set
                        $Pos = tbs_Locator_Replace($Txt,$Loc,$GLOBALS[$_tbs_PhpVarLst['']],$HtmlConv) ;
                    }               
                }
            }
        }
    } while ($Loc!==False) ;
}

What do you thonk about it?
By: Skrol29
Date: 2003-07-20
Time: 13:59

Re: a possible initialize PHP var solution (see revious post)

Hi Mielem,

I think it would be a good idea to be able avoid the 'non-existing variable' message.

It could be for one tag using you modification, or fo all tags using a global variable or a property.
By: mielem
Date: 2003-07-20
Time: 18:11

Re: a possible initialize PHP var solution (see revious post)

This means you will put it in the next TBS version? (I'd like to know this to begin using modified TBS without fear to be desynchronized with next version).

BTV:
1 - It's possible to become a TBS beta tester
2 - May I send you some more example of use of TBS, just to make the docs richer?

bye,
mielem (Mario Miele)
By: Skrol29
Date: 2003-07-20
Time: 22:05

Re: a possible initialize PHP var solution (see revious post)

That's ok to put the feature in the next version but I can't tell the solution yet (a special parameter like 'novar', or a global TBS variable).
I have to think about it (any argumentation is welcome).

1 : Yes you're welcome to be a beta tester :)
There is a thread with Mankiy about that in the 'Next version' forum.

2 : Yes, your examples are welcome.