Categories > TinyButStrong general >

Sub-block chokes on apostrophe -- "Can't found the end of the tag"

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Damir
Date: 2005-07-12
Time: 14:36

Sub-block chokes on apostrophe -- "Can't found the end of the tag"

Hi Skrol29,

thanks for the great tool. I started using TBS yesterday and really like it.

Got a question and a cosmetic bug report. :-)

The bug report first: the error message from the subject it should be "Cannot FIND the end of the tag" or "Could not FIND..." or "Have not FOUND...".


Now the question, if anybody can help:

It's about merging subblocks. I have an array that contains people's names:

    [O] => Array
        (
            [0] => O'LEARY, Christopher
            [1] => O'REILLY, Caroline
            [2] => ODERO, Alberto
        )

and another array that contains some objects and is keyed by the person's name:

    [O'LEARY, Christopher] => Array
        (
            [0] => article Object
                (
                    [title] => Article title
                    [year] => 1998
                    [volume] => 137
                    [id] => 1998-3-d
                )

        )

    [O'REILLY, Caroline] => Array
        (
            [0] => article Object
                (
                    [title] => Article title
                    [year] => 2003
                    [volume] => 142
                    [id] => 2003-2-m
                )

        )

I want to display the html so that each author contains their own article (one or more):

<ul>
    <li><p>[blkname.val;block=li;p1=[blkalpha.$]]</p>
        <ul>
            <li>[blkarticle.title;block=li;onsection=BindArticleDataEvent;p1=[blkname.val]]"></li>
        </ul>
    </li>
</ul>

Php code looks like this:

//Names are keyed by the first letter;
//not shown in the above snippet for easier understanding...
$TBS->MergeBlock('blkname','array', 'byLetter[%p1%]');
$TBS->MergeBlock('blkarticle','array', 'byAuthor[%p1%]');
$TBS->Show() ;

Anyway, what happens is that the inner block chokes on the apostrophe on the person's last name. I'm getting the error from the subject of this post.

Obviously putting htmlconv=esc doesn't help, as the name then gets displayed with two apostrophes, and lookup doesn't work find anything in the second array.

I have tried to modify the &$DetailSrc in the event function, but it seems that the error is raised before the event function is called, so no chance to do that. Also, there seems to be no way in getting the value of the %p1% selector in the event function (so that I can perform my own lookup and set the values in $CurrRec properly).

Is there any workaround for this? (At present, I'm url-encoded the author data at the source, and then decoding it again for display in an 'onsection' event (not shown in the above example), but it is a rather ugly hack).

If you want, I can supply you with the complete code for you to repro the issue.


Thanks a bunch, and keep up the good work.

Damir

p.s. While I'm at it, is there any way to address object values in the block syntax? Something like [blkarticle.val->title]?
By: Skrol29
Date: 2005-07-12
Time: 17:41

Re: Sub-block chokes on apostrophe -- "Can't found the end of the tag"

Hi,

Instead of
  p1=[blkname.val]
try
  p1='[blkname.val;htmlconv=esc]'
with "htmlconv=esc" plus string delimitor (').

>p.s. While I'm at it, is there any way to address object values
> in the block syntax? Something like [blkarticle.val->title]?

Yes: [blkarticle.val.title]