Categories > TinyButStrong general >

Variables Inside TBS Fields

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Michaelsen
Date: 2006-08-07
Time: 12:29

Variables Inside TBS Fields


Dear Mr. Skrol,

I'm trying to achieve the following:

[news.title_[var._GET.lang]]

In the news table I have 3 title fields, title_en, title_fr and title_es, so I can use the same block and changing the current language in the url.

However it doesnt work, I tried those merge special and merge field but really I think I'm missing the point.

Could you help me with that please, I believe I'm going in the wrong direction.

Thank you!

- Michaelsen
By: Skrol29
Date: 2006-08-07
Time: 12:44

Re: Variables Inside TBS Fields

Hi,

[var] fields are merged at the end, during the Show() method. That's why  your field is not valid when you call MergeBlock('news',...).

In TBS 3.2.0 (available soon), you will have [onload._GET.lang] which enables you to define a var field which is merged as soon as the template is loaded.

But for now, you have to merge manually this field before you call MergeBlock('news',...). You can do :
$TBS->MergeField('var');
But it will merge all [var] field. It may be good or not for your template.
If it's not, replace [var._GET.lang] by [prepare._GET.lang] and do:
$TBS->MergeField('prepare',$GLOBALS);
By: Michaelsen
Date: 2006-08-07
Time: 13:29

Re: Variables Inside TBS Fields

$TBS->MergeField('prepare',$GLOBALS);

Very impressive.

Thank you again.

- Michaelsen