Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • syn-rg 282 posts 425 karma points
    Dec 07, 2010 @ 04:06
    syn-rg
    0

    List sub pages from a changeable source macro template issue

    I've created a "List sub pages from a changeable source" macro and have placed it into my template.

    I've picked the node I want to display sub pages from, however the content picker shows the page's ID not the page name.

    <umbraco:Macro source="1313" Alias="ProjectsVideoList" runat="server"></umbraco:Macro>

    I'm not sure if this will be an issue, but if I delete the page the content picker is looking for, then recreate it. I have to re-link the macro again. Is there a way of displaying the source as the "nodeName" instead of the "nodeID"?

  • Jon Cuthbert 84 posts 173 karma points
    Dec 07, 2010 @ 06:23
    Jon Cuthbert
    1

    You probably could use an XPath instead (ie. root/DocumentTypeName/AnotherDocumentTypeName).

  • Chriztian Steinmeier 2800 posts 8790 karma points MVP 8x admin c-trib
    Dec 07, 2010 @ 09:57
    Chriztian Steinmeier
    0

    As Jon says, it's possible (as always in Umbraco):

    Change your "source" parameter to a textstring instead and change your XSLT to something like this:

    <xsl:for-each select="$currentPage/ancestor-or-self::root//*[@nodeName = $source]/*[@isDoc and not(umbracoNaviHide = 1)]">

    /Chriztian

  • syn-rg 282 posts 425 karma points
    Dec 08, 2010 @ 05:13
    syn-rg
    0

    Thanks Jon and Chriztian, but ideally I want to display the source as the "nodeName" instead of the "nodeID".

    I should have explained my scenario in full.

    I have a section on my website called "Videos" that I include "video" doctypes. I have sub pages within this section displaying the child node video doctypes within them. However there are "video" doctypes in my "Projects" section and my "About Us" section. I only want to source video's from my "Projects" section so using the suggested method will include all "video" doctypes from any section.

    Here's my structure:

    About Us
    ----Our people
    --------video

    Videos
    ----News
    --------video
    --------video
    ----Safety
    --------video
    --------video
    ----Projects (This needs to display all the child nodes and only video doctypes from my "Projects" section)
    --------video
    --------video

    Projects
    ----Company
    --------video

    Currently I've got it working well, but like I stated in my initial post I want my Macro the source to be displayed as the "nodeName" instead of the "nodeID".

    Here's my code:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE xsl:stylesheet [ <!ENTITY nbsp "&#x00A0;"> ]>
    <xsl:stylesheet
      version="1.0"
      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
      xmlns:msxml="urn:schemas-microsoft-com:xslt"
      xmlns:umbraco.library="urn:umbraco.library" xmlns:Exslt.ExsltCommon="urn:Exslt.ExsltCommon" xmlns:Exslt.ExsltDatesAndTimes="urn:Exslt.ExsltDatesAndTimes" xmlns:Exslt.ExsltMath="urn:Exslt.ExsltMath" xmlns:Exslt.ExsltRegularExpressions="urn:Exslt.ExsltRegularExpressions" xmlns:Exslt.ExsltStrings="urn:Exslt.ExsltStrings" xmlns:Exslt.ExsltSets="urn:Exslt.ExsltSets" xmlns:uTube.XSLT="urn:uTube.XSLT" xmlns:Designit.VideoEmbed="urn:Designit.VideoEmbed" xmlns:PS.XSLTsearch="urn:PS.XSLTsearch"
      exclude-result-prefixes="msxml
    umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
    Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
    Exslt.ExsltSets uTube.XSLT Designit.VideoEmbed PS.XSLTsearch "
    >

    <xsl:output method="xml" omit-xml-declaration="yes" />

    <xsl:param name="currentPage"/>

    <!-- Don't change this, but add a 'contentPicker' element to -->
    <!-- your macro with an alias named 'source' -->
    <xsl:variable name="source" select="/macro/source"/>

    <xsl:variable name="documentTypeAlias" select="string('Video')"/>
        
    <xsl:template match="/">

    <!-- The fun starts here -->
      <div id="video_list_container">
        <ul>
          <xsl:for-each select="$currentPage/* [name() = $documentTypeAlias]">
            <li>
              <div class="info">
                <h1>
                  <xsl:value-of select="@nodeName"/>
                </h1>
                <p>
                  <xsl:value-of select="umbraco.library:StripHtml(./videoDescription)" />
                </p>
              </div>
              <a href="http://www.youtube.com/apiplayer?video_id={video}&amp;version=3&amp;enablejsapi=1&amp;playerapiid=ytplayer&amp;autoplay=1&amp;loop=1"
    id="{video}" class="videoEmbedFancy" onclick="openFancyBoxVideo(this, {videoWidth}, {videoHeight});return false;" title="{@nodeName}">
                <img width="150" height="113" title="{@nodeName}" src="http://i.ytimg.com/vi/{video}/hqdefault.jpg" />
                <span></span>
              </a>
            </li>
          </xsl:for-each>
          <xsl:for-each select="umbraco.library:GetXmlNodeById($source)//* [name() = $documentTypeAlias and string(umbracoNaviHide) != '1']">
             <li>
              <div class="info">
                <h1>
                  <xsl:value-of select="@nodeName"/>
                </h1>
                <p>
                  <xsl:value-of select="umbraco.library:StripHtml(./videoDescription)" />
                </p>
              </div>
              <a href="http://www.youtube.com/apiplayer?video_id={video}&amp;version=3&amp;enablejsapi=1&amp;playerapiid=ytplayer&amp;autoplay=1"
    id="{video}" class="videoEmbedFancy" onclick="openFancyBoxVideo(this, {videoWidth}, {videoHeight});return false;" title="{@nodeName}">
                <img width="150" height="113" title="{@nodeName}" src="http://i.ytimg.com/vi/{video}/hqdefault.jpg" />
                <span></span>
              </a>
            </li>
          </xsl:for-each>
        </ul>
      </div>
    </xsl:template>

    </xsl:stylesheet>
Please Sign in or register to post replies

Write your reply to:

Draft