Search Articles

Sort By

Article Categories

Authors & MVPs

Kelly Ford

Introducing DNNDev University

The new DNNDev University doesn't have a winning football team. It is built on people - you and I and everyone who uses DotNetNuke and XMod Pro.


Using More Than One Template In An XMod Pro Module

An example of using multiple templates in one XMod Pro module...

A great feature of XMod Pro is that you can add as many templates as you like to your module. This feature can come in very handy at times. XMod Pro also lets you send data between templates giving your the ability to demonstrate relationships between your data.

Consider that you want to display staff from three different departments and you want each department to have a unique header. You might build something with the framework like this. Where there is a template for each department. Each template has it’s own SQL call and shows different data.

<xmod:template id="HeadofDepartment"> 
<xmod:template id="FinanceandAdmin">
<xmod:template id="Tax">
<xmod:template id="HumanResource">

The multiple template feature is also useful if you want a simple way to show a record count or if you want to show a link to more data only when there is more than the current page shows.

For example, this template is used at the foot of a page. It counts the number of records and shows a link when the count is greater than the page size.

<xmod:template UsePaging="False" id="count">
<listdatasource commandtext="
SELECT count(*) as numrows
inner join DMX_ShortTexts DMXST
on DMXE.EntryID=DMXST.ObjectId and SubTypeKey='TITLE'
inner join DMX_Extensions DMXEXT on DMXE.EntryType=DMXEXT.ExtensionKey
/* get the remarks if they exist - gus 21-4-2010 */
left outer join DMX_LongTexts DMXLT on DMXLT.ObjectId= DMXE.EntryID and DMXLT.SubTypeKey='REMARKS'
and DMXLT.TypeKey='ENT'

where entryID=LastVersionID
and deleted=0
and DMXE.EntryType <> 'Collection'
and [email protected]"
<parameter name="collectionID" value='[[Module:collectionID]]'/>

<case comparetype="numeric" operator=">" value='[[numrows]]' expression="12">
<p><xmod:redirect text="Show More Documents" target="/EEIOCGmember/MoreMeetingDocumentsEEIOCG.aspx">
<field name="collectionID" value='[[Module:collectionID]]' />


If there are more than 12 rows the user will see a link to a page with the full list of documents. The above would also be useful for showing a record count at the foot of a list.


Comments & Ratings

    (Ratings: 0   Avg: )
Rate It!
Share It!