Re: [Cppcms-users] View skin
Brought to you by:
artyom-beilis
|
From: Jan V. <jan...@gm...> - 2012-03-24 10:35:48
|
Hi,
I have checked the error logs for apache and the error from the rendering
is cppcms, error: Caught exception [cppcms::views::pool: no such view
viewName1 in the skin skinName]
I have even put config value for default skin into config.js like this.
"views" : {
"default_skin" : "skinName"
}
But still nothing. the same error is produced...
Any idea.
Thanks,
Jan
On Thu, Mar 22, 2012 at 2:17 PM, Jan Vlasak <jan...@gm...> wrote:
> Thanks for the reply,
>
> What I am trying to do is group view into one namespace (skin).
> My code is:
>
> view 1
> ---------------------------------------------------
> <% c++ #include "model1.h" %>
> <% xhtml %>
> <% skin skinName %>
> <% view viewName1 uses Model1 %>
> <% template render() %>
> .........
> <% end template %>
> <% end view %>
> <% end skin %>
>
>
> view 2
> -----------------------------------------------------
> <% c++ #include "model2.h" %>
> <% xhtml %>
> <% skin skinName %>
> <% view viewName2 uses Model2 %>
> <% template render() %>
> .........
> <% end template %>
> <% end view %>
> <% end skin %>
>
>
> rendering / invocation
> ---------------------------------------------------------------
>
> Model1 model1;
> render("skinName", "viewName1", model1);
>
> and
>
> Model2 mode2l;
> render("skinName", "viewName2", model2);
>
> each of those are invoked at different point of execution path not in the
> same function.
>
> This implementation produces empty screen and as soon as I change the skin
> name to be different for each view, it is fine.
>
> Any suggestions?
>
> Thanks, guys.
>
> Jan
>
>
> On Wed, Mar 21, 2012 at 8:13 AM, Artyom Beilis <art...@ya...>wrote:
>
>>
>>
>>
>> > Thanks for response.
>> > I have tried it with the same skin name across all views,
>> > but It just does not produce anything.
>>
>> Each cppcms template compilation unit should have its own skin name. It
>> is actually
>> namespace - the module.
>>
>> You should for course have different view names (classes) withing the
>> same skin but
>> view names can be shared between different skins (namespaces)
>>
>> You can define skin name by two methods:
>>
>> - using <% skin NAME %>
>> - using -s NAME flag for cppcms_tmpl_cc
>>
>>
>> >
>>
>> > As soon as I supply different name for each view, it works fine.
>>
>> Can you show the code - the pattern you use
>>
>>
>> > Should I include the skin name in the config.js or ... ?
>>
>> If you create **dynamically loadable** view than yes, if
>>
>> it is statically linked then:
>>
>> If you have multiple skins you man need to define only
>> the default one
>>
>>
>> > I cannot really see what is wrong as the views are
>> > working fine with distinct skin names.
>> >
>>
>> Each compilation unit created by cppcms_tmpl_cc should have distinct skin
>> names
>>
>>
>> >
>> >Any suggestions.
>> >Thanks,
>> >
>> >
>>
>> More pointers:
>>
>>
>> http://cppcms.com/wikipp/en/page/cppcms_1x_tut_hello_templates
>> http://cppcms.com/wikipp/en/page/cppcms_1x_tut_templates_inheritance
>> http://cppcms.com/wikipp/en/page/cppcms_1x_templates_gen
>> http://cppcms.com/wikipp/en/page/cppcms_1x_config#views
>> Artyom Beilis
>>
>>
>> ------------------------------------------------------------------------------
>> This SF email is sponsosred by:
>> Try Windows Azure free for 90 days Click Here
>> http://p.sf.net/sfu/sfd2d-msazure
>> _______________________________________________
>> Cppcms-users mailing list
>> Cpp...@li...
>> https://lists.sourceforge.net/lists/listinfo/cppcms-users
>>
>
>
>
> --
> Jan Vlasak
>
> Flat 2
> 39 Hurst Lane
> Birmingham
> B34 7HS
> ph.:+44 754 6124920
>
--
Jan Vlasak
Flat 2
39 Hurst Lane
Birmingham
B34 7HS
ph.:+44 754 6124920
|