0

I am attempting to merge an array based on a value from another array, but I get this kind of error: "TinyButStrong Error when merging block [docList]: invalid query '2022_0817_wes' because VarRef item '2022_0817_wes' is not found."

The following is how I constructed the HTML Template:

<div class="fileList">
    <p class="text"><span class="fileNumber">[urlList2.#; block=div; noerr].</span> <span class="fileTitle">[urlList2.title; magnet=span; noerr]<br></span>
    <span class="indent fileInfo"><span>[urlList2.event; magnet=((span)); noerr]</span><span> • [urlList2.eventdate; magnet=span; noerr]</span><br></span>
    <a id="[onshow.intranet; if [val]=1; then [urlList2.intraneturl; noerr]; else [urlList2.url; strconv=no; noerr]; noerr]" class="indent watch" href="Watch"><span class="fa fa-video-camera"></span> Watch Now</a><br>
    <a class="indent download" href="[onshow.intranet; if [val]=1; then [urlList2.intraneturl; noerr]; else [urlList2.url; strconv=no; noerr]; noerr]"><span class="fa fa-download"></span> Download Video</a> <span class="fileSize">([urlList2.filesize; noerr])</span> - Right-click and choose “Save Link As” or “Save Target As”
    <span class=""><a href="[docList.url; block=span; p1=[urlList2.filename; noerr]; bmagnet=span; noerr]">[docList.filename; noerr]</a>&nbsp;<span class="fileSize">([docList.filesize; noerr])</span></span></p>
</div>

And then PHP code, I am trying to pass the parameter to the array I want to use for the sub-block:

$TBS->MergeBlock('urlList2', 'array', $urlList);
$TBS->MergeBlock('docList', 'array', '%p1%');

The following snippet is an example from the array for sub-block:

Array
(
    [2022_0814_tes_various] => Array
        (
            [0] => Array
                (
                    [bucket] => fb
                    [key] => Bulletin.pdf
                    [filename] => Bulletin
                    [filesize] => 639.5KB
                    [url] => https://s3....
                )

            [1] => Array
                (
                    [bucket] => fb
                    [key] => 2022/2022-08-14_00-00-00_SBP-S22-Lesson-25.pdf
                    [filename] => 2022-08-14_00-00-00_SBP-S22-Lesson-25
                    [filesize] => 76.7KB
                    [url] => https://s3....
                )

        )

    [2022_0814_sms] => Array
        (
            [0] => Array
                (
                    [bucket] => fb
                    [key] => Bulletin.pdf
                    [filename] => Bulletin
                    [filesize] => 639.5KB
                    [url] => https://s3....
                )

            [1] => Array
                (
                    [bucket] => fb
                    [key] => 2022/2022-08-14_00-00-00_SBP-S22-Lesson-25.pdf
                    [filename] => 2022-08-14_00-00-00_SBP-S22-Lesson-25
                    [filesize] => 76.7KB
                    [url] => https://s3....
                )

        )
)
user5919866
  • 69
  • 1
  • 8
  • According to the documentation it should be more like this : `global $docList; $docList = ...; $TBS->MergeBlock('docList', 'array', 'docList[%p1%]');` – Skrol29 Aug 19 '22 at 01:46
  • You could also reorganize the data in order to use automatic subblocks (https://www.tinybutstrong.com/manual.php#html_block_subauto) – Skrol29 Aug 19 '22 at 01:48

0 Answers0