0

I cannot get TBS to merge one of the fields I reference as a parameter to a function. The eventid gets merged, but eventdate does not. Any thoughts on why?

[blk.mp3filename; onformat=f_constructPath; year=[blk.eventdate; frm='YYYY'; noerr]; eventid=[blk.eventid; noerr]; strconv=no; noerr]

The eventdate field is present, because I can move the TBS tag to elsewhere on the page and it returns data. I tried using ondata but the function was never called, so I went to using onformat.

[blk.mp3filename; ondata=f_constructPath; strconv=no; noerr]

Here's a larger part of the code with the ondata statement version:

<div class="row">
    <div class="col-12 col-md-2">
        <img class="FBC_thumb" src="_resources/images/persons/[blk.imagefilename; magnet=img; noerr]" alt="[blk.greeting; strconv=no; noerr] [blk.firstname; strconv=no; noerr] [blk.lastname; strconv=no; noerr]">
    </div>
    <div class="col-12 col-md-10">
        <h3 class="FBC_sermon-title">[blk.title; strconv=no; magnet=div; noerr]</h3>
        <div class="FBC_speakername font-weight-bold"><span>[blk.greeting; magnet=span; strconv=no; noerr] </span>[blk.firstname; magnet=p; strconv=no; noerr] [blk.lastname; magnet=p; strconv=no; noerr]</div>
        <div class="FBC_bioshort">[blk.bioshort; magnet=p; strconv=no; noerr]</div>
        <div>
            <div class="d-sm-inline FBC_eventdate"><span class="font-weight-bold">Date: </span>[blk.eventdate; magnet=div; frm='mmm d, YYYY'; strconv=no; noerr]</div>
            <div class="d-sm-inline pl-sm-3 FBC_eventname"><span class="font-weight-bold">Event: </span>[blk.eventname; magnet=div; strconv=no; noerr]</div>
            <div class="FBC_icon-group">
                <div>
                    <a data-toggle="collapse" href="#collapsePlayer" aria-expanded="false" aria-controls="collapsePlayer"><span class="d-block icon icon-headphones"></span>
                    <span class="FBC_text-8">LISTEN</span></a>
                </div>
                <div>
                    <a href="ministries/sermon-library1/download/[blk.id; magnet=a; mtype=m+m; strconv=no; noerr]/"><span class="d-block icon icon-download"></span>
                    <span class="FBC_text-8">DOWNLOAD</span></a>
                </div>
                <div>
                    <a data-toggle="modal" href="#modalShare"><span class="d-block icon icon-share2"></span>
                    <span class="FBC_text-8">SHARE</span></a>
                </div>
            </div>
        </div>
    </div>
    <div id="collapsePlayer" class="collapse col-12 pt-4 pb-3">
        <div class="FBC_player-outer-wrapper">
            <div class="FBC_player-wrapper w-100 w-md-75">
                <div class="FBC_seek-slider"></div>
                <div id="FBC_play-pause" class="FBC_player-button icon icon-play3"></div>
                <div class="FBC_player-left-wrapper">
                    <div class="FBC_player-volume-wrapper">
                        <div class="FBC_player-volume icon"><span class="FBC_player-last-volume" style="display: none"></span></div>
                        <div id="display-always" class="FBC_player-volume-slider"></div>
                    </div>
                    <div class="FBC_player-text"><span id="duration">0:00</span><span id="length"> / 0:00</span></div>
                </div>
                <div class="FBC_player-right-wrapper">
                    <div class="FBC_player-quality"><span class="icon icon-cog"></span>
                        <div class="FBC_player-quality-menu display-none">
                            <span class="FBC_player-quality-menu-title">Quality</span>
                            <span id="menuitem" class="FBC_player-quality-menu-item menu-item1 icon">96k</span>
                            <span id="menuitem2" class="FBC_player-quality-menu-item menu-item2 icon">24k</span>
                        </div>
                    </div>
                </div>
            </div>
            <p id="source1" style="display: none">[blk.mp3filename; block=div; ondata=f_constructPath; strconv=no; noerr]</p>
            <p id="url" style="display: none">[onshow.url; strconv=no; noerr]</p>
            <audio class="FBC_player"></audio>
        </div>
    </div>
    <div class="col-12 pt-4 pb-3">
        <h5>Summary</h5>
        <p class="FBC_summary">[blk.summary; magnet=div; strconv=no; noerr]</p>
    </div>
</div><!-- End Bootstrap Row -->
user5919866
  • 69
  • 1
  • 8
  • Embedded fields may be not merged as you expect. The rules are explained here http://www.tinybutstrong.com/manual.php#html_field. `ondata` seems more appropriate, it works only if you have actually defined a block, that is you have a parameter `block` in at least one field starting with `blk`. Can you give a more complete block definition ? – Skrol29 Aug 28 '18 at 22:35
  • I didn't use the block parameter as the SQL call returns only one record, but I did add back in block parameter and it works only if I add the block parameter in the field with the ondata statement. I'll add the full code block to question. – user5919866 Aug 29 '18 at 12:55

1 Answers1

0

If you have a block bound defined for blk (that is your have at least one TBS fields with parameter block), then it is a normal block merging and parameter ondata is processed (like all block parameters in this TBS field). If the ondata function does not behave has you expect, you can debug it by watching what it has for argument $CurrRec. For example : var_export($CurrRec). Please note that block parameters are processed only if they go with a block parameter.

If you have no block bound defined for blk (that is your have no TBS fields with parameter block), then TBS merges only the first record and it behave like a MerfeField(). That is, no block parameter is processed. So the ondata function is ignored. In this case you can use onformat and you can debug the corresponding function by watching what it has for argument $CurrPrm. In you case, according to your snippet, I guess TBS fields embedded in parameter are simply not merged.

One more remark: in your piece of template, you have some TBS fields inside the block, and some other outside the block. Outside fields will be merged separately from normal block section.

Skrol29
  • 5,402
  • 1
  • 20
  • 25