Re: Passing variables to a [%.. %]

[email protected]
Newsgroups gmane.comp.lang.perl.modules.template-toolkit
Message-ID <e441547bc4ff7015964042de74ef252a.squirrel@webmail.computersystemconsulting.ca>
> On 15 Jan 2012, at 06:38, "[email protected]"
> <[email protected]> wrote:
>
>> Hi
>>
>>
>>      [%# embed(data.page_top_view,['-PAGE_TITLE','$PageName',]) %]
>>    [% embed(data.page_top_view,['-PAGE_TITLE',[%link.viewname%]) %]
>
> I don't think you need [% ... %] around link.viewname do you?
>
>
You are right this is because of the limitation of ttml to not be able to
nest[% ... %]

I did manage to get the above code to work by changing the ' to ".

Passing variblles into [% ... %] is a on going problem for me.

a keyone is

[% pagecode = data.page_name %] picked up from the url
[% sitename = data.sitename %]
  [% FOREACH link = DBI.query("SELECT * FROM page_tb
                                  WHERE  (status  = 2 AND
                                         page_code = "$pagecode" AND
                                         sitename = "$sitename" )
                                  ORDER BY sitename
                                  ")%]
               [% site      = link.sitename        %]
                 [% PageName  = link.view_name %]
                 [% Record_id = link.record_id  %]
                 [% body      = link.body %]
       [% END %]
This dose not work. How can I do this? I suppose I could drop to [%
RAWPerl%]. Any suggestions would be appreciated.

Thanks
shanta
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.