[opencms-dev] How to structure modules

Christian Steinert christian_steinert at web.de
Sun Jul 19 10:46:45 CEST 2009


Marc.Schlegel wrote:
> Christian Steinert schrieb:
>   
>> Marc.Schlegel wrote:
>>   
>>     
>>> Thanks, for supporting the idea of splitting it up.
>>>
>>> Now I still have another question. The content-module would specify some 
>>> details-pages when displaying the content. What I would like to do in my 
>>> template-module is to present the most recent news in the templatearea 
>>> (not in the content area). How would that work when the actual 
>>> contenttype is in another module? And would the template-module then not 
>>> be dependent on the content-module (for instance, in templateone it was 
>>> the other way aroun)? Or is the dependecy just for checking that certain 
>>>
>>>     
>>>       
>> modules are available on install?Jonathan already wrote a long answer - just to raise the IMO most 
>> important point:
>> Any module is allowed to access any files in the File System. But since 
>> your template-module depends on the content-type-module, your 
>> template-module should explicitly have this dependency set in its 
>> property. In this way, you enforce, that the required module with all of 
>> its files and setings is available and then you also don't get into 
>> practical trouble, if your temploate-module can only function when the 
>> other one is imported.
>>
>> Opencms will enforce module dependencies upon import, i.e. you can only 
>> import a module when all its dependencies were imported before.
>>
>> Best Regards
>> Christian
>>     
> Thannks for that explanation.
> But I´ve got another one :)
> I am thinking that my content-module would also consist of details-pages 
> for its structured contents but the reference to this is usually 
> hardcoded in the module description (like the photogallery in 
> templateone). Would it be possible that a template completetly 
> overwrites that property and create its own details-pages (maybe not 
> using one value). Would it be enough to overwrite the property (for the 
> page rendering the content) on the parent folder, or is this not 
> possible at all?
>   
I am not sure if I understood your question correctly. Do you want to 
switch the template of a file depending on its parent folder, rather 
than tying the template directly to an individual page?

As far as I know you can set the template property on a folder and not 
on the files in that folder. In that case, the folder-setting should 
carry over to your files.

This should also work with several folder levels in between.
However, if a file has an explicit template or template-elements 
setting, then any setting for your parent folders will not have an 
effect. A folder cannot override the settings for individual resources.

Again, I have not tried setting templates through folder properties - I 
think that it works but I could be wrong. Maybe someone else has 
actually done that?

Also, what you can definitely do is to create some kind of meta 
template, where all resources have the same JSP template assigned to 
them, but the code of that JSP decides, which actual template gets 
included an thus used. (And of course, for that decision, you yourself 
could check parent folder properties and include the desired template 
into your meta template, as needed). This will definitely work, since 
you have complete freedom of what you do in your JSPs.

Christian
> I am asking all these question so I can setup my structure right away 
> from the beginning.
>
> regards
> -- Marc
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev
>
>   

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20090719/c748ea97/attachment.htm>


More information about the opencms-dev mailing list