From: Conal T. <Con...@vu...> - 2004-09-28 04:50:46
|
Kal Ahmed wrote: > I've checked in some changes for the TM4Web/Velocity package which > provides a basic level of support for listing the topic maps in a > database. You need a configuration like this: >=20 > <provider name=3D"hibernate"=20 > factory=3D"org.tm4j.topicmap.hibernate.TopicMapProviderFactoryImpl"> > <provider-properties> > <property name=3D"hibernate.connection.url"=20 > value=3D"jdbc:mysql://localhost/tm4mail"/> > <property name=3D"hibernate.connection.username" value=3D"***"/> > <property name=3D"hibernate.connection.password" value=3D"***"/> > <property name=3D"hibernate.dialect"=20 > value=3D"net.sf.hibernate.dialect.MySQLDialect"/> > <property name=3D"hibernate.connection.driver_class"=20 > value=3D"com.mysql.jdbc.Driver"/> > </provider-properties> =20 > <topicmaps template=3D"topicmap.vm"/> > </provider> >=20 > Note the extra <topicmaps/> element that is required. The template > attribute specifies the template to be used for the main=20 > topicmap page. > With this update, you are forced to always use topic.vm to render > topics, but I will work on adding support like you have in the normal > <topicmap> element to specify the template(s) to use to render topics. It's only vaguely related to Kal's post, but I thought I'd mention: I haven't used the velocity templating engine, but I have used Cocoon to = do templating. I've used Cocoon's JXTemplateGenerator, which is rather = like XSLT with JXPath instead of XPath. JXPath gives you path-based = access to Java object-graphs, e.g. x.getFoo().getBar() =3D> "x/foo/bar". = So this is similar to Velocity, and similarly I have templates = associated with various topic map objects.=20 I am keeping references to the individual JXTemplate files in the actual = topic map, where they appear as occurrences of class topics. I had = considered keeping a list of templates associated with different topics = when I realised that this is what topic maps are for :-) I don't have a = very sophisticated setup yet, but it does seem to me that referring to = templates in the map itself is potentially a powerful technique. How = does it work with the Velocity integration? Can you attach Velocity = templates to particular classes of topics, for instance? |