Categories > TinyButStrong general >

Merging Multiple Blocks/Multi-Language

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Trent
Date: 2007-04-18
Time: 01:42

Merging Multiple Blocks/Multi-Language

Not sure if the subject I posted is actually what I'm trying to say, but here goes my example/problem.

In my language file I have a definition like so.

$lang['refer'] = 'You have referred 10 new members.';

Now in my template file with the arrays I've created and the merging of my blocks I can call it like this:

[lang.refer]  =  This will output "You have referred 10 new members."

Now in my language file, I also have a defintion for for New Members like this:

$lang['new_member'] = 'new members';

(The reason for this is so that I can change 'new members' to what ever I want while still maintaining my standard definition structure in my language file.)

Now what I'm trying to achieve is using the following definition in my language file to combine the 2 definitions posted above into 1 output so that when I change $lang['new_member'] I only have to change it one time instead of changing it in each definition where it might be present.  So here's what I want:

$lang['refer'] = 'You have referred 10 [lang.new_member].';

So the actual HTML output of [lang.refer] would be:

You have referred 10 new members.

But what I'm getting in my output is:

You have referred 10 [lang.new_member].

Can someone help me out with this?
By: Skrol29
Date: 2007-04-18
Time: 11:41

Re: Merging Multiple Blocks/Multi-Language

Hi,

Did you tried with "protect=no" in embeded tags ?

$lang['refer'] = 'You have referred 10 [lang.new_member;protect=no].';
By: Trent
Date: 2007-04-18
Time: 21:29

Re: Merging Multiple Blocks/Multi-Language

I tried [lang.new_member;protect=no] in my language file as well as in my template and it still outputs as [lang.new_member] or [lang.new_member;protect=no].
By: Skrol29
Date: 2007-04-18
Time: 22:53

Re: Merging Multiple Blocks/Multi-Language

I've checked and in order to avoid bad loops, the MergeField() and [var] field processes do not look back when merging data.

So the only whay I see to have your nested fields merged is too call MergeField('lang') twice. And also use "protect=no" at least in the template, otherwise merged data are protected against nested fields.



By: Trent
Date: 2007-04-18
Time: 23:32

Re: Merging Multiple Blocks/Multi-Language

Well, the double merge makes my code look odd, but you know what, it works so that's what I'm going to do.  Thanks for the help Skrol.  Outstanding advice as always.
By: Trent
Date: 2007-04-18
Time: 23:36

Re: Merging Multiple Blocks/Multi-Language

One more question.  If I use the #10, in the example i've posted and make it a dynamic result, would I also have to merge that block twice to parse it in the language template file?

$lang['refer' = 'You have referred [refer.count] [lang.new_member].';
By: Skrol29
Date: 2007-04-19
Time: 00:56

Re: Merging Multiple Blocks/Multi-Language

> would I also have to merge that block twice

No, but MergeField('lang') should be called before MergeField('refer').
By: Trent
Date: 2007-04-19
Time: 04:38

Re: Merging Multiple Blocks/Multi-Language

Thanks again for the help.