[%- PROCESS 'common.shtml' %] [% WRAPPER 'wrapper_s.shtml' %]
?
[% USE obj1 = Content( list => 'buy', from_rub => 'text') %] [% FOREACH art = obj1.list -%] [% art.title %]
[% art.text %]
[% END -%]

[% USE obj = Content( list => 'buy', from_rub => 'formmail') %] [%- # formmail script # (c) sm@wm.ru FOREACH art = obj.list; # parse fieldset fields = []; tmp = art.fieldset.split('\r?\n\r?'); FOREACH t = tmp; tmp2 = t.split('=='); fields.push({ id => tmp2.0, title => tmp2.1, type => tmp2.2, extra => tmp2.slice(3), }); END; IF params.id; charset = 'koi8-r'; # compose message FOREACH f = fields; fid = 'fm_' _ f.id; value = params.${fid}; value = value.replace('\r',''); msgtext = msgtext _ f.title _ ": " _ value _ "\n"; END; IF fm_name; USE base64 = MIME::Base64; msgfrom = base64.encode( fm_name ); msgfrom = msgfrom.replace('\s+',''); msgfrom = '=?' _ charset _ '?B?' _ msgfrom _ '?= '; END; msgfrom = msgfrom _ '<' _ (fm_email || art.to)_ '>'; USE msg = MIME.Lite( Encoding => 'base64', From => msgfrom, To => art.to, Subject => art.subj, Data => msgtext, ); CALL msg.attr("content-type.charset", charset); CALL msg.send; -%] ,
<<<  [%- ELSE; -%] [% FOREACH field = fields; -%] [% END; # foreach field -%]
  [% field.title %]: [% SWITCH field.type; -%] [% CASE 'text'; -%] [% CASE 'textarea'; -%] [% CASE 'select'; -%] [% END; # switch -%]
[%- END; -%] [% END; -%]



[% END %]