Is there an easy way to get the XML list of topics that are published (and only topics) to use in a menu control?
Is there an easy way to get the XML list of topics that are published (and only topics) to use in a menu control?
If you are trying to use this in an xmlpackage, just use the following query in the xmlpackage fileThis will return all topics in xml format for use in the xmlpackage, eg.Code:<query name="Topics" rowElementName="Topic"> <sql> <![CDATA[ select * from dbo.Topic where deleted=0 ]]> </sql> </query>If you set debug="true" in the package node you can see the xml structure on the page when you browse to a page using that xmlpackage. Please elaborate on where/how you're trying to do this (from a codebehind file, in the skin, etc...) if you are looking for something different.Code:<Topics> <Topic> <Name>TopicName</Name> <Title>TopicTitle</Title> ... ... </Topic> <Topic> <Name>TopicName2</Name> <Title>TopicTitle2</Title> ... ... </Topic> <Topic> <Name>TopicName3</Name> <Title>TopicTitle3</Title> ... ... </Topic> <Topic> <Name>TopicName4</Name> <Title>TopicTitle4</Title> ... ... </Topic> </Topics>
<a href="http://www.aspdotnetstorefront.com">Shopping Cart Software</a>
Thank you. That was a good start. I am having a bit of trouble though. I apologize, our company does not do many eCommerce projects and this is our first and only with your software. It's also been many months since I was last in this project.
What I'd like, is something like the TopMenu config that just spits out a HTML list of all of pages. I was playing around with a copy of the TopMenu but I am not familar enough with how all the data is getting pulled and XMLPackages to really know exactly what I am doing.
Would you happen to already have something like this already?
Actually, better yet, this is what I have so far. What I am getting is that only the first item from the results is showing. Also, I do not know what to look for from the result set to do a 'selected' class on the current item.
Code:<?xml version="1.0" standalone="yes" ?> <package version="2.1" displayname="Topic Data As Xml" debug="false" allowengine="true" includeentityhelper="false"> <query name="Topics" rowElementName="Topic"> <sql> <![CDATA[ select * from dbo.Topic where deleted=0 AND ShowInSiteMap=1 AND Name LIKE 'gh_%' ]]> </sql> </query> <PackageTransform> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf"> <xsl:output method="xml" omit-xml-declaration="no" /> <xsl:param name="PageTitle"> <xsl:for-each select="/"> <xsl:value-of select="root/Topics/Topic/Title"/> </xsl:for-each> </xsl:param> <xsl:param name="PageName"> <xsl:for-each select="/"> <xsl:value-of select="root/Topics/Topic/Name"/> </xsl:for-each> </xsl:param> <xsl:template match="/"> <ul> <xsl:for-each select="/"> <li> <a href="{concat('t-',$PageName,'.aspx')}"> <xsl:if test=""> <xsl:attribute name="class">Selected</xsl:attribute> </xsl:if> <xsl:value-of select="$PageTitle"/> </a> </li> </xsl:for-each> </ul> </xsl:template> </xsl:stylesheet> </PackageTransform> </package>
Do something like this
it will work for you
<package version="2.1" displayname="Departments" debug="false" allowengine="true" includeentityhelper="false">
<query name="Topics" rowElementName="Topic">
<sql>
<![CDATA[
select * from dbo.Topic where deleted=0 AND ShowInSiteMap=1
]]>
</sql>
</query>
<PackageTransform>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:aspdnsf="urn:aspdnsf" exclude-result-prefixes="aspdnsf">
<xslutput method="xml" omit-xml-declaration="no" />
<xsl:template match="/">
<xsl:for-each select="root/Topics/Topic">
<xsl:sort select="DisplayOrder"/>
<xsl:sort select="Name"/>
<xsl:element name="li">
<xsl:element name="a">
<xsl:attribute name="href">
<xsl:value-of select="concat('t-',Name,'',SEName,'.aspx')"/>
</xsl:attribute>
<xsl:value-of select="aspdnsf:GetMLValue(Title)"/>
</xsl:element>
</xsl:element>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
</PackageTransform>
</package>
Eat my code!
Multistore V 9 sp1
Best Hosting for your storefront Business in 2011
http://fasoservice.com
world wide directory submission
http://Nanalist.com
Burkina24 Media news in Burkina Faso
http://burkina24.com