Re: [Cppcms-users] Templating System of CPPCMS
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2011-03-21 09:14:28
|
> > 1. are there any loops stuffs in the template system of CPPCMS? > > as in PHP we have > > <?php foreach ($var as $key => $value); ?> > > <label><?php echo $key ?>:</label><label><?php echo $value ?>:</label> > > <?php end foreach; ?> Yes you can: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_templates_flow#Foreach.block <% foreach a in b %> <ul> <% item %><% a %><% end %> </ul> <% empty %> nothing <% end %> In your case if b is std::map then a.first would be key and a.second would be a value. > > also, in php one can mix php codes along with html codes for eg: > > <html> > <body> > <?php > > while(expr) > { > //do some stuff > } > > ?> > </body> > </html> > Yes you can but in limited way: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_templates_comm#Injecting.C...Code Read more at: http://art-blog.no-ip.info/wikipp/en/page/cppcms_1x_templates > > 2. is it possible in cppcms to mix c++ and html codes the similar way? > It is not recommended unless it is necessary. Artyom |