Re: [Cppcms-users] Plugins and templates
Brought to you by:
artyom-beilis
From: Artyom <art...@ya...> - 2010-08-19 07:10:39
|
Hello, > One solution that came to my mind is to not specify a skin in the master > template and instead passing one with -s to cppcms_tmpl_cc to create > shared objects that contain the whole stuff but all have another skin to > be able to load a shared object file for each plugin and use them side > by side and specifying the skin for the plugin in the render method. Yes I think this is the way. I would suggest following. 1. Compile entry skin for each plugin, acutally this what I'm doing for each skin/view. For example if I need two skins I do something like: master_foo.tmpl master_bar.tmpl shared1.tmpl, shared2.tmpl Then I compile all of them into two skins: cppcms_tmpl_cc master_foo.tmpl shared1.tmpl shared1.tmpl -s "foo" ... cppcms_tmpl_cc master_bar.tmpl shared1.tmpl shared1.tmpl -s "bar" ... In your case it would be: master.tmpl plugin_foo.tmpl plugin_bar.tmpl cppcms_tmpl_cc master.tmpl plugin_foo.tmpl -s "plugins_skin_foo" ... cppcms_tmpl_cc master.tmpl plugin_bar.tmpl -s "plugins_skin_bar" ... It duplicates the code but makes the life much easier as you don't need to deal with classes. And you may add some query to pluging to get its skin name. 2. Another option is to use separate skin for what plugin need to render. For example if the pluging need to create a one or two pice of HTML you may create small skinks that render only these parts for them and each one of them has its own skins. I hope I understand your question correctly. Artyom |