Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListDirectory Listing HelpDirectory Listing Help
Previous
 
Next
New Post
5/18/2008 10:29 PM
 

I'm fairly new to the DNN world and have started a reunion site for my 20th year this summer.  Inside it, I created a directory with the following fields:

Field Name - Field Type
Current Picture - Image
Name (1988) - Text
Name (2008) - Text
Bio - Rich Text
Milltary - True/False
External Personal Site - URL

Here's the style sheet I'm using to display the list.

<?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:udt="DotNetNuke/UserDefinedTable">
<xsl:output method="xml" version="1.0"  indent="yes" omit-xml-declaration="yes"/>
<xsl:template match="/udt:UserDefinedTable">
<xsl:variable name ="imgColumn" select="//udt:Fields[udt:FieldType='Image'][1]/udt:ValueColumn"/>
<xsl:variable name ="titleColumn" select="//udt:Fields[udt:FieldType='String'][1]/udt:ValueColumn"/>
<xsl:variable name ="htmlColumn" select="//udt:Fields[udt:FieldType='TextHtml'][1]/udt:ValueColumn"/>

 <table cellspacing="0" cellpadding="4"  border="0"  style="border-width:0px;border-collapse:collapse;">
 <xsl:for-each select="udt:Data">
 <xsl:variable name="id" select="udt:UserDefinedRowId"/>
  <tr class="normal">
   <td valign="top" style="border-bottom: silver 1px solid;">
    <xsl:if test="udt:EditLink">
     <a>
      <xsl:attribute name="href">
       <xsl:value-of select="udt:EditLink" />
      </xsl:attribute>
      <img border="0" alt="edit">
       <xsl:attribute name="src">
        <xsl:value-of select="//udt:Context/udt:ApplicationPath"/>/images/edit.gif</xsl:attribute>
      </img>
     </a>
    </xsl:if>
   </td>
   <td valign="top" style="border-bottom: silver 1px solid;;"><a href="" target="_blank" >
    <xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$imgColumn]" disable-output-escaping="yes"/></a>
   </td>
   <td style="border-bottom: silver 1px solid;">
    <h2><xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$titleColumn]" disable-output-escaping="yes"/></h2>
    <xsl:value-of select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$htmlColumn]" disable-output-escaping="yes"/>
    <table cellspacing="0" cellpadding="0" border="0">
     <xsl:for-each select="//udt:Fields">   
      <xsl:variable name="NameOfValueColumn" select="udt:ValueColumn"/>
      <xsl:variable name="CurrentValue" select="//udt:Data[udt:UserDefinedRowId=$id]/*[name()=$NameOfValueColumn]"/>
      <xsl:if test ="$CurrentValue and $CurrentValue!='' and ($NameOfValueColumn!=$imgColumn or not($imgColumn)) and ($NameOfValueColumn!=$titleColumn  or not($titleColumn)) and ($NameOfValueColumn!=$htmlColumn  or not($htmlColumn))and (udt:Visible='true' or udt:Visible='True')" >
       <tr class="normal">
        <td>
         <xsl:value-of select ="udt:FieldTitle"/>:
        </td>
        <td>&#160;</td>
        <td>
         <xsl:value-of select="$CurrentValue" disable-output-escaping="yes"/>  
        </td>
       </tr>
      </xsl:if>
     </xsl:for-each>
    </table>
   </td>
  </tr>
 </xsl:for-each>
 </table>
</xsl:template>
</xsl:stylesheet>

This is probably pretty standard.  However, I have the following problems with the view:

1) I want to sort the list by the "Name (1988)" field in alphabetical ascending order
2) I want the  "Current Picture" field to have a link on it to view the full picture in a pop-up window.  It currently shows a 100px thumbnail next to the record.  The thumbnail should be clicked to see the full image.

XSL is pretty foreign to me at the moment and any help would be appreciated.  Thanks in advance.

As a side curiosity, how does the list pull data?  I can't find a stored proc in the db or view to pull from.  What SQL statement could I use to generate my own dataset from the "Directory" custom udt module?

 
New Post
5/19/2008 6:39 AM
 
  1. did you check the "sorting" option in the XSL genererator?
  2. this is not built in, you will need to create a link manually in your custom XSL, I suggest to do it in the HTML editor before generating the XSL, using UDT_[coumnname]_URL hidden column. Please check out the module manual for details.

Cheers from Germany,
Sebastian Leupold

dnnWerk - The DotNetNuke Experts   German Spoken DotNetNuke User Group

Speed up your DNN Websites with TurboDNN
 
New Post
5/19/2008 1:38 PM
 

First:  Pick up a copy of XSLT for Dummies.  The examples will definitely help out.

Second:  Use the UDT's XSL Generator to create examples to help you out.

Like Sebastian said, when you create your XSL template, you can expand the Options and add sorting support.  This will then sort by the column (and direction) specified in the Manage Table options.

  <xsl:template match="/udt:UserDefinedTable">
    <xsl:variable name="currentData" select="udt:Data" />
    <table>
      <xsl:apply-templates select="$currentData" mode="list">
        <xsl:sort select="*[name()=$orderBy]" order="{$orderDirection}" data-type="{$orderType}" />
      </xsl:apply-templates>
    </table>
  </xsl:template>

If you want to only specify the sorting in the XSL, you can adjust the select=, order= and data-type=.  You can also add additional xsl:sort tags to sort by more than one field.

If ALL of the pictures will be uploaded to your site, you can use  <a href="http://www.mysite.com/portals/##/[Current Picture_UDT_Original]" target="_blank">[Current Picture]</a> in the template.  The ## is the number of the portal, which you can get from Admin, Site Settings, Advanced.

If some of the pictures will be referenced from other sites, you'd need to create an xsl:choose statement and check whether the image original location includes a full path (which would be a bit more work).

 
Previous
 
Next
HomeHomeDNN Open Source...DNN Open Source...Module ForumsModule ForumsForm and ListForm and ListDirectory Listing HelpDirectory Listing Help


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out