Copied to clipboard

Flag this post as spam?

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


  • vaibhav 119 posts 139 karma points
    Mar 24, 2011 @ 11:28
    vaibhav
    0

    properties of doc type in template

    i have teplates herirachy like this

    siteMaster  /* main master page */

    >Home page

    >SubMaster   /* master page */

       >>page 1

       >>page 2

    & i have doc. type named"homepage" .....

    I have created some properties in homepage doc. type

    I m able to use that properties in "Home page" template but that properties are not reflecting in "SubMaster" when i use it in SunMaster template.

     

    What to do ?

    Do i have to make any xslt for that ?

  • Pasang Tamang 258 posts 458 karma points
    Mar 24, 2011 @ 11:32
    Pasang Tamang
    0

    Hi, 

    May be some xslt codes are missing. Could you please post sample code?

    Pnima

  • Rich Green 2246 posts 4008 karma points
    Mar 24, 2011 @ 11:33
    Rich Green
    0

    You need to set recursive="true"

     <umbraco:Item field="homePageField" recursive="true" runat="server"></umbraco:Item>


    Rich

  • vaibhav 119 posts 139 karma points
    Mar 24, 2011 @ 12:41
    vaibhav
    0

    thanx rich ... it solved my more than 90% probelm of mine.

    Just there is one more problem in that .....

    i am using one xslt to truncate the string ...where the string comes from the parameter which is defined in doc. type "homepage"....this also i want to use in the "subMaster" template.

    This is my xslt 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:tagsLib="urn:tagsLib" xmlns:BlogLibrary="urn:BlogLibrary"
      exclude-result-prefixes="msxml
    umbraco.library Exslt.ExsltCommon Exslt.ExsltDatesAndTimes
    Exslt.ExsltMath Exslt.ExsltRegularExpressions Exslt.ExsltStrings
    Exslt.ExsltSets tagsLib BlogLibrary "
    >


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

    <xsl:param name="currentPage"/>

    <xsl:template match="/">

    <!-- start writing XSLT -->
    <xsl:value-of select="umbraco.library:TruncateString($currentPage/solutionBlock1_content,60,' >>')"/>
      
    </xsl:template>

    </xsl:stylesheet>
  • Rich Green 2246 posts 4008 karma points
    Mar 24, 2011 @ 13:15
    Rich Green
    0

    Hey,

    Try this

       <xsl:variable name="solBlock" select="$currentPage/ancestor-or-self::*[@isDoc and normalize-space(solutionBlock1_content)][1]/solutionBlock1_content" />
        <xsl:value-of select="umbraco.library:TruncateString($solBlock,60,' >>')"/>

    Rich

  • Richard 146 posts 168 karma points
    Mar 24, 2011 @ 13:20
    Richard
    0

    If you change your macro to accept a parameter containing the alias of the property that you want to truncate, then you will be able to use it to truncate any property, just included it in the template:

    <umbraco:Macro PageProperty="solutionBlock1_content" Alias="XSLTTruncateString" runat="server" />

    Modify the macro definition to have this extra parameter and then modify the macro:

    Accept the parameter:

    <xsl:variable name="pageProperty" select="/macro/PageProperty"/>

    and use it

    <xsl:comment>Output the value, just to demonstrate</xsl:comment>
    <xsl:value-of select="$currentPage/data [@alias=$pageProperty]"/>


    <xsl:value-of select="umbraco.library:TruncateString($currentPage/data [@alias=$pageProperty]
    ,60,' >>')"/>

    This will work in Umbraco 4.0 and before.

     

  • vaibhav 119 posts 139 karma points
    Mar 24, 2011 @ 14:24
    vaibhav
    0

    Rich it is working....Thanx

  • vaibhav 119 posts 139 karma points
    Mar 24, 2011 @ 14:34
    vaibhav
    0

    Can u make xslt for property "solutionBlock1_content" so that i can understand it in better way......

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

    Continue discussion

Please Sign in or register to post replies