General Node Trees - Eonic/ProteanCMS GitHub Wiki

General Node Trees

This document provides an overview of various general node trees used within ProteanCMS, including how to retrieve and manipulate data from the XML structure.


Pages

To access the main page element:

<xsl:variable name="page" select="/Page"/>

Description:

This variable stores the root <Page> node, which serves as the primary context for further data extraction.


Page ID

To retrieve the unique identifier for the page:

<xsl:variable name="pageId" select="/Page/@id"/>

Description:

This variable captures the id attribute of the <Page> node, which can be used for referencing or conditional logic.


Article ID

To extract the article ID from the query string:

<xsl:variable name="artId" select="number(concat(0,/Page/Request/QueryString/Item[@name='artid']))"/>

Description:

This variable converts the artid query string parameter to a number, ensuring it can be used for numeric operations.


Application Path

To define the application path based on server variables:

<xsl:variable name="appPath">
    <xsl:choose>
        <xsl:when test="/Page/Request/ServerVariables/Item[@name='APPLICATION_ROOT']/node()!=''">
            <xsl:value-of select="/Page/Request/ServerVariables/Item[@name='APPLICATION_ROOT']/node()"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:text>/</xsl:text>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Description:

This variable checks for an application root path in server variables and sets it, defaulting to the root / if not found.


Menu

To access the menu structure:

<xsl:variable name="menu" select="/Page/Menu"/>

Description:

This variable references the <Menu> node, which contains all navigational items for the site.


Cart

To retrieve the shopping cart details:

<xsl:variable name="cart" select="/Page/Cart"/>

Description:

This variable stores the <Cart> node, allowing access to cart-related data.


Cart Page

To determine if the current page is a cart order page:

<xsl:variable name="cartPage" select="/Page/Cart[@type='order']/Order/@cmd!=''"/>

Description:

This variable checks if the cart type is 'order' and whether a command exists, indicating an active cart page.


Admin Mode

To check if the page is in admin mode:

<xsl:variable name="adminMode" select="/Page/@adminMode"/>

Description:

This variable retrieves the adminMode attribute, which can be used to enable or disable certain features in the CMS.


Current Page

To find the current page in the menu:

<xsl:variable name="currentPage" select="/Page/Menu/descendant-or-self::MenuItem[@id=/Page/@id]"/>

Description:

This variable locates the <MenuItem> that matches the current page's id, enabling specific menu item highlighting.


Section Pages

To access different levels of menu items in sections:

<xsl:variable name="sectionPage" select="/Page/Menu/MenuItem/MenuItem[descendant-or-self::MenuItem[@id=/Page/@id]]"/>
<xsl:variable name="subSectionPage" select="/Page/Menu/MenuItem/MenuItem/MenuItem[descendant-or-self::MenuItem[@id=/Page/@id]]"/>
<xsl:variable name="subSubSectionPage" select="/Page/Menu/MenuItem/MenuItem/MenuItem/MenuItem[descendant-or-self::MenuItem[@id=/Page/@id]]"/>
<xsl:variable name="subSubSubSectionPage" select="/Page/Menu/MenuItem/MenuItem/MenuItem/MenuItem/MenuItem[descendant-or-self::MenuItem[@id=/Page/@id]]"/>
<xsl:variable name="subSubSubSubSectionPage" select="/Page/Menu/MenuItem/MenuItem/MenuItem/MenuItem/MenuItem/MenuItem[descendant-or-self::MenuItem[@id=/Page/@id]]"/>

Description:

These variables provide access to various hierarchical levels of menu items, enabling more granular control over navigation.


Match Height Tree Type

To define the match height type for layout purposes:

<xsl:variable name="MatchHeightType" select="'matchHeight'"/>

Description:

This variable sets a constant value for layout configurations that require equal height elements.


Gutter Widths

To specify gutter widths for layout spacing:

<xsl:variable name="GutterWidth" select="'20'"/>
<xsl:variable name="GutterWidthLg" select="'30'"/>

Description:

These variables define gutter widths for responsive design, ensuring consistent spacing between elements.


Responsive Image Sizes

To control responsive image settings:

<xsl:variable name="responsiveImageSizes">off</xsl:variable>

Description:

This variable allows for the toggling of responsive image size adjustments, optimizing image loading based on screen size.


Site URL

To construct the base URL of the site:

<xsl:variable name="siteURL">
    <xsl:variable name="baseUrl">
        <xsl:call-template name="getXmlSettings">
            <xsl:with-param name="sectionName" select="'web'"/>
            <xsl:with-param name="valueName" select="'BaseUrl'"/>
        </xsl:call-template>
    </xsl:variable>
    <xsl:variable name="cartSiteUrl">
        <xsl:call-template name="getXmlSettings">
            <xsl:with-param name="sectionName" select="'cart'"/>
            <xsl:with-param name="valueName" select="'SiteURL'"/>
        </xsl:call-template>
    </xsl:variable>
    <xsl:choose>
        <xsl:when test="$cartSiteUrl!=''">
            <xsl:value-of select="$cartSiteUrl"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:choose>
                <xsl:when test="$baseUrl!=''">
                    <xsl:value-of select="$baseUrl"/>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:value-of select="/Page/Request/ServerVariables/Item[@name='SERVER_NAME']"/>
                    <xsl:if test="/Page/Request/ServerVariables/Item[@name='SERVER_PORT'] != '80' and  /Page/Request/ServerVariables/Item[@name='SERVER_PORT'] != '443'">
                        <xsl:text>:</xsl:text>
                        <xsl:value-of select="/Page/Request/ServerVariables/Item[@name='SERVER_PORT']"/>
                    </xsl:if>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Description:

This variable constructs the full site URL, considering both base URLs and potential cart-specific URLs, handling different server ports appropriately.


Site Name

To derive the site name based on server settings:

<xsl:variable name="sitename">
    <xsl:choose>
        <xsl:when test="$siteURL=''">
            <xsl:text>http</xsl:text>
            <xsl:if test="$page/Request/ServerVariables/Item[@name='HTTPS']='on'">s</xsl:if>
            <xsl:text>://</xsl:text>
            <xsl:value-of select="$page/Request/ServerVariables/Item[@name='SERVER_NAME']"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:value-of select="$siteURL"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Description:

This variable constructs the site name by checking whether a site URL is defined and including the appropriate protocol based on HTTPS status.


Href

To determine the correct href for navigation:

<xsl:variable name="href">
    <xsl:choose>
        <xsl:when test="/Page/ContentDetail">
            <xsl:apply-templates select="/Page/ContentDetail/Content" mode="getHref"/>
        </xsl:when>
        <xsl:otherwise>
            <xsl:apply-templates select="$currentPage" mode="getHref"/>
        </xsl:otherwise>
    </xsl:choose>
</xsl:variable>

Description:

This variable evaluates whether the current page has content details and applies the appropriate templates to retrieve the corresponding href.


Script Version

To define the version of the script being used:

<xsl:variable name="scriptVersion" select="'2'"/>

Description:

This variable sets the script version number, which can be useful for compatibility checks and version control.


ewCmd

To extract the command from the query string:

<xsl:variable name="ewCmd" select="/Page/Request/QueryString/Item[@name='ewCmd']/node()"/>

Description:

This variable captures the ewCmd parameter from the query string, which may dictate the action to be taken by the application.



⚠️ **GitHub.com Fallback** ⚠️