Mailing List Archive

need advice about two OC's that share utility template
Hi,

I've defined 2 OC's: Web and  Category_Story_List (CSL OC) .
My Cover stories  go through both of them.
In Web OC  regular html pages are generated.
In CSL OC a php code is generated (list of  links to last stories in a
category).
This code is later included in various pages on the server side.
Utility template /util/story_list.mc (defined as Web OC utility
template) is used in both OC's so I had to select Web OC in Template
Includes section in the definition of CSL OC.
There are two /cover.mc templates - one for each OC.

The problem is that whenever I define a new (Web OC) /xxx/cover.mc in
a subcategory I have to clone CSL OC version of cover.mc in this
subcategory as well.

It is hard to remember about this dependency and I feel that there is
something wrong with the whole idea.


Should I define separate OC (CommonUtilities OC) to "hold" common
utility templates (like story_list.mc) and include these templates in
other OCS's (-- I feel I should't)

What is the clever way to get the result I need.

thanks in advance

Krzysztof
Re: need advice about two OC's that share utility template [ In reply to ]
OCs have the concept of inheritance so an OC can include the templates of
another OC. We have a utility OC that is included into our HTML and XML OCs
in order to do validation and encoding tasks common to both. This is
exactly what the "template includes" was designed for.

regards,

Paul


Krzysztof Rudnik wrote:
> Hi,
>
> I've defined 2 OC's: Web and Category_Story_List (CSL OC) .
> My Cover stories go through both of them.
> In Web OC regular html pages are generated.
> In CSL OC a php code is generated (list of links to last stories in a
> category).
> This code is later included in various pages on the server side.
> Utility template /util/story_list.mc (defined as Web OC utility
> template) is used in both OC's so I had to select Web OC in Template
> Includes section in the definition of CSL OC.
> There are two /cover.mc templates - one for each OC.
>
> The problem is that whenever I define a new (Web OC) /xxx/cover.mc in
> a subcategory I have to clone CSL OC version of cover.mc in this
> subcategory as well.
>
> It is hard to remember about this dependency and I feel that there is
> something wrong with the whole idea.
>
>
> Should I define separate OC (CommonUtilities OC) to "hold" common
> utility templates (like story_list.mc) and include these templates in
> other OCS's (-- I feel I should't)
>
> What is the clever way to get the result I need.
>
> thanks in advance
>
> Krzysztof
>
Re: need advice about two OC's that share utility template [ In reply to ]
On Thu, Oct 1, 2009 at 2:02 PM, Paul Orrock <paulo@digitalcraftsmen.net> wrote:
> OCs have the concept of inheritance so an OC can include the templates of
> another OC. We have a utility OC that is included into our HTML and XML OCs
> in order to do validation and encoding tasks common to both. This is exactly
> what the "template includes" was designed for.
So I was wrong when thinking about OC only as a pipe that output goes through.
OK than.
thanks very much
Krzysztof

>
> regards,
>
> Paul
>
>
> Krzysztof Rudnik wrote:
>>
>> Hi,
>>
>> I've defined 2 OC's: Web and  Category_Story_List (CSL OC) .
>> My Cover stories  go through both of them.
>> In Web OC  regular html pages are generated.
>> In CSL OC a php code is generated (list of  links to last stories in a
>> category).
>> This code is later included in various pages on the server side.
>> Utility template /util/story_list.mc (defined as Web OC utility
>> template) is used in both OC's so I had to select Web OC  in Template
>> Includes section in the definition of CSL OC.
>> There are two /cover.mc templates - one for each OC.
>>
>> The problem is that whenever I define a new (Web OC) /xxx/cover.mc in
>> a subcategory I have to  clone CSL OC version of cover.mc in this
>> subcategory as well.
>>
>> It is hard to remember about this dependency and I feel that there is
>> something wrong with the whole idea.
>>
>>
>> Should I define separate OC (CommonUtilities OC)  to "hold" common
>> utility templates (like story_list.mc) and include these templates in
>> other OCS's (-- I feel I should't)
>>
>> What is the clever way to get the result I need.
>>
>> thanks in advance
>>
>> Krzysztof
>>
>