in

dashCommerce

An ASP.NET Open Source e-Commerce Application

How to include Static Pages in Menu Control

Last post 07-30-2008 6:03 PM by fturner. 9 replies.
Page 1 of 1 (10 items)
Sort Posts: Previous Next
  • 04-29-2008 3:22 AM

    • spawn
    • Top 75 Contributor
    • Joined on 03-02-2008
    • Melbourne
    • Posts 13

    How to include Static Pages in Menu Control

    Hi I'm building an new site in dc 3RC1.

    In addition to the dynamic pages created in the CMS via Admin I have some static pages.

    eg I have a Static "Contact Us" form that I would like to include in the menu. Currently the menu control only pulls back the dynamic pages.

    I was thinking of just having a drop down list for static pages in Admin that populates the static page URL instead of the default.aspx?pageID=

    Anyone else found a simple solution to this?

    Cheers,

    Shaun.

     

    www.infobytesmedia.com.au
  • 05-10-2008 2:13 PM In reply to

    Re: How to include Static Pages in Menu Control

    Did you ever come up with a solution to this?
  • 05-11-2008 6:02 AM In reply to

    • spawn
    • Top 75 Contributor
    • Joined on 03-02-2008
    • Melbourne
    • Posts 13

    Re: How to include Static Pages in Menu Control

    No not yet, I'll post it when I get around to it.

    www.infobytesmedia.com.au
  • 05-11-2008 9:49 PM In reply to

    Re: How to include Static Pages in Menu Control

    Here's what I came up with, not the most pretty, but it worked, if you put an aspx file name in the title of a content managed site, it will us the title as the url. This way you can easily change the order of the static pages.

    siteNavigation.xslt:

          <xsl:if test="not(contains(Title,'.aspx'))">
            <xsl:attribute name="NavigateUrl">
              <xsl:text>~/default.aspx?pageId=</xsl:text>
              <xsl:value-of select="PageId"/>
            </xsl:attribute>
          </xsl:if>

          <xsl:if test="contains(Title,'.aspx')">
            <xsl:attribute name="NavigateUrl">
              <xsl:text>~/</xsl:text>
              <xsl:value-of select="Title"/>
            </xsl:attribute>
          </xsl:if>

  • 05-13-2008 4:43 AM In reply to

    • spawn
    • Top 75 Contributor
    • Joined on 03-02-2008
    • Melbourne
    • Posts 13

    Re: How to include Static Pages in Menu Control

    Nice one. We ended up taking a similar approch, but rather than use Title, we added a DisplayPageURL and IsMenuItem field, which is returned in the dataset. We created a separate table and did a join. Just incase we want to upgrade.

     

     

    www.infobytesmedia.com.au
  • 07-17-2008 1:41 PM In reply to

    Re: How to include Static Pages in Menu Control

    Thank you Albino!!!

    I can't even meaure how much time you just saved me.  If I wanted to open up a .pdf inside the site or go to URL outside the site, how would I do so?

    Louis

  • 07-21-2008 12:56 PM In reply to

    Re: How to include Static Pages in Menu Control

    Hi Albino,

    I figured this out partly myself.  I was going to have several conditions in the If statements to determine if the extension is .aspx, .pdf, or .com.  It's strange how they never added an ELSE condition to XSL.  However, there is a CHOSE condition which is like a switch or a case statement.  I added the following to the SiteNavigation.xslt file:

    <xsl:choose>

    <xsl:when test="contains(Title,'.aspx')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/</xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:when test="contains(Title,'.pdf')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/</xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:when test="contains(Title,'.com')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/</xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:otherwise>

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/default.aspx?pageId=</xsl:text>

    <xsl:value-of select="PageId"/>

    </xsl:attribute>

    </xsl:otherwise>

    </xsl:choose>

    Now I have to figure out how to get those links to open up a separte window (target="_blank").

    Louis

  • 07-30-2008 11:19 AM In reply to

    Re: How to include Static Pages in Menu Control

    Hi All,

     OK, I figured out how to get menu choices for .PDFs or other websites to open up in a new window.

    1. I added Target as a field to dashCommerce_Content_Page.
    2. Set the Target field to _blank for the menu choices the I wanted to open up in a separate window.
    3. Modified the SiteNavigation.xslt file as follows:
    <xsl:template match="Menu">

    <MenuItem>

    <!-- Convert Menu child elements to MenuItem attributes -->

    <xsl:attribute name="Text">

    <xsl:value-of select="MenuTitle"/>

    </xsl:attribute>

    <xsl:attribute name="ToolTip">

    <xsl:value-of select="MenuTitle"/>

    </xsl:attribute>

    <xsl:attribute name="NavigateUrl">

    <xsl:value-of select="urlRewrite:ContentPageUrl(PageId, MenuTitle)"/>

    </xsl:attribute>

    <xsl:attribute name="Value">

    <xsl:value-of select="PageId"/>

    </xsl:attribute>

    <xsl:attribute name="Target">

    <xsl:value-of select="Target"/>

    </xsl:attribute>

    <!-- Call MenuListing if there are child Menu nodes -->

    <xsl:if test="count(Menu) > 0">

    <xsl:call-template name="MenuListing" />

    </xsl:if>

    <xsl:choose>

    <xsl:when test="contains(Title,'.aspx')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/</xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:when test="contains(Title,'.pdf')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/</xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    <xsl:attribute name="Target">

    <xsl:text> </xsl:text>

    <xsl:value-of select="Target"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:when test="contains(Title,'.com')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text></xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    <xsl:attribute name="Target">

    <xsl:text> </xsl:text>

    <xsl:value-of select="Target"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:when test="contains(Title,'.org')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text></xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    <xsl:attribute name="Target">

    <xsl:text> </xsl:text>

    <xsl:value-of select="Target"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:when test="contains(Title,'.net')">

    <xsl:attribute name="NavigateUrl">

    <xsl:text></xsl:text>

    <xsl:value-of select="Title"/>

    </xsl:attribute>

    <xsl:attribute name="Target">

    <xsl:text> </xsl:text>

    <xsl:value-of select="Target"/>

    </xsl:attribute>

    </xsl:when>

    <xsl:otherwise>

    <xsl:attribute name="NavigateUrl">

    <xsl:text>~/default.aspx?pageId=</xsl:text>

    <xsl:value-of select="PageId"/>

    </xsl:attribute>

    </xsl:otherwise>

    </xsl:choose>

    Louis

  • 07-30-2008 1:38 PM In reply to

    Re: How to include Static Pages in Menu Control

    Hi Louis,

    Would this be "patch friendly"? If so, you could put it on CodePlex.

     

    --
    Support dashCommerce - Buy Our Stuff!!


    Find a bug? Create a Work Item for a fast response.. Want to help? Create a patch for us! Documentation? Help us write some!
  • 07-30-2008 6:03 PM In reply to

    Re: How to include Static Pages in Menu Control

    Thanks for letting me know about this.  I've set it up and set the Target field to _blank.  The link sends me to the outside webpage I want but it doesn't open a new window....

     Any ideas what I did wrong?

    Fraser

Page 1 of 1 (10 items)