[opencms-dev] How to structure modules
Jonathan Woods
jonathan.woods at scintillance.com
Wed Jul 8 10:27:02 CEST 2009
There's no integrity enforced between content type schemas (the .xsd files
themselves) and references to them in your module manifest file. So in one
module (the so-called content module) you could have schemas, shared Java
code, and other shared stuff; while in the other (the template module) you
could have all JSPs and any other module-specific material PLUS the module
manifest entries necessary to associate schemas to JSPs:
<type class="org.opencms.file.types.CmsResourceTypeXmlContent"
name="calendarEntry" id="81">
<properties>
<property>
<!-- This property is set to define the JSP used
to render resources of this type -->
<name>template-elements</name>
<value type="shared">
<![CDATA[/system/modules/module.name/template-elements/calendarentry.jsp]]>
</value>
</property>
</properties>
<copy-resources />
<!-- Following parameter relates content type to schema modelling it
-->
<param
name="schema">/system/modules/module.name/schemas/calendarentry.xsd</param>
</type>
All you'd need to do is to make you sure you maintain a global list of the
id values you're assigning to each content type, to make sure you don't
accidentally re-use values between different template modules.
Not sure what you mean by template area and content area. You can display
data from anywhere, anywhere in a page. In a standard OpenCms treatment, a
page is delivered by a JSP whose path is generally determined from
properties on the resource requested, and that JSP can (i) include other
JSPs at will, (ii) do whatever it likes to retrieve content from anywhere in
the VFS. But I suspect I'm misunderstanding you!
Jon
> -----Original Message-----
> From: opencms-dev-bounces at opencms.org
> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Marc.Schlegel
> Sent: 07 July 2009 18:57
> To: The OpenCms mailing list
> Subject: Re: [opencms-dev] How to structure modules
>
> 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?
>
> regards
> Marc
>
> Jonathan Woods schrieb:
> > +1 to Christian's suggestion, splitting out content types into a
> > +separate
> > project. It tends to be view-level stuff which varies most between
> > projects, whereas with a bit of thought you can probably design
> > content types - and a good deal of the code which processes them -
> > such that they're reusable.
> >
> > Jon
> >
> >
> >> -----Original Message-----
> >> From: opencms-dev-bounces at opencms.org
> >> [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Christian
> >> Steinert
> >> Sent: 07 July 2009 08:24
> >> To: The OpenCms mailing list
> >> Subject: Re: [opencms-dev] How to structure modules
> >>
> >> Marc.Schlegel wrote:
> >>
> >>> Hello Everyone.
> >>>
> >>> For my company I am going to create a product website
> >>>
> >> first, but later
> >>
> >>> we might move the company website to OpenCms as well. Due
> >>>
> >> to that I am
> >>
> >>> thinking of a good way how to structure my modules (e.g.
> >>>
> >> dependencies).
> >>
> >>> For example, the product website will have a "news"
> >>>
> >> contenttype which
> >>
> >>> relies in a content-module that is dependent on the
> >>>
> >> template-module.
> >>
> >>> But "news" are not so special and it would be nice to reuse
> >>>
> >> the same
> >>
> >>> contenttype for two templates.
> >>>
> >>>
> >>>
> >> I think it depends on how big you expect the modules to
> become and
> >> how many people will work on this in parallel. If the
> content types
> >> and templates don't become too big and if they aren't completely
> >> unrelated, then you can probably stick a couple of things into one
> >> module to ease deployment. If many people work on this in
> parallel or
> >> if your templates are extremely different without any code re-use
> >> between them or if many people will work on this in parallel, then
> >> you could split things further, but otherwise, I wouldn't.
> >>
> >>
> >>> How should I do this?
> >>> Or is it better to have just one template module, that
> >>>
> >> actualy has two
> >>
> >>> (or more) templates and one content-module containing all
> >>>
> >> contenttypes?
> >>
> >>>
> >>>
> >> Having a content module and a templates module sounds like a good
> >> approach to me. This was also what entered my mind after I
> had read
> >> the first paragraph of your mail.
> >>
> >> Best Regards
> >> Christian
>
> _______________________________________________
> 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
More information about the opencms-dev
mailing list