[ic] more-list and interpolation

Wadkins, Raymond rwadkins at mcfina.com
Tue Aug 17 20:58:21 UTC 2010

  On 8/17/2010 4:02 PM, Peter wrote:
> On 17/08/10 03:39, Wadkins, Raymond wrote:
>>   I had a requirement to conditionally control the inclusion of
>> decade-next and decade-prev tags in a more-list.  So, I blithely wrapped
>> them in an if block, then was surprised when the negative condition
>> wasn't working.  Turns out that the contents of more-list aren't
>> interpolated before being processed, so the regular expression in
>> tag_more_list was matching my tags desipite their being included in an
>> if block.
>> I hacked a few extra lines into Vend::Interpolate (below), but I'm
>> wondering if there's something I've missed that could do this without
>> the hack?
>>       if($r =~ s:\[interpolate\]::i) {
>>           $r = Vend::Interpolate::interpolate_html($r);
>>       }
> Can you give some more details about what you were originally trying to
> accomplish here?  There is almost certainly a better way to do this than
> by hacking Interpolate.html, but it's hard to tell you what to do with
> so little information.
Imagine that the scratch values are optionally set elsewhere

         [tmp has_decade]0[/tmp]


         [tmp body_more_links]
                 [next-anchor][scratch text_action_next][/next-anchor]
                 [prev-anchor][scratch text_action_previous][/prev-anchor]
                 [if scratch has_decade][decade-next][scratch 
                 [if scratch has_decade][decade-prev][scratch 
                 [scratch text_label_page]

Unfortunately, what gets handed to Vend::Interpolate::tag_more_list as 
the body is not interpolated, so the "if" blocks aren't evaluated and 
the string "[decade-next]", when encountered by the regular expression, 
turns on the decade functionality.  It seems that the code is reparsed 
when it's done, but by then it's too late, the functionality has been 

What I want to happen is to be able to control when the decade-based 
logic occurs on a list of pages conditionally.  I could achieve this 
with two different more-list blocks, but I hate repeated code.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.icdevgroup.org/pipermail/interchange-users/attachments/20100817/c82d001f/attachment.htm>

More information about the interchange-users mailing list