Buck Anderson's DotNetNuke Training and Resource Center - how to profit with DotNetnuke September 08, 2008   
 You Are Here: ..:: DNN Modules » XMod Applications ::.. Register  Login
JOIN TODAY!  

Gain immediate access to all our articles, features, downloads, resaleable software applications, how-to's, video tutorials, discussion group, archives plus more.

Click here for details


Product Showcase  
DNN Modules  
Get Started  
Training  
Resources  
Features  

XMod | Training | Demonstrations | Downloads | Applications

XMod DemosXMod, a DotNetNuke® module created by DNNdev , is an extremely flexible and powerful tool. You can quickly create one-off solutions with little or no knowledge of HTML or programming. However, the more you know, the more you can do. Here's a sampling of what XMod can do.

Powerful XMod applications are available FREE to our subscribers in the DNN professor download library.

See you on the Inside
(Subscription Information)

 Membership has its advantages!


Current Articles | | Search

 
Buck's Tip - Code Reuse with XMod Parameters
By Buck Anderson @ 10:50 PM :: 743 Views :: Article Rating :: XMod Applications
 

After you have written several XMod applications, it seems you look for better ways to make your XMod code library more reusable.

Here is a tip on using parameters.

There are certain values that most forms have in common. Instead of entering these values throughout your code, use parameters.

Here is an example:

You begin by adding parameters to your form.

<parameters>
     <parameter name="iDir" alias="imageDir" default="LinkImages/"></parameter>
     <parameter name="dURL" alias="domainURL" default="http://yourdomain.com"></parameter>
     <parameter name="sEmail" alias="SiteEmail" default="someone@yourdomain.com"></parameter>
     <parameter name="smtpServ" alias="smtpMailServer" default="mail.yourdomain.com"></parameter>
     <parameter name="sSubject" alias="EmailSubject" default="Your Directory Listing"></parameter>
      <parameter name="redir" alias="RedirectUrl" default="Your redirect URL"></parameter>
</parameters>

By using parameters, if you have a certain chunk of code that you want to reuse on another form, you can simply grab a section like this:

<email target="{ContactEmail}" from="{SiteEmail}" subject="{EmailSubject}" smtpserver="{smtpMailServer}" sendrule="add">

or

<redirect target="{RedirectUrl}" />

Here is another example of passing values to a form:

By placing parameters in the called form, you can then accept values that are passed from a template.

<parameters>
    <parameter name="CName" alias="CName" default=""></parameter>
    <parameter name="CCode" alias="CCode" default=""></parameter>
    <parameter name="VEID" alias="VEID" default=""></parameter>
    <parameter name="VID" alias="VID" default=""></parameter>
    <parameter name="LID" alias="LID" default=""></parameter>
</parameters>

The code in a template may look something like this:

a target="_blank" href="/Default.aspx?tabid=1&amp;CName=<xmod:field name="Company"/>&amp;VEID=<xmod:field name="ContactEmail"/>&amp;VID=<xmod:field name="UserID"/>&amp;CCode=<xmod:field name="PromoCode"/>&amp;LID=<xmod:field name="ListingID"/>" target="_blank"

Using parameters to create reusable code will save you a lot of time.


Buck Anderson's DotNetNuke Training, Video Training, and Internet Marketing Resource Center DNNprofessor.com. Free tips to improve your business with DotNetNuke, XMod, website design techniques, and proven unconventional Internet Marketing Solutions that attract the attention of today's savvy Internet buyer at DNNprofessor.com.

© 2008 Jive Media Group LLC and Buck Anderson.
 All Rights Reserved. Reproduction without permission prohibited.


Rating
Comments

Click Next to View More Headlines

All articles available to Subscribers

 Membership has its advantages!

 
Copyright 2008 by Jive Media Group LLC. All Rights Reserved.  | Terms Of Use | Privacy Statement 

Page generated in 0.0936012 seconds. | powered byVisit Jive Media Group LLC