Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: Change flash banner based on category, section, product

  1. #1
    press is offline Member
    Join Date
    May 2009
    Posts
    31

    Default Change flash banner based on category, section, product

    I had been working on creating a banner that would change based on user input, category selection and so on. I found this on the forum from Rizzy. It works great, but i cant seem to make it work with flash. I would really like to have flash in the banner instead of images. Has anyone gotten a flash banner to change based on category or other user input?




    <?xml version="1.0" standalone="yes" ?>
    <package version="2.1" displayname="SubHeader" debug="false" includeentityhelper="true">

    <query name="Categories" rowElementName="Category">
    <sql>
    <![CDATA[
    SELECT * FROM Category WHERE CategoryID = @CategoryID
    ]]>
    </sql>
    <queryparam paramname="@CategoryID"
    paramtype="request"
    requestparamname="categoryid"
    sqlDataType="int"
    defvalue="0"
    validationpattern="" />
    </query>

    <query name="Products" rowElementName="Product">
    <sql>
    <![CDATA[
    SELECT TOP 1* FROM ProductCategory WHERE ProductID = @ProductID
    ]]>
    </sql>
    <queryparam paramname="@ProductID"
    paramtype="request"
    requestparamname="productid"
    sqlDataType="int"
    defvalue="0"
    validationpattern="" />
    </query>

    <query name="Sections" rowElementName="Section">
    <sql>
    <![CDATA[
    SELECT * FROM Section WHERE SectionID = @SectionID
    ]]>
    </sql>
    <queryparam paramname="@SectionID"
    paramtype="request"
    requestparamname="sectionid"
    sqlDataType="int"
    defvalue="0"
    validationpattern="" />
    </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="html" omit-xml-declaration="yes" />

    <xsl:template match="/">
    <xsl:choose>
    <xsl:when test="/root/Products/Product !=0 or /root/Categories/Category !=0 or /root/Sections/Section !=0 ">
    <xsl:apply-templates select="/root/Products/Product" />
    <xsl:apply-templates select="/root/Categories/Category" />
    <xsl:apply-templates select="/root/Sections/Section" />
    </xsl:when>
    <xsltherwise>
    <img src='./skins/Skin_1/images/subheader/0.gif'></img>
    </xsltherwise>
    </xsl:choose>
    </xsl:template>

    <xsl:template match="Product">
    <xsl:choose>
    <xsl:when test="aspdnsf:FileExists(concat('./skins/Skin_1/images/subheader/',CategoryID,'.gif')) = 'true'">
    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="concat('./skins/Skin_1/images/subheader/',CategoryID,'.gif')"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:when>
    <xsltherwise>
    <img src='./skins/Skin_1/images/subheader/0.gif'></img>
    </xsltherwise>
    </xsl:choose>
    </xsl:template>

    <xsl:template match="Category">
    <xsl:choose>
    <xsl:when test="aspdnsf:FileExists(concat('./skins/Skin_1/images/subheader/',CategoryID,'.gif')) = 'true'">
    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="concat('./skins/Skin_1/images/subheader/',CategoryID,'.gif')"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:when>
    <xsltherwise>
    <img src='./skins/Skin_1/images/subheader/0.gif'></img>
    </xsltherwise>
    </xsl:choose>
    </xsl:template>

    <xsl:template match="Section">
    <xsl:choose>
    <xsl:when test="aspdnsf:FileExists(concat('./skins/Skin_1/images/subheader-department/',SectionID,'.gif')) = 'true'">
    <xsl:element name="img">
    <xsl:attribute name="src">
    <xsl:value-of select="concat('./skins/Skin_1/images/subheader-department/',SectionID,'.gif')"/>
    </xsl:attribute>
    </xsl:element>
    </xsl:when>
    <xsltherwise>
    <img src='./skins/Skin_1/images/subheader/0.gif'></img>
    </xsltherwise>
    </xsl:choose>
    </xsl:template>

    </xsl:stylesheet>
    </PackageTransform>

    </package>

  2. #2
    press is offline Member
    Join Date
    May 2009
    Posts
    31

    Default what does not work for flash banner in xml package

    When i place:

    <EMBED height=150 type=application/x-shockwave-flash align=baseline pluginspage=http://www.macromedia.com/go/getflashplayer width=904 src=/SpectrumProductions.Com/images/flash/(!StringResource Name="sp.flash_top"!) bgcolor salign="LT" quality="high" menu="false" loop="false" scale="exactfit">

    I get the following error.
    "Exception=Error in XmlPackage(.Load), Package=[skin.flashtop.xml.config], Msg=[Exception='150' is an unexpected token. The expected token is '"' or '''. Line 58, position 19."

    What is the problem with this, does the xml package parse the flash command before the page is rendered?

  3. #3
    press is offline Member
    Join Date
    May 2009
    Posts
    31

    Default put code somewhere else

    in another effort, i put the flash <embed> in the template.aspx, with a string resource. That works, but i dont have a way to update the string resource when the user navigates around the site.

    My other method that puts the xml package (!XmlPackage name="skin.flashtop.xml.config"!) above the horizaontal nav does not work.

    Can i configure the xml package to just send back the NAME of the flash file. so the flash file is not embedded in the xml package itself.

    I dont know where to start with that however.

    Thanks

  4. #4
    press is offline Member
    Join Date
    May 2009
    Posts
    31

    Default Got it working, but need one more thing

    OK, got it going. I put in the line for the flash, and called the xlm package from there. resigned xml package to return only the file name based on the category, section, or product.

    <EMBED height=150 type=application/x-shockwave-flash align=baseline pluginspage=http://www.macromedia.com/go/getflashplayer width=904 src=/spectrumproductions.com(!XmlPackage name="skin.flashtop.xml.config"!) bgcolor salign="LT" quality="high" menu="false" loop="false" scale="exactfit">


    The final question is how can i get the page referrer and then add that to my logic. For example if i call a t- page then, i get nothing back on categories.

  5. #5
    PickledLove is offline Junior Member
    Join Date
    Aug 2011
    Posts
    1

    Default Help

    This is exactly what I want to do, but with regular images, not flash. I've tried your code above, but I can't get it to work. I keep getting the error "Exception=Top-level element 'xslutput' may not have a null namespace URI." Do you have an updated version or the original code from Rizzy?