Copied to clipboard

Flag this post as spam?

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


  • Jon 10 posts 31 karma points
    Feb 11, 2010 @ 10:56
    Jon
    0

    Use a renderTemplate as a property from parent page in xsltmacro

    Umbraco: v 4.0.3

    Background

    I have a specific need not to use the default mapping of Document type and multiple templates for that document type for a specific Document type.

    I have a Document type called Product.

    For this document type I would like to steal the parents Template and inject some of the own properties to that template.

    I have successfully done this with Umbraco library method RenderTemplate.

    <xsl:value-of select="umbraco.library:RenderTemplate($pageId,$templateIdToUse)" disable-output-escaping="yes"/>

     

    This means I dont have to REPEAT the choice of what template to use for each nested document type product.

    Ex: Page a (with template 1234)

    - product1

     - product2...

    Product 1 and 2 will now use the 1234 template (so far so good).
    If the template 1234 has rendering of field bodyText the bodyText from products will appear on correct place.

    I'm using dynamic templates so just to nest different sub document types that default maps to a template will not do in this very specific case :-/

    The problem

    But I would like to use something like dynamic properties( or a renderTemplate)

    I would like to give Page a a specifik property lets say ProductTemplate (of type Richtext with tinyMCE support)

    inside this template I can arrange a dynamic template with placeholder for product properties like Price etc.
    Simple ex:

    <p>Price: [#price]</p>

    I have tried using Replace to substitute the output from RenderTemplate with the output from the render template like:

    umbraco.library:Replace(umbraco.library:RenderTemplate($pageId,$templateIdToUse),$bodyText,'dynamic text here later on')

    But to no avail. :-(

    I would like to basicly be able to use something like

    umbraco.library:RenderTemplateFromNode($nodeData,$templateIdToUse)

    Where nodeData would be the current node with bodyText altered to be the renderedTemplate substitution.

    This way I could have multiple Product listings with different templates, all product sibblings would use the corrent Base template and the same renderingtempalte.

    If going with the above solution I would have to extend the Core library to be able to render a own xmlnode (with umbraco page data) with a specific template, thus being able to alter different page fields.

    Help wanted

    Suggestions, alternative aproaches? Something that is not as complex as the above stated possible solution?

Please Sign in or register to post replies

Write your reply to:

Draft